andrew@webrtc.org | d064f58 | 2012-11-20 00:20:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 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 |
| 13 | // not been changed. |
| 14 | |
| 15 | #ifndef WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ |
| 16 | #define WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ |
| 17 | |
| 18 | #include <string> |
| 19 | |
| 20 | namespace webrtc { |
| 21 | namespace test { |
| 22 | |
| 23 | // Prints numerical information to stdout in a controlled format, for |
| 24 | // post-processing. |measurement| is a description of the quantity being |
| 25 | // 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 | // "_browser"; |trace| is a description of the particular data point, e.g. |
| 28 | // "reference"; |value| is the measured value; and |units| is a description |
| 29 | // of the units of measure, e.g. "bytes". If |important| is true, the output |
| 30 | // line will be specially marked, to notify the post-processor. The strings |
| 31 | // may be empty. They should not contain any colons (:) or equals signs (=). |
| 32 | // A typical post-processing step would be to produce graphs of the data |
| 33 | // produced for various builds, using the combined |measurement| + |modifier| |
| 34 | // string to specify a particular graph and the |trace| to identify a trace |
| 35 | // (i.e., data series) on that graph. |
| 36 | void PrintResult(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 | void AppendResult(std::string& output, |
| 44 | const std::string& measurement, |
| 45 | const std::string& modifier, |
| 46 | const std::string& trace, |
| 47 | size_t value, |
| 48 | const std::string& units, |
| 49 | bool important); |
| 50 | |
| 51 | // Like the above version of PrintResult(), but takes a std::string value |
| 52 | // instead of a size_t. |
| 53 | void PrintResult(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 | void AppendResult(std::string& output, |
| 61 | const std::string& measurement, |
| 62 | const std::string& modifier, |
| 63 | const std::string& trace, |
| 64 | const std::string& value, |
| 65 | const std::string& units, |
| 66 | bool important); |
| 67 | |
| 68 | // Like PrintResult(), but prints a (mean, standard deviation) result pair. |
| 69 | // The |<values>| should be two comma-separated numbers, the mean and |
| 70 | // standard deviation (or other error metric) of the measurement. |
| 71 | void PrintResultMeanAndError(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 | void AppendResultMeanAndError(std::string& output, |
| 79 | const std::string& measurement, |
| 80 | const std::string& modifier, |
| 81 | const std::string& trace, |
| 82 | const std::string& mean_and_error, |
| 83 | const std::string& units, |
| 84 | bool important); |
| 85 | |
| 86 | // Like PrintResult(), but prints an entire list of results. The |values| |
| 87 | // will generally be a list of comma-separated numbers. A typical |
| 88 | // post-processing step might produce plots of their mean and standard |
| 89 | // deviation. |
| 90 | void PrintResultList(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 | void AppendResultList(std::string& output, |
| 98 | const std::string& measurement, |
| 99 | const std::string& modifier, |
| 100 | const std::string& trace, |
| 101 | const std::string& values, |
| 102 | const std::string& units, |
| 103 | bool important); |
| 104 | |
| 105 | // Prints memory commit charge stats for use by perf graphs. |
| 106 | void PrintSystemCommitCharge(const std::string& test_name, |
| 107 | size_t charge, |
| 108 | bool important); |
| 109 | |
| 110 | void PrintSystemCommitCharge(FILE* target, |
| 111 | const std::string& test_name, |
| 112 | size_t charge, |
| 113 | bool important); |
| 114 | |
| 115 | std::string SystemCommitChargeToString(const std::string& test_name, |
| 116 | size_t charge, |
| 117 | bool important); |
| 118 | |
| 119 | } // namespace test |
| 120 | } // namespace webrtc |
| 121 | |
| 122 | #endif // WEBRTC_TEST_TESTSUPPORT_PERF_TEST_H_ |