xref: /aosp_15_r20/external/webrtc/api/test/metrics/chrome_perf_dashboard_metrics_exporter.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2022 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 API_TEST_METRICS_CHROME_PERF_DASHBOARD_METRICS_EXPORTER_H_
12 #define API_TEST_METRICS_CHROME_PERF_DASHBOARD_METRICS_EXPORTER_H_
13 
14 #include <string>
15 
16 #include "absl/strings/string_view.h"
17 #include "api/array_view.h"
18 #include "api/test/metrics/metric.h"
19 #include "api/test/metrics/metrics_exporter.h"
20 
21 namespace webrtc {
22 namespace test {
23 
24 // Exports all collected metrics in the Chrome Perf Dashboard proto format.
25 class ChromePerfDashboardMetricsExporter : public MetricsExporter {
26  public:
27   // `export_file_path` - path where the proto file will be written.
28   explicit ChromePerfDashboardMetricsExporter(
29       absl::string_view export_file_path);
30   ~ChromePerfDashboardMetricsExporter() override = default;
31 
32   bool Export(rtc::ArrayView<const Metric> metrics) override;
33 
34  private:
35   const std::string export_file_path_;
36 };
37 
38 }  // namespace test
39 }  // namespace webrtc
40 
41 #endif  // API_TEST_METRICS_CHROME_PERF_DASHBOARD_METRICS_EXPORTER_H_
42