24 while ((_timers.find(tmp_key)) != _timers.end())
33 _timers.insert(pair<string, timer>(tmp_key,
timer(tmp_key, _timer_id)));
37 return _timers.find(tmp_key)->second;
45 while ((_single_shot_timers.find(tmp_key)) != _single_shot_timers.end())
54 _single_shot_timers.insert(pair<string, timer>(tmp_key,
timer(tmp_key, _single_shot_timer_id)));
55 _single_shot_timer_id++;
58 return _single_shot_timers.find(tmp_key)->second;
66 if (_iter != _timers.end())
71 what <<
"unknown timer \"" << key <<
"\" requested.";
72 throw invalid_argument(what.str());
86 what <<
"unknown timer \"" << key <<
"\" requested.";
87 throw invalid_argument(what.str());
100 sprintf(str,
"%-20s [%2i] - %-6g ms (%s)-.",
101 iter->second.get()->get_name().c_str(),
102 iter->second.get_uid(),
103 iter->second.get()->elapsed(),
104 (
char*) ((iter->second.get()->get_state() ==
PHTimer::RUN) ?
" (running)" :
" (stopped)"));
113 sprintf(str,
"single_shot - %-20s [%2i] - %-6g ms (%s)-.",
114 iter->second.get()->get_name().c_str(),
115 iter->second.get_uid(),
116 iter->second.get()->elapsed(),
117 (
char*) ((iter->second.get()->get_state() ==
PHTimer::RUN) ?
" (running)" :
" (stopped)"));
137 if (iter->second.get()->get_ncycle())
140 sprintf(str,
"%-20s [%2i] - Accumulated time: %-6g ms. cycles: %-10u. Time per cycle: %-6g ms",
141 iter->second.get()->get_name().c_str(),
142 iter->second.get_uid(),
143 iter->second.get()->get_accumulated_time(),
144 iter->second.get()->get_ncycle(),
145 iter->second.get()->get_time_per_cycle());
150 PHTimer::PRINT(out,
"Mutoo PHTimeServer single_shots statistics");
152 if (iter->second.get()->get_ncycle())
155 sprintf(str,
"single_shot - %-20s [%2i] - accumulated: %-6g ms.",
156 iter->second.get()->get_name().c_str(),
157 iter->second.get_uid(),
158 iter->second.get()->get_accumulated_time());
162 if (iter->second.get()->get_ncycle() != 1)
163 out <<
" WARNING: single_shot started more than once.";