Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | #import "ARDStatsBuilder.h" |
| 12 | |
Mirko Bonadei | 19640aa | 2020-10-19 16:12:43 +0200 | [diff] [blame] | 13 | #import "sdk/objc/api/peerconnection/RTCLegacyStatsReport.h" |
| 14 | #import "sdk/objc/base/RTCMacros.h" |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 15 | |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 16 | #import "ARDUtilities.h" |
| 17 | |
Jaehyun Ko | 193f4bf | 2021-05-20 15:04:02 +0900 | [diff] [blame] | 18 | @implementation ARDStatsBuilder |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 19 | |
Jaehyun Ko | 193f4bf | 2021-05-20 15:04:02 +0900 | [diff] [blame] | 20 | @synthesize stats = _stats; |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 21 | |
| 22 | - (NSString *)statsString { |
| 23 | NSMutableString *result = [NSMutableString string]; |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 24 | |
Jaehyun Ko | 193f4bf | 2021-05-20 15:04:02 +0900 | [diff] [blame] | 25 | [result appendFormat:@"(cpu)%ld%%\n", (long)ARDGetCpuUsagePercentage()]; |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 26 | |
Jaehyun Ko | 193f4bf | 2021-05-20 15:04:02 +0900 | [diff] [blame] | 27 | for (NSString *key in _stats.statistics) { |
| 28 | RTC_OBJC_TYPE(RTCStatistics) *stat = _stats.statistics[key]; |
| 29 | [result appendFormat:@"%@\n", stat.description]; |
| 30 | } |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 31 | |
| 32 | return result; |
| 33 | } |
| 34 | |
Zeke Chin | d332580 | 2015-08-14 11:00:02 -0700 | [diff] [blame] | 35 | @end |
| 36 | |