| 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 12 matching lines...) Expand all Loading... |
| 23 << ", expected " << required_args << " while " << provided_args | 23 << ", expected " << required_args << " while " << provided_args |
| 24 << " were provided"; | 24 << " were provided"; |
| 25 return false; | 25 return false; |
| 26 } | 26 } |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool GetMeasurement(const std::string& measurement_spec, Measurement* result) { | 30 bool GetMeasurement(const std::string& measurement_spec, Measurement* result) { |
| 31 // Measurements are described in the format: | 31 // Measurements are described in the format: |
| 32 // <measurement type>/<event category>/<event name>. | 32 // <measurement type>/<event category>/<event name>. |
| 33 std::vector<std::string> parts; | 33 std::vector<std::string> parts = base::SplitString( |
| 34 base::SplitString(measurement_spec, '/', &parts); | 34 measurement_spec, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 35 if (parts.size() < 1) { | 35 if (parts.size() < 1) { |
| 36 LOG(ERROR) << "Could not parse the measurement description: " | 36 LOG(ERROR) << "Could not parse the measurement description: " |
| 37 << measurement_spec; | 37 << measurement_spec; |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 | 40 |
| 41 if (parts[0] == "time_until") { | 41 if (parts[0] == "time_until") { |
| 42 if (!CheckMeasurementFormat(parts[0], 3, parts.size())) | 42 if (!CheckMeasurementFormat(parts[0], 3, parts.size())) |
| 43 return false; | 43 return false; |
| 44 *result = | 44 *result = |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 if (!GetMeasurement(unquoted_measurement_spec, &measurement)) { | 121 if (!GetMeasurement(unquoted_measurement_spec, &measurement)) { |
| 122 return false; | 122 return false; |
| 123 } | 123 } |
| 124 result->measurements.push_back(measurement); | 124 result->measurements.push_back(measurement); |
| 125 } | 125 } |
| 126 | 126 |
| 127 return true; | 127 return true; |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace benchmark | 130 } // namespace benchmark |
| OLD | NEW |