Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Unified Diff: base/test/launcher/test_launcher.cc

Issue 2428923002: Test launcher: add histograms (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_launcher.cc
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 1e2a95b0daa7a6813d8a844d7a46885a2ded8a03..9195606b57dbd70ce9b21cdba8be8ac16d1cbcb6 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -21,6 +21,8 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram_macros_local.h"
+#include "base/metrics/statistics_recorder.h"
#include "base/process/kill.h"
#include "base/process/launch.h"
#include "base/run_loop.h"
@@ -75,6 +77,9 @@ namespace {
// for any reason, e.g. early exit because of too many broken tests.
const char kUnreliableResultsTag[] = "UNRELIABLE_RESULTS";
+// Name of the local histogram to measure test output size.
+const char kOutputSizeHistogramName[] = "TestLauncher.TestOutputSize";
+
// Maximum time of no output after which we print list of processes still
// running. This deliberately doesn't use TestTimeouts (which is otherwise
// a recommended solution), because they can be increased. This would defeat
@@ -542,6 +547,11 @@ bool TestLauncher::Run() {
MaybeSaveSummaryAsJSON(std::vector<std::string>());
+ std::string output_histogram;
+ StatisticsRecorder::WriteGraph(kOutputSizeHistogramName, &output_histogram);
+ fprintf(stdout, "%s", output_histogram.c_str());
+ fflush(stdout);
+
return run_result_;
}
@@ -577,6 +587,9 @@ void TestLauncher::OnTestFinished(const TestResult& original_result) {
TestResult result(original_result);
+ LOCAL_HISTOGRAM_CUSTOM_COUNTS(
+ kOutputSizeHistogramName, result.output_snippet.length(),
+ 1, 10000000, 50);
if (result.output_snippet.length() > kOutputSnippetBytesLimit) {
if (result.status == TestResult::TEST_SUCCESS)
result.status = TestResult::TEST_EXCESSIVE_OUTPUT;
@@ -946,6 +959,8 @@ bool TestLauncher::Init() {
results_tracker_.AddGlobalTag("CPU_64_BITS");
#endif
+ StatisticsRecorder::Initialize();
+
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698