xref: /aosp_15_r20/external/webrtc/api/test/metrics/proto/metric.proto (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker/*
2*d9f75844SAndroid Build Coastguard Worker *  Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
3*d9f75844SAndroid Build Coastguard Worker *
4*d9f75844SAndroid Build Coastguard Worker *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker */
10*d9f75844SAndroid Build Coastguard Worker
11*d9f75844SAndroid Build Coastguard Workersyntax = "proto3";
12*d9f75844SAndroid Build Coastguard Worker
13*d9f75844SAndroid Build Coastguard Workerpackage webrtc.test_metrics;
14*d9f75844SAndroid Build Coastguard Worker
15*d9f75844SAndroid Build Coastguard Worker// Root message of the proto file. Contains collection of all the metrics.
16*d9f75844SAndroid Build Coastguard Workermessage MetricsSet {
17*d9f75844SAndroid Build Coastguard Worker  repeated Metric metrics = 1;
18*d9f75844SAndroid Build Coastguard Worker}
19*d9f75844SAndroid Build Coastguard Worker
20*d9f75844SAndroid Build Coastguard Workerenum Unit {
21*d9f75844SAndroid Build Coastguard Worker  // Default value that has to be defined.
22*d9f75844SAndroid Build Coastguard Worker  UNDEFINED_UNIT = 0;
23*d9f75844SAndroid Build Coastguard Worker  // General unitless value. Can be used either for dimensionless quantities
24*d9f75844SAndroid Build Coastguard Worker  // (ex ratio) or for units not presented in this enum and too specific to add
25*d9f75844SAndroid Build Coastguard Worker  // to this enum.
26*d9f75844SAndroid Build Coastguard Worker  UNITLESS = 1;
27*d9f75844SAndroid Build Coastguard Worker  MILLISECONDS = 2;
28*d9f75844SAndroid Build Coastguard Worker  PERCENT = 3;
29*d9f75844SAndroid Build Coastguard Worker  BYTES = 4;
30*d9f75844SAndroid Build Coastguard Worker  KILOBITS_PER_SECOND = 5;
31*d9f75844SAndroid Build Coastguard Worker  HERTZ = 6;
32*d9f75844SAndroid Build Coastguard Worker  COUNT = 7;
33*d9f75844SAndroid Build Coastguard Worker}
34*d9f75844SAndroid Build Coastguard Worker
35*d9f75844SAndroid Build Coastguard Workerenum ImprovementDirection {
36*d9f75844SAndroid Build Coastguard Worker  // Default value that has to be defined.
37*d9f75844SAndroid Build Coastguard Worker  UNDEFINED_IMPROVEMENT_DIRECTION = 0;
38*d9f75844SAndroid Build Coastguard Worker  BIGGER_IS_BETTER = 1;
39*d9f75844SAndroid Build Coastguard Worker  NEITHER_IS_BETTER = 2;
40*d9f75844SAndroid Build Coastguard Worker  SMALLER_IS_BETTER = 3;
41*d9f75844SAndroid Build Coastguard Worker}
42*d9f75844SAndroid Build Coastguard Worker
43*d9f75844SAndroid Build Coastguard Worker// Single performance metric with all related metadata.
44*d9f75844SAndroid Build Coastguard Workermessage Metric {
45*d9f75844SAndroid Build Coastguard Worker  // Metric name, for example PSNR, SSIM, decode_time, etc.
46*d9f75844SAndroid Build Coastguard Worker  string name = 1;
47*d9f75844SAndroid Build Coastguard Worker  Unit unit = 2;
48*d9f75844SAndroid Build Coastguard Worker  ImprovementDirection improvement_direction = 3;
49*d9f75844SAndroid Build Coastguard Worker  // If the metric is generated by a test, this field can be used to specify
50*d9f75844SAndroid Build Coastguard Worker  // this information.
51*d9f75844SAndroid Build Coastguard Worker  string test_case = 4;
52*d9f75844SAndroid Build Coastguard Worker  // Metadata associated with the whole metric.
53*d9f75844SAndroid Build Coastguard Worker  map<string, string> metric_metadata = 5;
54*d9f75844SAndroid Build Coastguard Worker
55*d9f75844SAndroid Build Coastguard Worker  message TimeSeries {
56*d9f75844SAndroid Build Coastguard Worker    message Sample {
57*d9f75844SAndroid Build Coastguard Worker      // Timestamp in microseconds associated with a sample. For example,
58*d9f75844SAndroid Build Coastguard Worker      // the timestamp when the sample was collected.
59*d9f75844SAndroid Build Coastguard Worker      int64 timestamp_us = 1;
60*d9f75844SAndroid Build Coastguard Worker      double value = 2;
61*d9f75844SAndroid Build Coastguard Worker      // Metadata associated with this particular sample.
62*d9f75844SAndroid Build Coastguard Worker      map<string, string> sample_metadata = 3;
63*d9f75844SAndroid Build Coastguard Worker    }
64*d9f75844SAndroid Build Coastguard Worker    // All samples collected for this metric. It can be empty if the Metric
65*d9f75844SAndroid Build Coastguard Worker    // object only contains `stats`.
66*d9f75844SAndroid Build Coastguard Worker    repeated Sample samples = 1;
67*d9f75844SAndroid Build Coastguard Worker  }
68*d9f75844SAndroid Build Coastguard Worker  // Contains all samples of the metric collected during test execution.
69*d9f75844SAndroid Build Coastguard Worker  // It can be empty if the user only stores precomputed statistics into
70*d9f75844SAndroid Build Coastguard Worker  // `stats`.
71*d9f75844SAndroid Build Coastguard Worker  TimeSeries time_series = 6;
72*d9f75844SAndroid Build Coastguard Worker
73*d9f75844SAndroid Build Coastguard Worker  // Contains metric's precomputed statistics based on the `time_series` or if
74*d9f75844SAndroid Build Coastguard Worker  // `time_series` is omitted (has 0 samples) contains precomputed statistics
75*d9f75844SAndroid Build Coastguard Worker  // provided by the metric's calculator.
76*d9f75844SAndroid Build Coastguard Worker  message Stats {
77*d9f75844SAndroid Build Coastguard Worker    // Sample mean of the metric
78*d9f75844SAndroid Build Coastguard Worker    // (https://en.wikipedia.org/wiki/Sample_mean_and_covariance).
79*d9f75844SAndroid Build Coastguard Worker    optional double mean = 1;
80*d9f75844SAndroid Build Coastguard Worker    // Standard deviation (https://en.wikipedia.org/wiki/Standard_deviation).
81*d9f75844SAndroid Build Coastguard Worker    // Is undefined if `time_series` contains only a single sample.
82*d9f75844SAndroid Build Coastguard Worker    optional double stddev = 2;
83*d9f75844SAndroid Build Coastguard Worker    optional double min = 3;
84*d9f75844SAndroid Build Coastguard Worker    optional double max = 4;
85*d9f75844SAndroid Build Coastguard Worker  }
86*d9f75844SAndroid Build Coastguard Worker  Stats stats = 7;
87*d9f75844SAndroid Build Coastguard Worker}
88