OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <memory> | 5 #include <memory> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/benchmark/event.h" | 10 #include "apps/benchmark/event.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 if (!GetEvents(trace_data, &events)) { | 109 if (!GetEvents(trace_data, &events)) { |
110 LOG(ERROR) << "Failed to parse the trace data"; | 110 LOG(ERROR) << "Failed to parse the trace data"; |
111 mojo::ApplicationImpl::Terminate(); | 111 mojo::ApplicationImpl::Terminate(); |
112 return; | 112 return; |
113 } | 113 } |
114 | 114 |
115 // Calculate and print the results. | 115 // Calculate and print the results. |
116 bool succeeded = true; | 116 bool succeeded = true; |
117 Measurements measurements(events, time_origin_); | 117 Measurements measurements(events, time_origin_); |
118 for (const Measurement& measurement : args_.measurements) { | 118 for (const Measurement& measurement : args_.measurements) { |
119 double result = measurements.Measure(measurement); | 119 std::vector<double> results; |
120 if (result >= 0.0) { | 120 measurements.Measure(measurement, &results); |
121 printf("measurement: %s %lf\n", measurement.spec.c_str(), result); | 121 printf("measurement: %s", measurement.spec.c_str()); |
122 } else { | 122 for (double result : results) { |
ppi
2015/10/08 22:29:47
As discussed offline, I think it would be good to
zra
2015/10/09 14:51:15
Done.
| |
123 succeeded = false; | 123 if (result >= 0.0) { |
124 printf("measurement: %s FAILED\n", measurement.spec.c_str()); | 124 printf(" %lf", result); |
125 } else { | |
126 succeeded = false; | |
127 printf(" FAILED"); | |
128 } | |
125 } | 129 } |
130 printf("\n"); | |
126 } | 131 } |
127 | 132 |
128 // Scripts that run benchmarks can pick this up as a signal that the run | 133 // Scripts that run benchmarks can pick this up as a signal that the run |
129 // succeeded, as shell exit code is 0 even if an app exits early due to an | 134 // succeeded, as shell exit code is 0 even if an app exits early due to an |
130 // error. | 135 // error. |
131 if (succeeded) { | 136 if (succeeded) { |
132 printf("benchmark succeeded\n"); | 137 printf("benchmark succeeded\n"); |
133 } else { | 138 } else { |
134 printf("some measurements failed\n"); | 139 printf("some measurements failed\n"); |
135 } | 140 } |
(...skipping 10 matching lines...) Expand all Loading... | |
146 }; | 151 }; |
147 } // namespace | 152 } // namespace |
148 } // namespace benchmark | 153 } // namespace benchmark |
149 | 154 |
150 MojoResult MojoMain(MojoHandle application_request) { | 155 MojoResult MojoMain(MojoHandle application_request) { |
151 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp); | 156 mojo::ApplicationRunnerChromium runner(new benchmark::BenchmarkApp); |
152 auto ret = runner.Run(application_request); | 157 auto ret = runner.Run(application_request); |
153 fflush(nullptr); | 158 fflush(nullptr); |
154 return ret; | 159 return ret; |
155 } | 160 } |
OLD | NEW |