Artem Titov | c898c82 | 2022-09-14 11:14:02 | [diff] [blame] | 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 | |
| 17 | absl::string_view ToString(Unit unit) { |
| 18 | switch (unit) { |
Artem Titov | 539c1da | 2022-09-20 19:16:11 | [diff] [blame] | 19 | case Unit::kMilliseconds: |
| 20 | return "Milliseconds"; |
Artem Titov | c898c82 | 2022-09-14 11:14:02 | [diff] [blame] | 21 | case Unit::kPercent: |
| 22 | return "Percent"; |
Artem Titov | 539c1da | 2022-09-20 19:16:11 | [diff] [blame] | 23 | case Unit::kBytes: |
| 24 | return "Bytes"; |
Artem Titov | c898c82 | 2022-09-14 11:14:02 | [diff] [blame] | 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 | |
| 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 |