mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00

Bug: webrtc:13579 Change-Id: Id0e6515c63a3c9aa6d7effef7a2bd8b5ef35af09 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262245 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Ali Tofigh <alito@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Xavier Lepaul <xalep@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36904}
34 lines
1.1 KiB
Text
34 lines
1.1 KiB
Text
/*
|
|
* Copyright 2016 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#import "RTCMetrics.h"
|
|
|
|
#import "RTCMetricsSampleInfo+Private.h"
|
|
|
|
#include "rtc_base/string_utils.h"
|
|
|
|
void RTCEnableMetrics(void) {
|
|
webrtc::metrics::Enable();
|
|
}
|
|
|
|
NSArray<RTC_OBJC_TYPE(RTCMetricsSampleInfo) *> *RTCGetAndResetMetrics(void) {
|
|
std::map<std::string, std::unique_ptr<webrtc::metrics::SampleInfo>, rtc::AbslStringViewCmp>
|
|
histograms;
|
|
webrtc::metrics::GetAndReset(&histograms);
|
|
|
|
NSMutableArray *metrics =
|
|
[NSMutableArray arrayWithCapacity:histograms.size()];
|
|
for (auto const &histogram : histograms) {
|
|
RTC_OBJC_TYPE(RTCMetricsSampleInfo) *metric =
|
|
[[RTC_OBJC_TYPE(RTCMetricsSampleInfo) alloc] initWithNativeSampleInfo:*histogram.second];
|
|
[metrics addObject:metric];
|
|
}
|
|
return metrics;
|
|
}
|