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

Side by Side Diff: bench/nanobench.cpp

Issue 1208763003: Don't suppress nanobench output table in verbose mode (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_timesamples
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 unified diff | Download patch
« no previous file with comments | « no previous file | bin/compare » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 log->key(FLAGS_key[i-1], FLAGS_key[i]); 998 log->key(FLAGS_key[i-1], FLAGS_key[i]);
999 } 999 }
1000 1000
1001 const double overhead = estimate_timer_overhead(); 1001 const double overhead = estimate_timer_overhead();
1002 SkDebugf("Timer overhead: %s\n", HUMANIZE(overhead)); 1002 SkDebugf("Timer overhead: %s\n", HUMANIZE(overhead));
1003 1003
1004 SkTArray<double> samples; 1004 SkTArray<double> samples;
1005 1005
1006 if (kAutoTuneLoops != FLAGS_loops) { 1006 if (kAutoTuneLoops != FLAGS_loops) {
1007 SkDebugf("Fixed number of loops; times would only be misleading so we wo n't print them.\n"); 1007 SkDebugf("Fixed number of loops; times would only be misleading so we wo n't print them.\n");
1008 } else if (FLAGS_verbose) {
1009 // No header.
1010 } else if (FLAGS_quiet) { 1008 } else if (FLAGS_quiet) {
1011 SkDebugf("median\tbench\tconfig\n"); 1009 SkDebugf("median\tbench\tconfig\n");
1012 } else if (kTimedSampling == FLAGS_samples) { 1010 } else if (kTimedSampling == FLAGS_samples) {
1013 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\tsamples\tc onfig\tbench\n"); 1011 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\tsamples\tc onfig\tbench\n");
1014 } else { 1012 } else {
1015 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\t%-*s\tconf ig\tbench\n", 1013 SkDebugf("curr/maxrss\tloops\tmin\tmedian\tmean\tmax\tstddev\t%-*s\tconf ig\tbench\n",
1016 FLAGS_samples, "samples"); 1014 FLAGS_samples, "samples");
1017 } 1015 }
1018 1016
1019 SkTDArray<Config> configs; 1017 SkTDArray<Config> configs;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 1094
1097 if (kAutoTuneLoops != FLAGS_loops) { 1095 if (kAutoTuneLoops != FLAGS_loops) {
1098 if (configs.count() == 1) { 1096 if (configs.count() == 1) {
1099 config = ""; // Only print the config if we run the same ben ch on more than one. 1097 config = ""; // Only print the config if we run the same ben ch on more than one.
1100 } 1098 }
1101 SkDebugf("%4d/%-4dMB\t%s\t%s\n" 1099 SkDebugf("%4d/%-4dMB\t%s\t%s\n"
1102 , sk_tools::getCurrResidentSetSizeMB() 1100 , sk_tools::getCurrResidentSetSizeMB()
1103 , sk_tools::getMaxResidentSetSizeMB() 1101 , sk_tools::getMaxResidentSetSizeMB()
1104 , bench->getUniqueName() 1102 , bench->getUniqueName()
1105 , config); 1103 , config);
1106 } else if (FLAGS_verbose) {
1107 for (int i = 0; i < samples.count(); i++) {
1108 SkDebugf("%s ", HUMANIZE(samples[i]));
1109 }
1110 SkDebugf("%s\n", bench->getUniqueName());
1111 } else if (FLAGS_quiet) { 1104 } else if (FLAGS_quiet) {
1112 if (configs.count() == 1) { 1105 if (configs.count() == 1) {
1113 config = ""; // Only print the config if we run the same ben ch on more than one. 1106 config = ""; // Only print the config if we run the same ben ch on more than one.
1114 } 1107 }
1115 SkDebugf("%s\t%s\t%s\n", HUMANIZE(stats.median), bench->getUniqu eName(), config); 1108 SkDebugf("%s\t%s\t%s\n", HUMANIZE(stats.median), bench->getUniqu eName(), config);
1116 } else { 1109 } else {
1117 const double stddev_percent = 100 * sqrt(stats.var) / stats.mean ; 1110 const double stddev_percent = 100 * sqrt(stats.var) / stats.mean ;
1118 SkDebugf("%4d/%-4dMB\t%d\t%s\t%s\t%s\t%s\t%.0f%%\t%s\t%s\t%s\n" 1111 SkDebugf("%4d/%-4dMB\t%d\t%s\t%s\t%s\t%s\t%.0f%%\t%s\t%s\t%s\n"
1119 , sk_tools::getCurrResidentSetSizeMB() 1112 , sk_tools::getCurrResidentSetSizeMB()
1120 , sk_tools::getMaxResidentSetSizeMB() 1113 , sk_tools::getMaxResidentSetSizeMB()
1121 , loops 1114 , loops
1122 , HUMANIZE(stats.min) 1115 , HUMANIZE(stats.min)
1123 , HUMANIZE(stats.median) 1116 , HUMANIZE(stats.median)
1124 , HUMANIZE(stats.mean) 1117 , HUMANIZE(stats.mean)
1125 , HUMANIZE(stats.max) 1118 , HUMANIZE(stats.max)
1126 , stddev_percent 1119 , stddev_percent
1127 , kTimedSampling != FLAGS_samples ? stats.plot.c_str() 1120 , kTimedSampling != FLAGS_samples ? stats.plot.c_str()
1128 : to_string(samples.co unt()).c_str() 1121 : to_string(samples.co unt()).c_str()
1129 , config 1122 , config
1130 , bench->getUniqueName() 1123 , bench->getUniqueName()
1131 ); 1124 );
1132 } 1125 }
1133 #if SK_SUPPORT_GPU 1126 #if SK_SUPPORT_GPU
1134 if (FLAGS_gpuStats && 1127 if (FLAGS_gpuStats &&
1135 Benchmark::kGPU_Backend == configs[i].backend) { 1128 Benchmark::kGPU_Backend == configs[i].backend) {
1136 gGrFactory->get(configs[i].ctxType)->printCacheStats(); 1129 gGrFactory->get(configs[i].ctxType)->printCacheStats();
1137 gGrFactory->get(configs[i].ctxType)->printGpuStats(); 1130 gGrFactory->get(configs[i].ctxType)->printGpuStats();
1138 } 1131 }
1139 #endif 1132 #endif
1133 if (FLAGS_verbose) {
1134 SkDebugf("Samples: ");
1135 for (int i = 0; i < samples.count(); i++) {
1136 SkDebugf("%s ", HUMANIZE(samples[i]));
1137 }
1138 SkDebugf("%s\n", bench->getUniqueName());
1139 }
1140 cleanup_run(target); 1140 cleanup_run(target);
1141 } 1141 }
1142 } 1142 }
1143 1143
1144 log->bench("memory_usage", 0,0); 1144 log->bench("memory_usage", 0,0);
1145 log->config("meta"); 1145 log->config("meta");
1146 log->metric("max_rss_mb", sk_tools::getMaxResidentSetSizeMB()); 1146 log->metric("max_rss_mb", sk_tools::getMaxResidentSetSizeMB());
1147 1147
1148 #if SK_SUPPORT_GPU 1148 #if SK_SUPPORT_GPU
1149 // Make sure we clean up the global GrContextFactory here, otherwise we migh t race with the 1149 // Make sure we clean up the global GrContextFactory here, otherwise we migh t race with the
1150 // SkEventTracer destructor 1150 // SkEventTracer destructor
1151 gGrFactory.reset(NULL); 1151 gGrFactory.reset(NULL);
1152 #endif 1152 #endif
1153 1153
1154 return 0; 1154 return 0;
1155 } 1155 }
1156 1156
1157 #if !defined SK_BUILD_FOR_IOS 1157 #if !defined SK_BUILD_FOR_IOS
1158 int main(int argc, char** argv) { 1158 int main(int argc, char** argv) {
1159 SkCommandLineFlags::Parse(argc, argv); 1159 SkCommandLineFlags::Parse(argc, argv);
1160 return nanobench_main(); 1160 return nanobench_main();
1161 } 1161 }
1162 #endif 1162 #endif
OLDNEW
« no previous file with comments | « no previous file | bin/compare » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698