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 "apps/benchmark/run_args.h" | 5 #include "apps/benchmark/run_args.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (!CheckMeasurementFormat(parts[0], 5, parts.size())) | 46 if (!CheckMeasurementFormat(parts[0], 5, parts.size())) |
47 return false; | 47 return false; |
48 *result = Measurement(MeasurementType::TIME_BETWEEN, | 48 *result = Measurement(MeasurementType::TIME_BETWEEN, |
49 EventSpec(parts[2], parts[1]), | 49 EventSpec(parts[2], parts[1]), |
50 EventSpec(parts[4], parts[3])); | 50 EventSpec(parts[4], parts[3])); |
51 } else if (parts[0] == "avg_duration") { | 51 } else if (parts[0] == "avg_duration") { |
52 if (!CheckMeasurementFormat(parts[0], 3, parts.size())) | 52 if (!CheckMeasurementFormat(parts[0], 3, parts.size())) |
53 return false; | 53 return false; |
54 *result = Measurement(MeasurementType::AVG_DURATION, | 54 *result = Measurement(MeasurementType::AVG_DURATION, |
55 EventSpec(parts[2], parts[1])); | 55 EventSpec(parts[2], parts[1])); |
| 56 } else if (parts[0] == "percentile_duration") { |
| 57 if (!CheckMeasurementFormat(parts[0], 4, parts.size())) |
| 58 return false; |
| 59 *result = Measurement(MeasurementType::PERCENTILE_DURATION, |
| 60 EventSpec(parts[2], parts[1])); |
| 61 if (!base::StringToDouble(parts[3], &result->param)) { |
| 62 LOG(ERROR) << "Expected '" << parts[3] << "'' to be a number in: " |
| 63 << measurement_spec; |
| 64 return false; |
| 65 } |
| 66 if ((result->param < 0.0) || (result->param > 1.0)) { |
| 67 LOG(ERROR) << "Expected '" << result->param << "' to be >0.0 and <=1.0 " |
| 68 << "in " << measurement_spec; |
| 69 } |
56 } else { | 70 } else { |
57 LOG(ERROR) << "Could not recognize the measurement type: " << parts[0]; | 71 LOG(ERROR) << "Could not recognize the measurement type: " << parts[0]; |
58 return false; | 72 return false; |
59 } | 73 } |
60 | 74 |
61 result->spec = measurement_spec; | 75 result->spec = measurement_spec; |
62 return true; | 76 return true; |
63 } | 77 } |
64 | 78 |
65 } // namespace | 79 } // namespace |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (!GetMeasurement(measurement_spec, &measurement)) { | 118 if (!GetMeasurement(measurement_spec, &measurement)) { |
105 return false; | 119 return false; |
106 } | 120 } |
107 result->measurements.push_back(measurement); | 121 result->measurements.push_back(measurement); |
108 } | 122 } |
109 | 123 |
110 return true; | 124 return true; |
111 } | 125 } |
112 | 126 |
113 } // namespace benchmark | 127 } // namespace benchmark |
OLD | NEW |