From e9b15ab829d61da588318d59a967740b2071740b Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Fri, 20 Dec 2019 19:10:50 +0000 Subject: [PATCH] perf_tests: Fixup perf test result printing format Results should be printed METRIC: STORY, not the other way around. Also, story names shouldn't have slashes as it will parse as separate chart segments and won't be allowed when we switch to using histograms. Bug: dawn:208, dawn:311 Change-Id: Ifc893e5aa94eddcb3a08c0d4aff66b7a0f41620b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14740 Commit-Queue: Austin Eng Reviewed-by: Kai Ninomiya --- src/tests/perf_tests/DawnPerfTest.cpp | 30 +++++++++++++-------------- src/tests/perf_tests/DawnPerfTest.h | 5 +++++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/tests/perf_tests/DawnPerfTest.cpp b/src/tests/perf_tests/DawnPerfTest.cpp index 8fd3ab8980..3bd641b616 100644 --- a/src/tests/perf_tests/DawnPerfTest.cpp +++ b/src/tests/perf_tests/DawnPerfTest.cpp @@ -381,30 +381,30 @@ void DawnPerfTestBase::PrintResult(const std::string& trace, double value, const std::string& units, bool important) const { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - - const char* testName = testInfo->name(); - const char* testSuite = testInfo->test_suite_name(); - - // The results are printed according to the format specified at - // [chromium]//build/scripts/slave/performance_log_processor.py - dawn::InfoLog() << (important ? "*" : "") << "RESULT " << testSuite << testName << ": " << trace - << "= " << value << " " << units; + PrintResultImpl(trace, std::to_string(value), units, important); } void DawnPerfTestBase::PrintResult(const std::string& trace, unsigned int value, const std::string& units, bool important) const { + PrintResultImpl(trace, std::to_string(value), units, important); +} + +void DawnPerfTestBase::PrintResultImpl(const std::string& trace, + const std::string& value, + const std::string& units, + bool important) const { const ::testing::TestInfo* const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); - const char* testName = testInfo->name(); - const char* testSuite = testInfo->test_suite_name(); + std::string metric = std::string(testInfo->test_suite_name()) + "." + trace; + + std::string story = testInfo->name(); + std::replace(story.begin(), story.end(), '/', '_'); // The results are printed according to the format specified at - // [chromium]//build/scripts/slave/performance_log_processor.py - dawn::InfoLog() << (important ? "*" : "") << "RESULT " << testSuite << testName << ": " << trace - << "= " << value << " " << units; + // [chromium]//src/tools/perf/generate_legacy_perf_dashboard_json.py + dawn::InfoLog() << (important ? "*" : "") << "RESULT " << metric << ": " << story << "= " + << value << " " << units; } diff --git a/src/tests/perf_tests/DawnPerfTest.h b/src/tests/perf_tests/DawnPerfTest.h index b514b1c278..64ef6dc647 100644 --- a/src/tests/perf_tests/DawnPerfTest.h +++ b/src/tests/perf_tests/DawnPerfTest.h @@ -91,6 +91,11 @@ class DawnPerfTestBase { void DoRunLoop(double maxRunTime); void OutputResults(); + void PrintResultImpl(const std::string& trace, + const std::string& value, + const std::string& units, + bool important) const; + virtual void Step() = 0; DawnTestBase* mTest;