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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return false; | 61 return false; |
62 } | 62 } |
63 int duration_int; | 63 int duration_int; |
64 if (!base::StringToInt(duration_str, &duration_int) || duration_int <= 0) { | 64 if (!base::StringToInt(duration_str, &duration_int) || duration_int <= 0) { |
65 LOG(ERROR) << "Could not parse the --duration value as a positive integer: " | 65 LOG(ERROR) << "Could not parse the --duration value as a positive integer: " |
66 << duration_str; | 66 << duration_str; |
67 return false; | 67 return false; |
68 } | 68 } |
69 result->duration = base::TimeDelta::FromSeconds(duration_int); | 69 result->duration = base::TimeDelta::FromSeconds(duration_int); |
70 | 70 |
| 71 result->write_output_file = false; |
| 72 if (command_line.HasSwitch("trace-output")) { |
| 73 result->write_output_file = true; |
| 74 result->output_file_path = |
| 75 base::FilePath(command_line.GetSwitchValueASCII("trace-output")); |
| 76 } |
| 77 |
71 // All regular arguments (not switches, ie. not preceded by "--") describe | 78 // All regular arguments (not switches, ie. not preceded by "--") describe |
72 // measurements. | 79 // measurements. |
73 for (const std::string& measurement_spec : command_line.GetArgs()) { | 80 for (const std::string& measurement_spec : command_line.GetArgs()) { |
74 Measurement measurement; | 81 Measurement measurement; |
75 if (!GetMeasurement(measurement_spec, &measurement)) { | 82 if (!GetMeasurement(measurement_spec, &measurement)) { |
76 return false; | 83 return false; |
77 } | 84 } |
78 result->measurements.push_back(measurement); | 85 result->measurements.push_back(measurement); |
79 } | 86 } |
80 | 87 |
81 return true; | 88 return true; |
82 } | 89 } |
83 | 90 |
84 } // namespace benchmark | 91 } // namespace benchmark |
OLD | NEW |