Factor out a perf test result printer method.
This is to allow cc_perftests to share this code without depending on chrome/. BUG= Review URL: https://chromiumcodereview.appspot.com/23509002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220803 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
chrome
browser
extensions
api
tab_capture
media
chrome_webrtc_audio_quality_browsertest.ccchrome_webrtc_browsertest.ccchrome_webrtc_video_quality_browsertest.cc
page_cycler
test
chrome_frame
testing/perf
@ -31,6 +31,7 @@
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "extensions/common/features/feature.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "ui/compositor/compositor_switches.h"
|
||||
#include "ui/gl/gl_switches.h"
|
||||
|
||||
|
@ -20,10 +20,10 @@
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/test/base/ui_test_utils.h"
|
||||
#include "chrome/test/perf/perf_test.h"
|
||||
#include "chrome/test/ui/ui_test.h"
|
||||
#include "content/public/test/browser_test_utils.h"
|
||||
#include "net/test/embedded_test_server/embedded_test_server.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
static const base::FilePath::CharType kPeerConnectionServer[] =
|
||||
#if defined(OS_WIN)
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "content/public/test/browser_test_utils.h"
|
||||
#include "net/test/embedded_test_server/embedded_test_server.h"
|
||||
#include "net/test/python_utils.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
static const char kMainWebrtcTestHtmlPage[] =
|
||||
"/webrtc/webrtc_jsep01_test.html";
|
||||
|
@ -23,12 +23,12 @@
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/test/base/in_process_browser_test.h"
|
||||
#include "chrome/test/base/ui_test_utils.h"
|
||||
#include "chrome/test/perf/perf_test.h"
|
||||
#include "chrome/test/ui/ui_test.h"
|
||||
#include "content/public/browser/notification_service.h"
|
||||
#include "content/public/test/browser_test_utils.h"
|
||||
#include "net/test/embedded_test_server/embedded_test_server.h"
|
||||
#include "net/test/python_utils.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
static const base::FilePath::CharType kFrameAnalyzerExecutable[] =
|
||||
#if defined(OS_WIN)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
using content::NavigationController;
|
||||
using content::OpenURLParams;
|
||||
|
@ -2466,7 +2466,8 @@
|
||||
'browser/webdata/web_data_service_win.cc',
|
||||
'browser/webdata/web_intents_table.cc',
|
||||
'browser/webdata/web_intents_table.h',
|
||||
# These files are needed by page_cycler.cc
|
||||
# These files are needed by page_cycler.cc and performance_monitor.cc.
|
||||
# This dependency should be removed: crbug.com/280157, crbug.com/279660
|
||||
'test/base/test_switches.cc',
|
||||
'test/base/test_switches.h',
|
||||
'test/base/chrome_process_util.cc',
|
||||
@ -2498,6 +2499,8 @@
|
||||
'../media/media.gyp:media',
|
||||
'../net/net.gyp:net_with_v8',
|
||||
'../printing/printing.gyp:printing',
|
||||
# TODO(tonyg): Remove this dependency (crbug.com/280157).
|
||||
'../testing/perf/perf_test.gyp:*',
|
||||
'../third_party/adobe/flash/flash_player.gyp:flapper_version_h',
|
||||
'../third_party/expat/expat.gyp:expat',
|
||||
'../third_party/hunspell/hunspell.gyp:hunspell',
|
||||
|
@ -720,6 +720,7 @@
|
||||
'../base/base.gyp:run_all_unittests',
|
||||
'../base/base.gyp:test_support_base',
|
||||
'../testing/gtest.gyp:gtest',
|
||||
'../testing/perf/perf_test.gyp:*',
|
||||
'../skia/skia.gyp:skia',
|
||||
],
|
||||
'include_dirs': [
|
||||
@ -2380,6 +2381,7 @@
|
||||
'../base/base.gyp:base',
|
||||
'../skia/skia.gyp:skia',
|
||||
'../testing/gtest.gyp:gtest',
|
||||
'../testing/perf/perf_test.gyp:*',
|
||||
],
|
||||
'sources': [
|
||||
# TODO(darin): Move other UIPerfTests here.
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "chrome/test/perf/perf_ui_test_suite.h"
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "chrome/test/ui/javascript_test_util.h"
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "ui/gl/gl_implementation.h"
|
||||
#include "ui/gl/gl_switches.h"
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "chrome/test/ui/javascript_test_util.h"
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace {
|
||||
|
@ -11,9 +11,9 @@
|
||||
#include "chrome/test/automation/automation_proxy.h"
|
||||
#include "chrome/test/automation/browser_proxy.h"
|
||||
#include "chrome/test/automation/tab_proxy.h"
|
||||
#include "chrome/test/perf/perf_test.h"
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "net/test/spawned_test_server/spawned_test_server.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "gpu/command_buffer/service/gpu_switches.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace {
|
||||
|
@ -10,152 +10,10 @@
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "chrome/test/base/chrome_process_util.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
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
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(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(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 PrintIOPerfInfo(const std::string& test_name,
|
||||
const ChromeProcessList& chrome_processes,
|
||||
base::ProcessId browser_pid) {
|
||||
@ -551,33 +409,4 @@ std::string MemoryUsageInfoToString(const std::string& test_name,
|
||||
return output;
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -12,88 +12,6 @@
|
||||
|
||||
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 IO performance data for use by perf graphs.
|
||||
void PrintIOPerfInfo(const std::string& test_name,
|
||||
const ChromeProcessList& chrome_processes,
|
||||
@ -122,20 +40,6 @@ std::string MemoryUsageInfoToString(const std::string& test_name,
|
||||
const ChromeProcessList& chrome_processes,
|
||||
base::ProcessId browser_pid);
|
||||
|
||||
// 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 // CHROME_TEST_PERF_PERF_TEST_H_
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "net/base/net_util.h"
|
||||
#include "net/dns/mock_host_resolver.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/gfx/codec/png_codec.h"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "chrome/test/perf/perf_test.h"
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
using base::TimeTicks;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "chrome/test/perf/perf_test.h"
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "net/base/net_util.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
using base::TimeDelta;
|
||||
|
@ -338,6 +338,7 @@
|
||||
'../content/content.gyp:content_gpu',
|
||||
'../testing/gmock.gyp:gmock',
|
||||
'../testing/gtest.gyp:gtest',
|
||||
'../testing/perf/perf_test.gyp:*',
|
||||
'../third_party/libxml/libxml.gyp:libxml',
|
||||
'../third_party/libxslt/libxslt.gyp:libxslt',
|
||||
'../url/url.gyp:url_lib',
|
||||
|
@ -35,11 +35,11 @@
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_paths_internal.h"
|
||||
#include "chrome/test/base/chrome_process_util.h"
|
||||
#include "chrome/test/perf/perf_test.h"
|
||||
#include "chrome/test/ui/ui_perf_test.h"
|
||||
#include "chrome_frame/chrome_tab.h"
|
||||
#include "chrome_frame/test_utils.h"
|
||||
#include "chrome_frame/utils.h"
|
||||
#include "testing/perf/perf_test.h"
|
||||
|
||||
const wchar_t kSilverlightControlKey[] =
|
||||
L"CLSID\\{DFEAF541-F3E1-4c24-ACAC-99C30715084A}\\InprocServer32";
|
||||
|
188
testing/perf/perf_test.cc
Normal file
188
testing/perf/perf_test.cc
Normal file
@ -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
|
18
testing/perf/perf_test.gyp
Normal file
18
testing/perf/perf_test.gyp
Normal file
@ -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',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
110
testing/perf/perf_test.h
Normal file
110
testing/perf/perf_test.h
Normal file
@ -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_
|
Reference in New Issue
Block a user