BUILD.gn (7200B)
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 9 import("../../../webrtc.gni") 10 if (rtc_enable_protobuf) { 11 import("//third_party/protobuf/proto_library.gni") 12 } 13 14 group("metrics") { 15 testonly = true 16 deps = [ 17 ":global_metrics_logger_and_exporter", 18 ":metric", 19 ":metrics_accumulator", 20 ":metrics_exporter", 21 ":metrics_logger", 22 ] 23 if (!build_with_chromium) { 24 deps += [ ":stdout_metrics_exporter" ] 25 } 26 } 27 28 if (rtc_include_tests) { 29 group("metrics_unittests") { 30 testonly = true 31 32 deps = [ 33 ":global_metrics_logger_and_exporter_test", 34 ":metrics_accumulator_test", 35 ":metrics_logger_test", 36 ":print_result_proxy_metrics_exporter_test", 37 ":stdout_metrics_exporter_test", 38 ] 39 40 if (rtc_enable_protobuf) { 41 deps += [ 42 ":chrome_perf_dashboard_metrics_exporter_test", 43 ":metrics_set_proto_file_exporter_test", 44 ] 45 } 46 } 47 } 48 49 rtc_library("metric") { 50 visibility = [ "*" ] 51 sources = [ 52 "metric.cc", 53 "metric.h", 54 ] 55 deps = [ 56 "../../units:timestamp", 57 "//third_party/abseil-cpp/absl/strings:string_view", 58 ] 59 } 60 61 rtc_library("metrics_logger") { 62 visibility = [ "*" ] 63 sources = [ 64 "metrics_logger.cc", 65 "metrics_logger.h", 66 ] 67 deps = [ 68 ":metric", 69 ":metrics_accumulator", 70 "../../../rtc_base:macromagic", 71 "../../../rtc_base/synchronization:mutex", 72 "../../../system_wrappers", 73 "../../numerics", 74 "../../units:timestamp", 75 "//third_party/abseil-cpp/absl/strings:string_view", 76 ] 77 } 78 79 rtc_library("metrics_accumulator") { 80 visibility = [ "*" ] 81 sources = [ 82 "metrics_accumulator.cc", 83 "metrics_accumulator.h", 84 ] 85 deps = [ 86 ":metric", 87 "../../../rtc_base:macromagic", 88 "../../../rtc_base/synchronization:mutex", 89 "../../numerics", 90 "../../units:timestamp", 91 "//third_party/abseil-cpp/absl/strings:string_view", 92 ] 93 } 94 95 rtc_library("metrics_exporter") { 96 visibility = [ "*" ] 97 sources = [ "metrics_exporter.h" ] 98 deps = [ 99 ":metric", 100 "../..:array_view", 101 ] 102 } 103 104 if (!build_with_chromium) { 105 # Hidden from the Chromium build because it depends on absl flags which 106 # cannot be compiled in Chromium. 107 rtc_library("stdout_metrics_exporter") { 108 visibility = [ "*" ] 109 testonly = true 110 sources = [ 111 "stdout_metrics_exporter.cc", 112 "stdout_metrics_exporter.h", 113 ] 114 deps = [ 115 ":metric", 116 ":metrics_exporter", 117 "../..:array_view", 118 "../../../rtc_base:stringutils", 119 "../../../test:test_flags", 120 "//third_party/abseil-cpp/absl/flags:flag", 121 "//third_party/abseil-cpp/absl/strings", 122 ] 123 } 124 } 125 126 rtc_library("chrome_perf_dashboard_metrics_exporter") { 127 visibility = [ "*" ] 128 testonly = true 129 sources = [ 130 "chrome_perf_dashboard_metrics_exporter.cc", 131 "chrome_perf_dashboard_metrics_exporter.h", 132 ] 133 deps = [ 134 ":metric", 135 ":metrics_exporter", 136 "../..:array_view", 137 "../../../test:fileutils", 138 "../../../test:perf_test", 139 "//third_party/abseil-cpp/absl/memory", 140 "//third_party/abseil-cpp/absl/strings:string_view", 141 ] 142 } 143 144 if (rtc_enable_protobuf) { 145 proto_library("metric_proto") { 146 visibility = [ "*" ] 147 sources = [ "proto/metric.proto" ] 148 proto_out_dir = "api/test/metrics/proto" 149 cc_generator_options = "lite" 150 } 151 } 152 153 rtc_library("metrics_set_proto_file_exporter") { 154 visibility = [ "*" ] 155 testonly = true 156 sources = [ 157 "metrics_set_proto_file_exporter.cc", 158 "metrics_set_proto_file_exporter.h", 159 ] 160 deps = [ 161 ":metric", 162 ":metrics_exporter", 163 "../..:array_view", 164 "../../../rtc_base:logging", 165 "../../../test:fileutils", 166 "//third_party/abseil-cpp/absl/strings:string_view", 167 ] 168 169 if (rtc_enable_protobuf) { 170 deps += [ ":metric_proto" ] 171 } 172 } 173 174 rtc_library("print_result_proxy_metrics_exporter") { 175 visibility = [ "*" ] 176 testonly = true 177 sources = [ 178 "print_result_proxy_metrics_exporter.cc", 179 "print_result_proxy_metrics_exporter.h", 180 ] 181 deps = [ 182 ":metric", 183 ":metrics_exporter", 184 "../..:array_view", 185 "../../../test:perf_test", 186 "../../numerics", 187 ] 188 } 189 190 rtc_library("global_metrics_logger_and_exporter") { 191 visibility = [ "*" ] 192 sources = [ 193 "global_metrics_logger_and_exporter.cc", 194 "global_metrics_logger_and_exporter.h", 195 ] 196 deps = [ 197 ":metric", 198 ":metrics_exporter", 199 ":metrics_logger", 200 "../../../rtc_base:checks", 201 "../../../system_wrappers", 202 ] 203 } 204 205 if (rtc_include_tests) { 206 rtc_library("metrics_logger_test") { 207 testonly = true 208 sources = [ "metrics_logger_test.cc" ] 209 deps = [ 210 ":metric", 211 ":metrics_logger", 212 "../../../system_wrappers", 213 "../../../test:test_support", 214 "../../numerics", 215 "../../units:timestamp", 216 ] 217 } 218 219 rtc_library("metrics_accumulator_test") { 220 testonly = true 221 sources = [ "metrics_accumulator_test.cc" ] 222 deps = [ 223 ":metric", 224 ":metrics_accumulator", 225 "../../../test:test_support", 226 "../../units:timestamp", 227 ] 228 } 229 230 rtc_library("stdout_metrics_exporter_test") { 231 testonly = true 232 sources = [ "stdout_metrics_exporter_test.cc" ] 233 deps = [ 234 ":metric", 235 ":stdout_metrics_exporter", 236 "../../../test:test_flags", 237 "../../../test:test_support", 238 "../../units:timestamp", 239 "//third_party/abseil-cpp/absl/flags:flag", 240 ] 241 } 242 243 rtc_library("print_result_proxy_metrics_exporter_test") { 244 testonly = true 245 sources = [ "print_result_proxy_metrics_exporter_test.cc" ] 246 deps = [ 247 ":metric", 248 ":print_result_proxy_metrics_exporter", 249 "../../../test:test_support", 250 "../../units:timestamp", 251 ] 252 } 253 254 rtc_library("global_metrics_logger_and_exporter_test") { 255 testonly = true 256 sources = [ "global_metrics_logger_and_exporter_test.cc" ] 257 deps = [ 258 ":global_metrics_logger_and_exporter", 259 ":metric", 260 ":metrics_exporter", 261 ":metrics_logger", 262 "../..:array_view", 263 "../../../system_wrappers", 264 "../../../test:test_support", 265 ] 266 } 267 268 if (rtc_enable_protobuf) { 269 rtc_library("metrics_set_proto_file_exporter_test") { 270 testonly = true 271 sources = [ "metrics_set_proto_file_exporter_test.cc" ] 272 deps = [ 273 ":metric", 274 ":metric_proto", 275 ":metrics_set_proto_file_exporter", 276 "../../../rtc_base:protobuf_utils", 277 "../../../test:fileutils", 278 "../../../test:test_support", 279 "../../units:timestamp", 280 ] 281 } 282 283 rtc_library("chrome_perf_dashboard_metrics_exporter_test") { 284 testonly = true 285 sources = [ "chrome_perf_dashboard_metrics_exporter_test.cc" ] 286 deps = [ 287 ":chrome_perf_dashboard_metrics_exporter", 288 ":metric", 289 "../../../test:fileutils", 290 "../../../test:test_support", 291 "../../units:timestamp", 292 "//third_party/catapult/tracing/tracing:histogram", 293 ] 294 } 295 } 296 }