| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return false; | 97 return false; |
| 98 } | 98 } |
| 99 int duration_int; | 99 int duration_int; |
| 100 if (!base::StringToInt(duration_str, &duration_int) || duration_int <= 0) { | 100 if (!base::StringToInt(duration_str, &duration_int) || duration_int <= 0) { |
| 101 LOG(ERROR) << "Could not parse the --duration value as a positive integer: " | 101 LOG(ERROR) << "Could not parse the --duration value as a positive integer: " |
| 102 << duration_str; | 102 << duration_str; |
| 103 return false; | 103 return false; |
| 104 } | 104 } |
| 105 result->duration = base::TimeDelta::FromSeconds(duration_int); | 105 result->duration = base::TimeDelta::FromSeconds(duration_int); |
| 106 | 106 |
| 107 result->trace_all_categories = command_line.HasSwitch("trace-all"); |
| 108 |
| 107 result->write_output_file = false; | 109 result->write_output_file = false; |
| 108 if (command_line.HasSwitch("trace-output")) { | 110 if (command_line.HasSwitch("trace-output")) { |
| 109 result->write_output_file = true; | 111 result->write_output_file = true; |
| 110 result->output_file_path = | 112 result->output_file_path = |
| 111 base::FilePath(command_line.GetSwitchValueASCII("trace-output")); | 113 base::FilePath(command_line.GetSwitchValueASCII("trace-output")); |
| 112 } | 114 } |
| 113 | 115 |
| 114 // All regular arguments (not switches, ie. not preceded by "--") describe | 116 // All regular arguments (not switches, ie. not preceded by "--") describe |
| 115 // measurements. | 117 // measurements. |
| 116 for (const std::string& measurement_spec : command_line.GetArgs()) { | 118 for (const std::string& measurement_spec : command_line.GetArgs()) { |
| 117 Measurement measurement; | 119 Measurement measurement; |
| 118 if (!GetMeasurement(measurement_spec, &measurement)) { | 120 if (!GetMeasurement(measurement_spec, &measurement)) { |
| 119 return false; | 121 return false; |
| 120 } | 122 } |
| 121 result->measurements.push_back(measurement); | 123 result->measurements.push_back(measurement); |
| 122 } | 124 } |
| 123 | 125 |
| 124 return true; | 126 return true; |
| 125 } | 127 } |
| 126 | 128 |
| 127 } // namespace benchmark | 129 } // namespace benchmark |
| OLD | NEW |