OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // A stripped-down version of Chromium's chrome/test/perf/perf_test.h. | 11 // A stripped-down version of Chromium's chrome/test/perf/perf_test.h. |
12 // Several functions have been removed; the prototypes of the remainder have | 12 // Several functions have been removed; the prototypes of the remainder have |
13 // not been changed. | 13 // not been changed. |
14 | 14 |
15 #ifndef WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ | 15 #ifndef WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ |
16 #define WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ | 16 #define WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ |
17 | 17 |
| 18 #include <sstream> |
18 #include <string> | 19 #include <string> |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 namespace test { | 22 namespace test { |
22 | 23 |
23 // Prints numerical information to stdout in a controlled format, for | 24 // Prints numerical information to stdout in a controlled format, for |
24 // post-processing. |measurement| is a description of the quantity being | 25 // post-processing. |measurement| is a description of the quantity being |
25 // measured, e.g. "vm_peak"; |modifier| is provided as a convenience and | 26 // measured, e.g. "vm_peak"; |modifier| is provided as a convenience and |
26 // will be appended directly to the name of the |measurement|, e.g. | 27 // will be appended directly to the name of the |measurement|, e.g. |
27 // "_browser"; |trace| is a description of the particular data point, e.g. | 28 // "_browser"; |trace| is a description of the particular data point, e.g. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 void PrintSystemCommitCharge(FILE* target, | 111 void PrintSystemCommitCharge(FILE* target, |
111 const std::string& test_name, | 112 const std::string& test_name, |
112 size_t charge, | 113 size_t charge, |
113 bool important); | 114 bool important); |
114 | 115 |
115 std::string SystemCommitChargeToString(const std::string& test_name, | 116 std::string SystemCommitChargeToString(const std::string& test_name, |
116 size_t charge, | 117 size_t charge, |
117 bool important); | 118 bool important); |
118 | 119 |
| 120 // Converts list of values into comma-separated string for PrintResultList. |
| 121 template <typename Container> |
| 122 std::string ValuesToString(const Container& container) { |
| 123 if (container.empty()) |
| 124 return ""; |
| 125 |
| 126 std::stringstream ss; |
| 127 auto it = container.begin(); |
| 128 while (true) { |
| 129 ss << *it; |
| 130 if (++it == container.end()) |
| 131 break; |
| 132 ss << ','; |
| 133 } |
| 134 return ss.str(); |
| 135 } |
| 136 |
119 } // namespace test | 137 } // namespace test |
120 } // namespace webrtc | 138 } // namespace webrtc |
121 | 139 |
122 #endif // WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ | 140 #endif // WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ |
OLD | NEW |