xref: /aosp_15_r20/external/webrtc/examples/objc/AppRTCMobile/ARDStatsBuilder.m (revision d9f758449e529ab9291ac668be2861e7a55c2422)
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
13#import "sdk/objc/api/peerconnection/RTCLegacyStatsReport.h"
14#import "sdk/objc/base/RTCMacros.h"
15
16#import "ARDUtilities.h"
17
18@implementation ARDStatsBuilder
19
20@synthesize stats = _stats;
21
22- (NSString *)statsString {
23  NSMutableString *result = [NSMutableString string];
24
25  [result appendFormat:@"(cpu)%ld%%\n", (long)ARDGetCpuUsagePercentage()];
26
27  for (NSString *key in _stats.statistics) {
28    RTC_OBJC_TYPE(RTCStatistics) *stat = _stats.statistics[key];
29    [result appendFormat:@"%@\n", stat.description];
30  }
31
32  return result;
33}
34
35@end
36
37