diff options
author | Evan Martin <martine@danga.com> | 2011-05-25 17:54:11 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-05-27 02:32:17 (GMT) |
commit | 976166706db05dcd4496586ae995b7fdb1afab35 (patch) | |
tree | 26f02bc5c1545420ed791ae9a6ecebe735e2de96 | |
parent | 2bdf6b976b46bb74ae23ed585f2dee265f1411f6 (diff) | |
download | Ninja-976166706db05dcd4496586ae995b7fdb1afab35.zip Ninja-976166706db05dcd4496586ae995b7fdb1afab35.tar.gz Ninja-976166706db05dcd4496586ae995b7fdb1afab35.tar.bz2 |
perftest: print summary info at end
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | src/parser_perftest.cc | 21 |
2 files changed, 21 insertions, 1 deletions
@@ -4,6 +4,7 @@ TAGS /build.ninja /ninja /ninja_test +/parser_perftest /graph.png /doc/manual.html /doc/doxygen diff --git a/src/parser_perftest.cc b/src/parser_perftest.cc index 1321629..7a5fd82 100644 --- a/src/parser_perftest.cc +++ b/src/parser_perftest.cc @@ -24,6 +24,7 @@ int main(int argc, char* argv[]) { return 1; } + vector<float> times; for (int i = 1; i < argc; ++i) { const char* filename = argv[i]; @@ -47,11 +48,29 @@ int main(int argc, char* argv[]) { if (end - start > 100) { int delta = (int)(end - start); - printf("%s: %.2fus\n", filename, (float)(delta*1000 / (float)limit)); + float time = delta*1000 / (float)limit; + printf("%s: %.1fus\n", filename, time); + times.push_back(time); break; } } } + if (!times.empty()) { + float min = times[0]; + float max = times[0]; + float total = 0; + for (size_t i = 0; i < times.size(); ++i) { + total += times[i]; + if (times[i] < min) + min = times[i]; + else if (times[i] > max) + max = times[i]; + } + + printf("min %.1fus max %.1fus avg %.1fus\n", + min, max, total / times.size()); + } + return 0; } |