| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_TEST_PERF_PERF_TEST_H_ | 5 #ifndef CHROME_TEST_PERF_PERF_TEST_H_ |
| 6 #define CHROME_TEST_PERF_PERF_TEST_H_ | 6 #define CHROME_TEST_PERF_PERF_TEST_H_ |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/test/base/chrome_process_util.h" | 11 #include "chrome/test/base/chrome_process_util.h" |
| 12 | 12 |
| 13 namespace perf_test { | 13 namespace perf_test { |
| 14 | 14 |
| 15 // Prints numerical information to stdout in a controlled format, for | |
| 16 // post-processing. |measurement| is a description of the quantity being | |
| 17 // measured, e.g. "vm_peak"; |modifier| is provided as a convenience and | |
| 18 // will be appended directly to the name of the |measurement|, e.g. | |
| 19 // "_browser"; |trace| is a description of the particular data point, e.g. | |
| 20 // "reference"; |value| is the measured value; and |units| is a description | |
| 21 // of the units of measure, e.g. "bytes". If |important| is true, the output | |
| 22 // line will be specially marked, to notify the post-processor. The strings | |
| 23 // may be empty. They should not contain any colons (:) or equals signs (=). | |
| 24 // A typical post-processing step would be to produce graphs of the data | |
| 25 // produced for various builds, using the combined |measurement| + |modifier| | |
| 26 // string to specify a particular graph and the |trace| to identify a trace | |
| 27 // (i.e., data series) on that graph. | |
| 28 void PrintResult(const std::string& measurement, | |
| 29 const std::string& modifier, | |
| 30 const std::string& trace, | |
| 31 size_t value, | |
| 32 const std::string& units, | |
| 33 bool important); | |
| 34 | |
| 35 void AppendResult(std::string& output, | |
| 36 const std::string& measurement, | |
| 37 const std::string& modifier, | |
| 38 const std::string& trace, | |
| 39 size_t value, | |
| 40 const std::string& units, | |
| 41 bool important); | |
| 42 | |
| 43 // Like the above version of PrintResult(), but takes a std::string value | |
| 44 // instead of a size_t. | |
| 45 void PrintResult(const std::string& measurement, | |
| 46 const std::string& modifier, | |
| 47 const std::string& trace, | |
| 48 const std::string& value, | |
| 49 const std::string& units, | |
| 50 bool important); | |
| 51 | |
| 52 void AppendResult(std::string& output, | |
| 53 const std::string& measurement, | |
| 54 const std::string& modifier, | |
| 55 const std::string& trace, | |
| 56 const std::string& value, | |
| 57 const std::string& units, | |
| 58 bool important); | |
| 59 | |
| 60 // Like PrintResult(), but prints a (mean, standard deviation) result pair. | |
| 61 // The |<values>| should be two comma-separated numbers, the mean and | |
| 62 // standard deviation (or other error metric) of the measurement. | |
| 63 void PrintResultMeanAndError(const std::string& measurement, | |
| 64 const std::string& modifier, | |
| 65 const std::string& trace, | |
| 66 const std::string& mean_and_error, | |
| 67 const std::string& units, | |
| 68 bool important); | |
| 69 | |
| 70 void AppendResultMeanAndError(std::string& output, | |
| 71 const std::string& measurement, | |
| 72 const std::string& modifier, | |
| 73 const std::string& trace, | |
| 74 const std::string& mean_and_error, | |
| 75 const std::string& units, | |
| 76 bool important); | |
| 77 | |
| 78 // Like PrintResult(), but prints an entire list of results. The |values| | |
| 79 // will generally be a list of comma-separated numbers. A typical | |
| 80 // post-processing step might produce plots of their mean and standard | |
| 81 // deviation. | |
| 82 void PrintResultList(const std::string& measurement, | |
| 83 const std::string& modifier, | |
| 84 const std::string& trace, | |
| 85 const std::string& values, | |
| 86 const std::string& units, | |
| 87 bool important); | |
| 88 | |
| 89 void AppendResultList(std::string& output, | |
| 90 const std::string& measurement, | |
| 91 const std::string& modifier, | |
| 92 const std::string& trace, | |
| 93 const std::string& values, | |
| 94 const std::string& units, | |
| 95 bool important); | |
| 96 | |
| 97 // Prints IO performance data for use by perf graphs. | 15 // Prints IO performance data for use by perf graphs. |
| 98 void PrintIOPerfInfo(const std::string& test_name, | 16 void PrintIOPerfInfo(const std::string& test_name, |
| 99 const ChromeProcessList& chrome_processes, | 17 const ChromeProcessList& chrome_processes, |
| 100 base::ProcessId browser_pid); | 18 base::ProcessId browser_pid); |
| 101 | 19 |
| 102 void PrintIOPerfInfo(FILE* target, | 20 void PrintIOPerfInfo(FILE* target, |
| 103 const std::string& test_name, | 21 const std::string& test_name, |
| 104 const ChromeProcessList& chrome_processes, | 22 const ChromeProcessList& chrome_processes, |
| 105 base::ProcessId browser_pid); | 23 base::ProcessId browser_pid); |
| 106 | 24 |
| 107 std::string IOPerfInfoToString(const std::string& test_name, | 25 std::string IOPerfInfoToString(const std::string& test_name, |
| 108 const ChromeProcessList& chrome_processes, | 26 const ChromeProcessList& chrome_processes, |
| 109 base::ProcessId browser_pid); | 27 base::ProcessId browser_pid); |
| 110 | 28 |
| 111 // Prints memory usage data for use by perf graphs. | 29 // Prints memory usage data for use by perf graphs. |
| 112 void PrintMemoryUsageInfo(const std::string& test_name, | 30 void PrintMemoryUsageInfo(const std::string& test_name, |
| 113 const ChromeProcessList& chrome_processes, | 31 const ChromeProcessList& chrome_processes, |
| 114 base::ProcessId browser_pid); | 32 base::ProcessId browser_pid); |
| 115 | 33 |
| 116 void PrintMemoryUsageInfo(FILE* target, | 34 void PrintMemoryUsageInfo(FILE* target, |
| 117 const std::string& test_name, | 35 const std::string& test_name, |
| 118 const ChromeProcessList& chrome_processes, | 36 const ChromeProcessList& chrome_processes, |
| 119 base::ProcessId browser_pid); | 37 base::ProcessId browser_pid); |
| 120 | 38 |
| 121 std::string MemoryUsageInfoToString(const std::string& test_name, | 39 std::string MemoryUsageInfoToString(const std::string& test_name, |
| 122 const ChromeProcessList& chrome_processes, | 40 const ChromeProcessList& chrome_processes, |
| 123 base::ProcessId browser_pid); | 41 base::ProcessId browser_pid); |
| 124 | 42 |
| 125 // Prints memory commit charge stats for use by perf graphs. | |
| 126 void PrintSystemCommitCharge(const std::string& test_name, | |
| 127 size_t charge, | |
| 128 bool important); | |
| 129 | |
| 130 void PrintSystemCommitCharge(FILE* target, | |
| 131 const std::string& test_name, | |
| 132 size_t charge, | |
| 133 bool important); | |
| 134 | |
| 135 std::string SystemCommitChargeToString(const std::string& test_name, | |
| 136 size_t charge, | |
| 137 bool important); | |
| 138 | |
| 139 } // namespace perf_test | 43 } // namespace perf_test |
| 140 | 44 |
| 141 #endif // CHROME_TEST_PERF_PERF_TEST_H_ | 45 #endif // CHROME_TEST_PERF_PERF_TEST_H_ |
| OLD | NEW |