| 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 a number between 0 and 1: " << parts[3] << " in " |
| 63 << measurement_spec; |
| 64 return false; |
| 65 } |
| 56 } else { | 66 } else { |
| 57 LOG(ERROR) << "Could not recognize the measurement type: " << parts[0]; | 67 LOG(ERROR) << "Could not recognize the measurement type: " << parts[0]; |
| 58 return false; | 68 return false; |
| 59 } | 69 } |
| 60 | 70 |
| 61 result->spec = measurement_spec; | 71 result->spec = measurement_spec; |
| 62 return true; | 72 return true; |
| 63 } | 73 } |
| 64 | 74 |
| 65 } // namespace | 75 } // namespace |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (!GetMeasurement(measurement_spec, &measurement)) { | 114 if (!GetMeasurement(measurement_spec, &measurement)) { |
| 105 return false; | 115 return false; |
| 106 } | 116 } |
| 107 result->measurements.push_back(measurement); | 117 result->measurements.push_back(measurement); |
| 108 } | 118 } |
| 109 | 119 |
| 110 return true; | 120 return true; |
| 111 } | 121 } |
| 112 | 122 |
| 113 } // namespace benchmark | 123 } // namespace benchmark |
| OLD | NEW |