Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: tools/Stats.h

Issue 338203002: Refine bench_record and bench_playback: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #ifndef Stats_DEFINED
2 #define Stats_DEFINED
3
4 struct Stats {
5 Stats(const double samples[], int n) {
6 min = samples[0];
7 max = samples[0];
8 for (int i = 0; i < n; i++) {
9 if (samples[i] < min) { min = samples[i]; }
10 if (samples[i] > max) { max = samples[i]; }
11 }
12
13 double sum = 0.0;
14 for (int i = 0 ; i < n; i++) {
15 sum += samples[i];
16 }
17 mean = sum / n;
18
19 double err = 0.0;
20 for (int i = 0 ; i < n; i++) {
21 err += (samples[i] - mean) * (samples[i] - mean);
22 }
23 var = err / (n-1);
24 }
25
26 double min;
27 double max;
28 double mean; // Estimate of population mean.
29 double var; // Estimate of population variance.
30 };
31
32 #endif//Stats_DEFINED
OLDNEW
« no previous file with comments | « bench/BenchTimer.cpp ('k') | tools/bench_playback.cpp » ('j') | tools/bench_playback.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698