diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /gfx/angle/src/tests/perf_tests/third_party | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/angle/src/tests/perf_tests/third_party')
3 files changed, 416 insertions, 0 deletions
diff --git a/gfx/angle/src/tests/perf_tests/third_party/perf/angle-mods.patch b/gfx/angle/src/tests/perf_tests/third_party/perf/angle-mods.patch new file mode 100755 index 000000000..d0b640289 --- /dev/null +++ b/gfx/angle/src/tests/perf_tests/third_party/perf/angle-mods.patch @@ -0,0 +1,61 @@ +diff --git a/tests/perf_tests/third_party/perf/perf_test.cc b/tests/perf_tests/third_party/perf/perf_test.cc +index 0d5abc0..7364330 100644 +--- a/tests/perf_tests/third_party/perf/perf_test.cc ++++ b/tests/perf_tests/third_party/perf/perf_test.cc +@@ -2,16 +2,51 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + +-#include "testing/perf/perf_test.h" ++#include "perf_test.h" + + #include <stdio.h> +- +-#include "base/logging.h" +-#include "base/strings/string_number_conversions.h" +-#include "base/strings/stringprintf.h" ++#include <stdarg.h> ++#include <vector> + + namespace { + ++namespace base { ++ ++std::string FormatString(const char *fmt, va_list vararg) { ++ static std::vector<char> buffer(512); ++ ++ // Attempt to just print to the current buffer ++ int len = vsnprintf(&buffer[0], buffer.size(), fmt, vararg); ++ if (len < 0 || static_cast<size_t>(len) >= buffer.size()) { ++ // Buffer was not large enough, calculate the required size and resize the buffer ++ len = vsnprintf(NULL, 0, fmt, vararg); ++ buffer.resize(len + 1); ++ ++ // Print again ++ vsnprintf(&buffer[0], buffer.size(), fmt, vararg); ++ } ++ ++ return std::string(buffer.data(), len); ++} ++ ++std::string StringPrintf(const char *fmt, ...) { ++ va_list vararg; ++ va_start(vararg, fmt); ++ std::string result = FormatString(fmt, vararg); ++ va_end(vararg); ++ return result; ++} ++ ++std::string UintToString(unsigned int value) { ++ return StringPrintf("%u", value); ++} ++ ++std::string DoubleToString(double value) { ++ return StringPrintf("%.10lf", value); ++} ++ ++} ++ + std::string ResultsToString(const std::string& measurement, + const std::string& modifier, + const std::string& trace, diff --git a/gfx/angle/src/tests/perf_tests/third_party/perf/perf_test.cc b/gfx/angle/src/tests/perf_tests/third_party/perf/perf_test.cc new file mode 100755 index 000000000..73643306c --- /dev/null +++ b/gfx/angle/src/tests/perf_tests/third_party/perf/perf_test.cc @@ -0,0 +1,239 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "perf_test.h" + +#include <stdio.h> +#include <stdarg.h> +#include <vector> + +namespace { + +namespace base { + +std::string FormatString(const char *fmt, va_list vararg) { + static std::vector<char> buffer(512); + + // Attempt to just print to the current buffer + int len = vsnprintf(&buffer[0], buffer.size(), fmt, vararg); + if (len < 0 || static_cast<size_t>(len) >= buffer.size()) { + // Buffer was not large enough, calculate the required size and resize the buffer + len = vsnprintf(NULL, 0, fmt, vararg); + buffer.resize(len + 1); + + // Print again + vsnprintf(&buffer[0], buffer.size(), fmt, vararg); + } + + return std::string(buffer.data(), len); +} + +std::string StringPrintf(const char *fmt, ...) { + va_list vararg; + va_start(vararg, fmt); + std::string result = FormatString(fmt, vararg); + va_end(vararg); + return result; +} + +std::string UintToString(unsigned int value) { + return StringPrintf("%u", value); +} + +std::string DoubleToString(double value) { + return StringPrintf("%.10lf", value); +} + +} + +std::string ResultsToString(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& values, + const std::string& prefix, + const std::string& suffix, + const std::string& units, + bool important) { + // <*>RESULT <graph_name>: <trace_name>= <value> <units> + // <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} <units> + // <*>RESULT <graph_name>: <trace_name>= [<value>,value,value,...,] <units> + return base::StringPrintf("%sRESULT %s%s: %s= %s%s%s %s\n", + important ? "*" : "", measurement.c_str(), modifier.c_str(), + trace.c_str(), prefix.c_str(), values.c_str(), suffix.c_str(), + units.c_str()); +} + +void PrintResultsImpl(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& values, + const std::string& prefix, + const std::string& suffix, + const std::string& units, + bool important) { + fflush(stdout); + printf("%s", ResultsToString(measurement, modifier, trace, values, + prefix, suffix, units, important).c_str()); + fflush(stdout); +} + +} // namespace + +namespace perf_test { + +void PrintResult(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + size_t value, + const std::string& units, + bool important) { + PrintResultsImpl(measurement, + modifier, + trace, + base::UintToString(static_cast<unsigned int>(value)), + std::string(), + std::string(), + units, + important); +} + +void PrintResult(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + double value, + const std::string& units, + bool important) { + PrintResultsImpl(measurement, + modifier, + trace, + base::DoubleToString(value), + std::string(), + std::string(), + units, + important); +} + +void AppendResult(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + size_t value, + const std::string& units, + bool important) { + output += ResultsToString( + measurement, + modifier, + trace, + base::UintToString(static_cast<unsigned int>(value)), + std::string(), + std::string(), + units, + important); +} + +void PrintResult(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& value, + const std::string& units, + bool important) { + PrintResultsImpl(measurement, + modifier, + trace, + value, + std::string(), + std::string(), + units, + important); +} + +void AppendResult(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& value, + const std::string& units, + bool important) { + output += ResultsToString(measurement, + modifier, + trace, + value, + std::string(), + std::string(), + units, + important); +} + +void PrintResultMeanAndError(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& mean_and_error, + const std::string& units, + bool important) { + PrintResultsImpl(measurement, modifier, trace, mean_and_error, + "{", "}", units, important); +} + +void AppendResultMeanAndError(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& mean_and_error, + const std::string& units, + bool important) { + output += ResultsToString(measurement, modifier, trace, mean_and_error, + "{", "}", units, important); +} + +void PrintResultList(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& values, + const std::string& units, + bool important) { + PrintResultsImpl(measurement, modifier, trace, values, + "[", "]", units, important); +} + +void AppendResultList(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& values, + const std::string& units, + bool important) { + output += ResultsToString(measurement, modifier, trace, values, + "[", "]", units, important); +} + +void PrintSystemCommitCharge(const std::string& test_name, + size_t charge, + bool important) { + PrintSystemCommitCharge(stdout, test_name, charge, important); +} + +void PrintSystemCommitCharge(FILE* target, + const std::string& test_name, + size_t charge, + bool important) { + fprintf(target, "%s", SystemCommitChargeToString(test_name, charge, + important).c_str()); +} + +std::string SystemCommitChargeToString(const std::string& test_name, + size_t charge, + bool important) { + std::string trace_name(test_name); + std::string output; + AppendResult(output, + "commit_charge", + std::string(), + "cc" + trace_name, + charge, + "kb", + important); + return output; +} + +} // namespace perf_test diff --git a/gfx/angle/src/tests/perf_tests/third_party/perf/perf_test.h b/gfx/angle/src/tests/perf_tests/third_party/perf/perf_test.h new file mode 100755 index 000000000..36e2916c5 --- /dev/null +++ b/gfx/angle/src/tests/perf_tests/third_party/perf/perf_test.h @@ -0,0 +1,116 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef TESTING_PERF_PERF_TEST_H_ +#define TESTING_PERF_PERF_TEST_H_ + +#include <string> + +namespace perf_test { + +// Prints numerical information to stdout in a controlled format, for +// post-processing. |measurement| is a description of the quantity being +// measured, e.g. "vm_peak"; |modifier| is provided as a convenience and +// will be appended directly to the name of the |measurement|, e.g. +// "_browser"; |trace| is a description of the particular data point, e.g. +// "reference"; |value| is the measured value; and |units| is a description +// of the units of measure, e.g. "bytes". If |important| is true, the output +// line will be specially marked, to notify the post-processor. The strings +// may be empty. They should not contain any colons (:) or equals signs (=). +// A typical post-processing step would be to produce graphs of the data +// produced for various builds, using the combined |measurement| + |modifier| +// string to specify a particular graph and the |trace| to identify a trace +// (i.e., data series) on that graph. +void PrintResult(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + size_t value, + const std::string& units, + bool important); +void PrintResult(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + double value, + const std::string& units, + bool important); + +void AppendResult(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + size_t value, + const std::string& units, + bool important); + +// Like the above version of PrintResult(), but takes a std::string value +// instead of a size_t. +void PrintResult(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& value, + const std::string& units, + bool important); + +void AppendResult(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& value, + const std::string& units, + bool important); + +// Like PrintResult(), but prints a (mean, standard deviation) result pair. +// The |<values>| should be two comma-separated numbers, the mean and +// standard deviation (or other error metric) of the measurement. +void PrintResultMeanAndError(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& mean_and_error, + const std::string& units, + bool important); + +void AppendResultMeanAndError(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& mean_and_error, + const std::string& units, + bool important); + +// Like PrintResult(), but prints an entire list of results. The |values| +// will generally be a list of comma-separated numbers. A typical +// post-processing step might produce plots of their mean and standard +// deviation. +void PrintResultList(const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& values, + const std::string& units, + bool important); + +void AppendResultList(std::string& output, + const std::string& measurement, + const std::string& modifier, + const std::string& trace, + const std::string& values, + const std::string& units, + bool important); + +// Prints memory commit charge stats for use by perf graphs. +void PrintSystemCommitCharge(const std::string& test_name, + size_t charge, + bool important); + +void PrintSystemCommitCharge(FILE* target, + const std::string& test_name, + size_t charge, + bool important); + +std::string SystemCommitChargeToString(const std::string& test_name, + size_t charge, + bool important); + +} // namespace perf_test + +#endif // TESTING_PERF_PERF_TEST_H_ |