| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "nanobench.h" | 10 #include "nanobench.h" |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 const double overhead = estimate_timer_overhead(); | 1126 const double overhead = estimate_timer_overhead(); |
| 1127 SkDebugf("Timer overhead: %s\n", HUMANIZE(overhead)); | 1127 SkDebugf("Timer overhead: %s\n", HUMANIZE(overhead)); |
| 1128 | 1128 |
| 1129 SkTArray<double> samples; | 1129 SkTArray<double> samples; |
| 1130 | 1130 |
| 1131 if (kAutoTuneLoops != FLAGS_loops) { | 1131 if (kAutoTuneLoops != FLAGS_loops) { |
| 1132 SkDebugf("Fixed number of loops; times would only be misleading so we wo
n't print them.\n"); | 1132 SkDebugf("Fixed number of loops; times would only be misleading so we wo
n't print them.\n"); |
| 1133 } else if (FLAGS_quiet) { | 1133 } else if (FLAGS_quiet) { |
| 1134 SkDebugf("median\tbench\tconfig\n"); | 1134 SkDebugf("! -> high variance, ? -> moderate variance\n"); |
| 1135 SkDebugf(" micros \tbench\n"); |
| 1135 } else if (FLAGS_ms) { | 1136 } else if (FLAGS_ms) { |
| 1136 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\tsamples\tc
onfig\tbench\n"); | 1137 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\tsamples\tc
onfig\tbench\n"); |
| 1137 } else { | 1138 } else { |
| 1138 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\t%-*s\tconf
ig\tbench\n", | 1139 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\t%-*s\tconf
ig\tbench\n", |
| 1139 FLAGS_samples, "samples"); | 1140 FLAGS_samples, "samples"); |
| 1140 } | 1141 } |
| 1141 | 1142 |
| 1142 SkTDArray<Config> configs; | 1143 SkTDArray<Config> configs; |
| 1143 create_configs(&configs); | 1144 create_configs(&configs); |
| 1144 | 1145 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 if (kAutoTuneLoops != FLAGS_loops) { | 1235 if (kAutoTuneLoops != FLAGS_loops) { |
| 1235 if (configs.count() == 1) { | 1236 if (configs.count() == 1) { |
| 1236 config = ""; // Only print the config if we run the same ben
ch on more than one. | 1237 config = ""; // Only print the config if we run the same ben
ch on more than one. |
| 1237 } | 1238 } |
| 1238 SkDebugf("%4d/%-4dMB\t%s\t%s\n" | 1239 SkDebugf("%4d/%-4dMB\t%s\t%s\n" |
| 1239 , sk_tools::getCurrResidentSetSizeMB() | 1240 , sk_tools::getCurrResidentSetSizeMB() |
| 1240 , sk_tools::getMaxResidentSetSizeMB() | 1241 , sk_tools::getMaxResidentSetSizeMB() |
| 1241 , bench->getUniqueName() | 1242 , bench->getUniqueName() |
| 1242 , config); | 1243 , config); |
| 1243 } else if (FLAGS_quiet) { | 1244 } else if (FLAGS_quiet) { |
| 1244 if (configs.count() == 1) { | 1245 const char* mark = " "; |
| 1245 config = ""; // Only print the config if we run the same ben
ch on more than one. | 1246 const double stddev_percent = 100 * sqrt(stats.var) / stats.mean
; |
| 1246 } | 1247 if (stddev_percent > 5) mark = "?"; |
| 1247 SkDebugf("%s\t%s\t%s\n", HUMANIZE(stats.median), bench->getUniqu
eName(), config); | 1248 if (stddev_percent > 10) mark = "!"; |
| 1249 |
| 1250 SkDebugf("%10.2f %s\t%s\t%s\n", |
| 1251 stats.median*1e3, mark, bench->getUniqueName(), config)
; |
| 1248 } else { | 1252 } else { |
| 1249 const double stddev_percent = 100 * sqrt(stats.var) / stats.mean
; | 1253 const double stddev_percent = 100 * sqrt(stats.var) / stats.mean
; |
| 1250 SkDebugf("%4d/%-4dMB\t%d\t%s\t%s\t%s\t%s\t%.0f%%\t%s\t%s\t%s\n" | 1254 SkDebugf("%4d/%-4dMB\t%d\t%s\t%s\t%s\t%s\t%.0f%%\t%s\t%s\t%s\n" |
| 1251 , sk_tools::getCurrResidentSetSizeMB() | 1255 , sk_tools::getCurrResidentSetSizeMB() |
| 1252 , sk_tools::getMaxResidentSetSizeMB() | 1256 , sk_tools::getMaxResidentSetSizeMB() |
| 1253 , loops | 1257 , loops |
| 1254 , HUMANIZE(stats.min) | 1258 , HUMANIZE(stats.min) |
| 1255 , HUMANIZE(stats.median) | 1259 , HUMANIZE(stats.median) |
| 1256 , HUMANIZE(stats.mean) | 1260 , HUMANIZE(stats.mean) |
| 1257 , HUMANIZE(stats.max) | 1261 , HUMANIZE(stats.max) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 | 1296 |
| 1293 return 0; | 1297 return 0; |
| 1294 } | 1298 } |
| 1295 | 1299 |
| 1296 #if !defined SK_BUILD_FOR_IOS | 1300 #if !defined SK_BUILD_FOR_IOS |
| 1297 int main(int argc, char** argv) { | 1301 int main(int argc, char** argv) { |
| 1298 SkCommandLineFlags::Parse(argc, argv); | 1302 SkCommandLineFlags::Parse(argc, argv); |
| 1299 return nanobench_main(); | 1303 return nanobench_main(); |
| 1300 } | 1304 } |
| 1301 #endif | 1305 #endif |
| OLD | NEW |