diff options
author | Torne (Richard Coles) <torne@google.com> | 2013-09-12 12:10:22 +0100 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2013-09-12 12:10:22 +0100 |
commit | 58537e28ecd584eab876aee8be7156509866d23a (patch) | |
tree | 8988984e52090aaadf33cff139d7dd212cd13656 /testing | |
parent | 0a1b11dee8e5cb2520121c300858fea6138e3c54 (diff) | |
download | chromium_org-58537e28ecd584eab876aee8be7156509866d23a.tar.gz |
Merge from Chromium at DEPS revision 222756
This commit was generated by merge_to_master.py.
Change-Id: I40d7f32f195f328f005f230ea80d07092d48040e
Diffstat (limited to 'testing')
-rw-r--r-- | testing/android/native_test_util.cc | 2 | ||||
-rw-r--r-- | testing/gtest_prod.target.darwin-arm.mk | 4 | ||||
-rw-r--r-- | testing/gtest_prod.target.darwin-mips.mk | 4 | ||||
-rw-r--r-- | testing/gtest_prod.target.darwin-x86.mk | 4 | ||||
-rw-r--r-- | testing/gtest_prod.target.linux-arm.mk | 4 | ||||
-rw-r--r-- | testing/gtest_prod.target.linux-mips.mk | 4 | ||||
-rw-r--r-- | testing/gtest_prod.target.linux-x86.mk | 4 | ||||
-rw-r--r-- | testing/perf/perf_test.cc | 188 | ||||
-rw-r--r-- | testing/perf/perf_test.gyp | 18 | ||||
-rw-r--r-- | testing/perf/perf_test.h | 110 |
10 files changed, 341 insertions, 1 deletions
diff --git a/testing/android/native_test_util.cc b/testing/android/native_test_util.cc index c0ea7b0fef..ff2c47ebf7 100644 --- a/testing/android/native_test_util.cc +++ b/testing/android/native_test_util.cc @@ -31,7 +31,7 @@ void ParseArgsFromCommandLineFile( const char* path, std::vector<std::string>* args) { base::FilePath command_line(path); std::string command_line_string; - if (file_util::ReadFileToString(command_line, &command_line_string)) { + if (base::ReadFileToString(command_line, &command_line_string)) { ParseArgsFromString(command_line_string, args); } } diff --git a/testing/gtest_prod.target.darwin-arm.mk b/testing/gtest_prod.target.darwin-arm.mk index 75b5865cf0..03a41f4977 100644 --- a/testing/gtest_prod.target.darwin-arm.mk +++ b/testing/gtest_prod.target.darwin-arm.mk @@ -63,6 +63,7 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -75,6 +76,7 @@ MY_DEFS_Debug := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ @@ -143,6 +145,7 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,6 +158,7 @@ MY_DEFS_Release := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ diff --git a/testing/gtest_prod.target.darwin-mips.mk b/testing/gtest_prod.target.darwin-mips.mk index 0b0c2af75d..75da259e50 100644 --- a/testing/gtest_prod.target.darwin-mips.mk +++ b/testing/gtest_prod.target.darwin-mips.mk @@ -63,6 +63,7 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -75,6 +76,7 @@ MY_DEFS_Debug := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ @@ -143,6 +145,7 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,6 +158,7 @@ MY_DEFS_Release := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ diff --git a/testing/gtest_prod.target.darwin-x86.mk b/testing/gtest_prod.target.darwin-x86.mk index f290eff23d..7a5179ee15 100644 --- a/testing/gtest_prod.target.darwin-x86.mk +++ b/testing/gtest_prod.target.darwin-x86.mk @@ -65,6 +65,7 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -77,6 +78,7 @@ MY_DEFS_Debug := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ @@ -148,6 +150,7 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -160,6 +163,7 @@ MY_DEFS_Release := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ diff --git a/testing/gtest_prod.target.linux-arm.mk b/testing/gtest_prod.target.linux-arm.mk index 75b5865cf0..03a41f4977 100644 --- a/testing/gtest_prod.target.linux-arm.mk +++ b/testing/gtest_prod.target.linux-arm.mk @@ -63,6 +63,7 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -75,6 +76,7 @@ MY_DEFS_Debug := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ @@ -143,6 +145,7 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,6 +158,7 @@ MY_DEFS_Release := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ diff --git a/testing/gtest_prod.target.linux-mips.mk b/testing/gtest_prod.target.linux-mips.mk index 0b0c2af75d..75da259e50 100644 --- a/testing/gtest_prod.target.linux-mips.mk +++ b/testing/gtest_prod.target.linux-mips.mk @@ -63,6 +63,7 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -75,6 +76,7 @@ MY_DEFS_Debug := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ @@ -143,6 +145,7 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -155,6 +158,7 @@ MY_DEFS_Release := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ diff --git a/testing/gtest_prod.target.linux-x86.mk b/testing/gtest_prod.target.linux-x86.mk index f290eff23d..7a5179ee15 100644 --- a/testing/gtest_prod.target.linux-x86.mk +++ b/testing/gtest_prod.target.linux-x86.mk @@ -65,6 +65,7 @@ MY_CFLAGS_Debug := \ MY_DEFS_Debug := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -77,6 +78,7 @@ MY_DEFS_Debug := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ @@ -148,6 +150,7 @@ MY_CFLAGS_Release := \ MY_DEFS_Release := \ '-DANGLE_DX11' \ + '-DWTF_VECTOR_INITIAL_SIZE=16' \ '-D_FILE_OFFSET_BITS=64' \ '-DNO_TCMALLOC' \ '-DDISCARDABLE_MEMORY_ALWAYS_SUPPORTED_NATIVELY' \ @@ -160,6 +163,7 @@ MY_DEFS_Release := \ '-DENABLE_GPU=1' \ '-DUSE_OPENSSL=1' \ '-DENABLE_EGLIMAGE=1' \ + '-DCLD_VERSION=1' \ '-DANDROID' \ '-D__GNU_SOURCE=1' \ '-DUSE_STLPORT=1' \ diff --git a/testing/perf/perf_test.cc b/testing/perf/perf_test.cc new file mode 100644 index 0000000000..fd39f87916 --- /dev/null +++ b/testing/perf/perf_test.cc @@ -0,0 +1,188 @@ +// 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 "testing/perf/perf_test.h" + +#include <stdio.h> + +#include "base/logging.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" + +namespace { + +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 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/testing/perf/perf_test.gyp b/testing/perf/perf_test.gyp new file mode 100644 index 0000000000..2065270c11 --- /dev/null +++ b/testing/perf/perf_test.gyp @@ -0,0 +1,18 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'perf_test', + 'type': 'static_library', + 'sources': [ + 'perf_test.cc', + ], + 'dependencies': [ + '../../base/base.gyp:base', + ], + }, + ], +} diff --git a/testing/perf/perf_test.h b/testing/perf/perf_test.h new file mode 100644 index 0000000000..45052024b7 --- /dev/null +++ b/testing/perf/perf_test.h @@ -0,0 +1,110 @@ +// 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 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_ |