27 #define UINT64_MAX 18446744073709551615
42 mNumEntriesToSkipAtStart = skipEntries;
59 mNumEntriesToSkipAtStart = skipEntries;
73 mNumEntriesToSkipAtStart = skipEntries;
126 return mM2/(entries-1);
154 uint32_t elapsedTime;
160 if (mNumEntriesToSkipAtStart > 0)
162 mNumEntriesToSkipAtStart--;
166 mTotalTime += elapsedTime;
173 double delta1 = elapsedTime - mMean;
174 mMean += delta1/mEntries;
175 double delta2 = elapsedTime - mMean;
176 mM2 += delta1 * delta2;
178 if (elapsedTime > mMaxTime)
180 mMaxTime = elapsedTime;
185 if (elapsedTime < mMinTime)
187 mMinTime = elapsedTime;
190 else if (elapsedTime < mMinTime)
192 mMinTime = elapsedTime;
203 double mean =
Mean();
205 string times = (entries == 1) ?
"time, " :
"times, ";
206 string reportName = name.empty() ?
Name() : name;
208 std::ostringstream oss;
209 oss <<
" [" << std::left << std::setw(23) << std::setfill(
' ') << reportName <<
"] " <<
210 "called " << std::right << std::setw(4) << entries <<
" " << times <<
211 "min: " << std::right << std::setw(4) << min <<
", " <<
212 "mean: " << std::right << std::setw(5) << std::fixed << std::setprecision(2) << mean <<
", " <<
213 "stdev: " << std::right << std::setw(5) << std::fixed << std::setprecision(2) << stdev <<
", " <<
214 "max: " << std::right << std::setw(4) << max;
218 pFileName ==
NULL ? __FILE__ : pFileName,
219 lineNumber < 0 ? __LINE__ : lineNumber,
227 if(stats.find(key) == stats.end())
231 stats[key] = newStatsGroup;
234 AJAPerformanceTracking::iterator foundAt = stats.find(key);
235 if(foundAt != stats.end())
237 foundAt->second.
Start();
248 uint64_t skipEntries)
250 if(stats.find(key) == stats.end())
253 AJAPerformance newStatsGroup(key, extras, precision, skipEntries);
254 stats[key] = newStatsGroup;
257 AJAPerformanceTracking::iterator foundAt = stats.find(key);
258 if(foundAt != stats.end())
260 foundAt->second.
Start();
271 AJAPerformanceTracking::iterator foundAt = stats.find(key);
272 if(foundAt != stats.end())
274 foundAt->second.Stop();
288 if (stats.size() > 0)
292 title =
"stats_report";
297 std::ostringstream title_oss;
298 std::ostringstream units_oss;
299 std::ostringstream footer_oss;
300 title_oss << title <<
", tracking " << stats.size() <<
" {";
301 units_oss <<
" * time units are in " << units <<
" *";
307 AJAPerformanceTracking::iterator foundAt = stats.begin();
308 while (foundAt != stats.end())
310 std::string key = foundAt->first;
313 perf.
Report(key, pFileName, lineNumber);