MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / ~WithPerfLoggingImpl

Method ~WithPerfLoggingImpl

src/logging.cpp:268–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266 }
267
268 ~WithPerfLoggingImpl()
269 {
270 if (stats.size() < 2)
271 return;
272 std::vector<double> &v = stats;
273 std::sort(v.begin(), v.end());
274 double sum = std::accumulate(v.begin(), v.end(), 0.0);
275 size_t n = v.size();
276 double mean = sum / n;
277 std::vector<double> diff(n);
278 for (size_t i = 0; i < n; ++i)
279 {
280 diff[i] = v[i] - mean;
281 }
282 double sqsum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0);
283 double std = std::sqrt(sqsum / (n-1));
284
285 std::cout << name << v[0] << " " << v[n/20] << " " << v[n/2] << " " << v[n - (n+19)/20] << " " << v[n-1] << " mean=" << mean << " std=" << std << " n=" << n << std::endl;
286 }
287#endif
288
289 std::ostream &stop(std::ostream &stream)

Callers

nothing calls this directly

Calls 3

beginMethod · 0.80
endMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected