blob: e6974b1d9d3214303f0bd232c31492a904546f21 [file] [log] [blame]
Henrik Boströmb04b2a12019-12-10 14:14:09 +01001/*
2 * Copyright 2019 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
11#include "call/adaptation/resource.h"
12
13#include "rtc_base/strings/string_builder.h"
14
15namespace webrtc {
16
17namespace {
18
19const char* ResourceUsageStateToString(ResourceUsageState usage_state) {
20 switch (usage_state) {
21 case ResourceUsageState::kOveruse:
22 return "overuse";
23 case ResourceUsageState::kStable:
24 return "stable";
25 case ResourceUsageState::kUnderuse:
26 return "underuse";
27 }
28}
29
30} // namespace
31
32Resource::~Resource() {}
33
34std::string Resource::ToString() const {
35 rtc::StringBuilder sb;
36 sb << Name() << ": " << CurrentUsage() << " " << UsageUnitsOfMeasurement();
37 sb << " (" << ResourceUsageStateToString(CurrentUsageState()) << ")";
38 return sb.str();
39}
40
41} // namespace webrtc