xref: /aosp_15_r20/external/webrtc/test/testsupport/perf_test_result_writer.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef TEST_TESTSUPPORT_PERF_TEST_RESULT_WRITER_H_
12 #define TEST_TESTSUPPORT_PERF_TEST_RESULT_WRITER_H_
13 
14 #include <stdio.h>
15 
16 #include <string>
17 
18 #include "absl/strings/string_view.h"
19 #include "test/testsupport/perf_test.h"
20 
21 namespace webrtc {
22 namespace test {
23 
24 // Interface for classes that write perf results to some kind of JSON format.
25 class PerfTestResultWriter {
26  public:
27   virtual ~PerfTestResultWriter() = default;
28 
29   virtual void ClearResults() = 0;
30   virtual void LogResult(absl::string_view graph_name,
31                          absl::string_view trace_name,
32                          double value,
33                          absl::string_view units,
34                          bool important,
35                          webrtc::test::ImproveDirection improve_direction) = 0;
36   virtual void LogResultMeanAndError(
37       absl::string_view graph_name,
38       absl::string_view trace_name,
39       double mean,
40       double error,
41       absl::string_view units,
42       bool important,
43       webrtc::test::ImproveDirection improve_direction) = 0;
44   virtual void LogResultList(
45       absl::string_view graph_name,
46       absl::string_view trace_name,
47       rtc::ArrayView<const double> values,
48       absl::string_view units,
49       bool important,
50       webrtc::test::ImproveDirection improve_direction) = 0;
51 
52   virtual std::string Serialize() const = 0;
53 };
54 
55 }  // namespace test
56 }  // namespace webrtc
57 
58 #endif  // TEST_TESTSUPPORT_PERF_TEST_RESULT_WRITER_H_
59