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

Unified Diff: tools/Stats.h

Issue 1204153002: Add samplingTime mode to nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_loopSKP
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
Index: tools/Stats.h
diff --git a/tools/Stats.h b/tools/Stats.h
index 8487a9497da6dff23cf2508dad5831065deeaa29..2a75f07f06e7200e2192933849ce87290306f3e7 100644
--- a/tools/Stats.h
+++ b/tools/Stats.h
@@ -11,7 +11,13 @@
#endif
struct Stats {
- Stats(const double samples[], int n) {
+ Stats(const SkTArray<double>& samples) {
+ int n = samples.count();
+ if (!n) {
+ min = max = mean = var = median = 0;
+ return;
+ }
+
min = samples[0];
max = samples[0];
for (int i = 0; i < n; i++) {
@@ -32,7 +38,7 @@ struct Stats {
var = err / (n-1);
SkAutoTMalloc<double> sorted(n);
- memcpy(sorted.get(), samples, n * sizeof(double));
+ memcpy(sorted.get(), samples.begin(), n * sizeof(double));
SkTQSort(sorted.get(), sorted.get() + n - 1);
median = sorted[n/2];
« bench/nanobench.cpp ('K') | « bench/nanobench.cpp ('k') | tools/timer/SysTimer_mach.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698