diff --git a/modules/audio_coding/codecs/isac/fix/test/kenny.cc b/modules/audio_coding/codecs/isac/fix/test/kenny.cc index a0a2dca118..4b431cfdf9 100644 --- a/modules/audio_coding/codecs/isac/fix/test/kenny.cc +++ b/modules/audio_coding/codecs/isac/fix/test/kenny.cc @@ -105,7 +105,7 @@ TEST(IsacFixTest, Kenny) { FILE *inp, *outp, *f_bn, *outbits; int endfile; - const char* chartjson_result_file = NULL; + const char* perf_result_file = NULL; int i; int errtype, h = 0, k, packetLossPercent = 0; @@ -459,7 +459,7 @@ TEST(IsacFixTest, Kenny) { printf("Expected --isolated_script_test_perf_output=/some/filename\n"); exit(1); } - chartjson_result_file = filename_start + 1; + perf_result_file = filename_start + 1; } } @@ -858,10 +858,10 @@ TEST(IsacFixTest, Kenny) { // Record the results with Perf test tools. webrtc::test::PrintResult("isac", "", "time_per_10ms_frame", - (runtime * 10000) / length_file, "us", false); + (runtime * 10) / length_file, "ms", false); - if (chartjson_result_file) { - EXPECT_TRUE(webrtc::test::WritePerfResults(chartjson_result_file)); + if (perf_result_file) { + EXPECT_TRUE(webrtc::test::WritePerfResults(perf_result_file)); } fclose(inp); diff --git a/test/testsupport/perf_test.cc b/test/testsupport/perf_test.cc index ff0f0d9b6b..5b2f7a0479 100644 --- a/test/testsupport/perf_test.cc +++ b/test/testsupport/perf_test.cc @@ -24,7 +24,7 @@ ABSL_FLAG(bool, write_histogram_proto_json, - false, + true, "Use the histogram C++ API, which will write Histogram protos " "instead of Chart JSON. See histogram.proto in third_party/catapult. " "This flag only has effect if --isolated_script_test_perf_output is " diff --git a/test/testsupport/perf_test_unittest.cc b/test/testsupport/perf_test_unittest.cc index 1004c6495e..d99014bf80 100644 --- a/test/testsupport/perf_test_unittest.cc +++ b/test/testsupport/perf_test_unittest.cc @@ -97,6 +97,9 @@ TEST_F(PerfTest, MAYBE_TestPrintResult) { } TEST_F(PerfTest, TestGetPerfResultsJSON) { + bool original_flag = absl::GetFlag(FLAGS_write_histogram_proto_json); + absl::SetFlag(&FLAGS_write_histogram_proto_json, false); + PrintResult("measurement", "modifier", "trace", 42, "units", false); PrintResult("foo", "bar", "baz_v", 7, "widgets", true); PrintResultMeanAndError("foo", "bar", "baz_me", 1, 2, "lemurs", false); @@ -104,19 +107,19 @@ TEST_F(PerfTest, TestGetPerfResultsJSON) { PrintResultList("foo", "bar", "baz_vl", kListOfScalars, "units", false); EXPECT_EQ(RemoveSpaces(kJsonExpected), GetPerfResults()); + + absl::SetFlag(&FLAGS_write_histogram_proto_json, original_flag); } TEST_F(PerfTest, TestClearPerfResults) { PrintResult("measurement", "modifier", "trace", 42, "units", false); ClearPerfResults(); - EXPECT_EQ(R"({"format_version":"1.0","charts":{}})", GetPerfResults()); + EXPECT_EQ("", GetPerfResults()); } #if WEBRTC_ENABLE_PROTOBUF TEST_F(PerfTest, TestGetPerfResultsHistograms) { - bool original_flag = absl::GetFlag(FLAGS_write_histogram_proto_json); - absl::SetFlag(&FLAGS_write_histogram_proto_json, true); PrintResult("measurement", "_modifier", "story_1", 42, "ms", false); PrintResult("foo", "bar", "story_1", 7, "sigma", true); // Note: the error will be ignored, not supported by histograms. @@ -153,8 +156,6 @@ TEST_F(PerfTest, TestGetPerfResultsHistograms) { EXPECT_EQ(hist2.name(), "measurement_modifier"); EXPECT_EQ(hist2.unit().unit(), proto::MS_BEST_FIT_FORMAT); - - absl::SetFlag(&FLAGS_write_histogram_proto_json, original_flag); } TEST_F(PerfTest, TestClearPerfResultsHistograms) {