xref: /aosp_15_r20/external/webrtc/api/test/metrics/metric.cc (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 #include "api/test/metrics/metric.h"
11 
12 #include <string>
13 
14 namespace webrtc {
15 namespace test {
16 
ToString(Unit unit)17 absl::string_view ToString(Unit unit) {
18   switch (unit) {
19     case Unit::kMilliseconds:
20       return "Milliseconds";
21     case Unit::kPercent:
22       return "Percent";
23     case Unit::kBytes:
24       return "Bytes";
25     case Unit::kKilobitsPerSecond:
26       return "KilobitsPerSecond";
27     case Unit::kHertz:
28       return "Hertz";
29     case Unit::kUnitless:
30       return "Unitless";
31     case Unit::kCount:
32       return "Count";
33   }
34 }
35 
ToString(ImprovementDirection direction)36 absl::string_view ToString(ImprovementDirection direction) {
37   switch (direction) {
38     case ImprovementDirection::kBiggerIsBetter:
39       return "BiggerIsBetter";
40     case ImprovementDirection::kNeitherIsBetter:
41       return "NeitherIsBetter";
42     case ImprovementDirection::kSmallerIsBetter:
43       return "SmallerIsBetter";
44   }
45 }
46 
47 }  // namespace test
48 }  // namespace webrtc
49