xref: /aosp_15_r20/external/webrtc/api/test/metrics/BUILD.gn (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS.  All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9import("../../../webrtc.gni")
10if (rtc_enable_protobuf) {
11  import("//third_party/protobuf/proto_library.gni")
12}
13
14group("metrics") {
15  deps = [
16    ":global_metrics_logger_and_exporter",
17    ":metric",
18    ":metrics_accumulator",
19    ":metrics_exporter",
20    ":metrics_logger",
21    ":stdout_metrics_exporter",
22  ]
23}
24
25if (rtc_include_tests) {
26  group("metrics_unittests") {
27    testonly = true
28
29    deps = [
30      ":global_metrics_logger_and_exporter_test",
31      ":metrics_accumulator_test",
32      ":metrics_logger_test",
33      ":print_result_proxy_metrics_exporter_test",
34      ":stdout_metrics_exporter_test",
35    ]
36
37    if (rtc_enable_protobuf) {
38      deps += [
39        ":chrome_perf_dashboard_metrics_exporter_test",
40        ":metrics_set_proto_file_exporter_test",
41      ]
42    }
43  }
44}
45
46rtc_library("metric") {
47  visibility = [ "*" ]
48  sources = [
49    "metric.cc",
50    "metric.h",
51  ]
52  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
53  deps = [ "../../../api/units:timestamp" ]
54}
55
56rtc_library("metrics_logger") {
57  visibility = [ "*" ]
58  sources = [
59    "metrics_logger.cc",
60    "metrics_logger.h",
61  ]
62  deps = [
63    ":metric",
64    ":metrics_accumulator",
65    "../..:array_view",
66    "../../../rtc_base/synchronization:mutex",
67    "../../../system_wrappers",
68    "../../numerics",
69  ]
70  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
71}
72
73rtc_library("metrics_accumulator") {
74  visibility = [ "*" ]
75  sources = [
76    "metrics_accumulator.cc",
77    "metrics_accumulator.h",
78  ]
79  deps = [
80    ":metric",
81    "../../../rtc_base:macromagic",
82    "../../../rtc_base/synchronization:mutex",
83    "../../numerics",
84    "../../units:timestamp",
85  ]
86  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
87}
88
89rtc_library("metrics_exporter") {
90  visibility = [ "*" ]
91  sources = [ "metrics_exporter.h" ]
92  deps = [
93    ":metric",
94    "../..:array_view",
95  ]
96}
97
98rtc_library("stdout_metrics_exporter") {
99  visibility = [ "*" ]
100  sources = [
101    "stdout_metrics_exporter.cc",
102    "stdout_metrics_exporter.h",
103  ]
104  deps = [
105    ":metric",
106    ":metrics_exporter",
107    "../..:array_view",
108    "../../../rtc_base:stringutils",
109  ]
110  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
111}
112
113rtc_library("chrome_perf_dashboard_metrics_exporter") {
114  visibility = [ "*" ]
115  testonly = true
116  sources = [
117    "chrome_perf_dashboard_metrics_exporter.cc",
118    "chrome_perf_dashboard_metrics_exporter.h",
119  ]
120  deps = [
121    ":metric",
122    ":metrics_exporter",
123    "../../../api:array_view",
124    "../../../test:fileutils",
125    "../../../test:perf_test",
126  ]
127  absl_deps = [
128    "//third_party/abseil-cpp/absl/memory",
129    "//third_party/abseil-cpp/absl/strings",
130  ]
131}
132
133if (rtc_enable_protobuf) {
134  proto_library("metric_proto") {
135    visibility = [ "*" ]
136    sources = [ "proto/metric.proto" ]
137    proto_out_dir = "api/test/metrics/proto"
138    cc_generator_options = "lite"
139  }
140}
141
142rtc_library("metrics_set_proto_file_exporter") {
143  visibility = [ "*" ]
144  testonly = true
145  sources = [
146    "metrics_set_proto_file_exporter.cc",
147    "metrics_set_proto_file_exporter.h",
148  ]
149  deps = [
150    ":metric",
151    ":metrics_exporter",
152    "../..:array_view",
153    "../../../rtc_base:logging",
154    "../../../test:fileutils",
155  ]
156
157  if (rtc_enable_protobuf) {
158    deps += [ ":metric_proto" ]
159  }
160}
161
162rtc_library("print_result_proxy_metrics_exporter") {
163  visibility = [ "*" ]
164  testonly = true
165  sources = [
166    "print_result_proxy_metrics_exporter.cc",
167    "print_result_proxy_metrics_exporter.h",
168  ]
169  deps = [
170    ":metric",
171    ":metrics_exporter",
172    "../..:array_view",
173    "../../../test:perf_test",
174  ]
175}
176
177rtc_library("global_metrics_logger_and_exporter") {
178  visibility = [ "*" ]
179  sources = [
180    "global_metrics_logger_and_exporter.cc",
181    "global_metrics_logger_and_exporter.h",
182  ]
183  deps = [
184    ":metrics_exporter",
185    ":metrics_logger",
186    "../../../rtc_base:checks",
187    "../../../system_wrappers",
188  ]
189}
190
191if (rtc_include_tests) {
192  rtc_library("metrics_logger_test") {
193    testonly = true
194    sources = [ "metrics_logger_test.cc" ]
195    deps = [
196      ":metric",
197      ":metrics_logger",
198      "../../../system_wrappers",
199      "../../../test:test_support",
200      "../../numerics",
201    ]
202    absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
203  }
204
205  rtc_library("metrics_accumulator_test") {
206    testonly = true
207    sources = [ "metrics_accumulator_test.cc" ]
208    deps = [
209      ":metric",
210      ":metrics_accumulator",
211      "../../../test:test_support",
212      "../../units:timestamp",
213    ]
214    absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
215  }
216
217  rtc_library("stdout_metrics_exporter_test") {
218    testonly = true
219    sources = [ "stdout_metrics_exporter_test.cc" ]
220    deps = [
221      ":metric",
222      ":stdout_metrics_exporter",
223      "../../../test:test_support",
224      "../../units:timestamp",
225    ]
226  }
227
228  rtc_library("print_result_proxy_metrics_exporter_test") {
229    testonly = true
230    sources = [ "print_result_proxy_metrics_exporter_test.cc" ]
231    deps = [
232      ":metric",
233      ":print_result_proxy_metrics_exporter",
234      "../../../test:test_support",
235      "../../units:timestamp",
236    ]
237  }
238
239  rtc_library("global_metrics_logger_and_exporter_test") {
240    testonly = true
241    sources = [ "global_metrics_logger_and_exporter_test.cc" ]
242    deps = [
243      ":global_metrics_logger_and_exporter",
244      ":metric",
245      ":metrics_exporter",
246      ":metrics_logger",
247      "../../../system_wrappers",
248      "../../../test:test_support",
249    ]
250    absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
251  }
252
253  if (rtc_enable_protobuf) {
254    rtc_library("metrics_set_proto_file_exporter_test") {
255      testonly = true
256      sources = [ "metrics_set_proto_file_exporter_test.cc" ]
257      deps = [
258        ":metric",
259        ":metric_proto",
260        ":metrics_set_proto_file_exporter",
261        "../../../rtc_base:protobuf_utils",
262        "../../../test:fileutils",
263        "../../../test:test_support",
264        "../../units:timestamp",
265      ]
266    }
267
268    rtc_library("chrome_perf_dashboard_metrics_exporter_test") {
269      testonly = true
270      sources = [ "chrome_perf_dashboard_metrics_exporter_test.cc" ]
271      deps = [
272        ":chrome_perf_dashboard_metrics_exporter",
273        ":metric",
274        "../../../api/units:timestamp",
275        "../../../test:fileutils",
276        "../../../test:test_support",
277        "//third_party/catapult/tracing/tracing:histogram",
278      ]
279    }
280  }
281}
282