Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Unified Diff: webrtc/pc/rtcstatscollector.cc

Issue 2975793002: Trace stats in RTCStatsCollector. (Closed)
Patch Set: Address comments. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/rtcstatscollector.cc
diff --git a/webrtc/pc/rtcstatscollector.cc b/webrtc/pc/rtcstatscollector.cc
index f5b8c8a936c1b569826ff20d98741e62ddb5e550..0fee0b0497546edf032d51c6e7ed3bd79f45bed8 100644
--- a/webrtc/pc/rtcstatscollector.cc
+++ b/webrtc/pc/rtcstatscollector.cc
@@ -25,11 +25,19 @@
#include "webrtc/pc/webrtcsession.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/timeutils.h"
+#include "webrtc/rtc_base/trace_event.h"
namespace webrtc {
namespace {
+std::string TraceNameFromStatsTypeAndMemberName(const char* stats_type,
+ const char* member_name) {
+ std::ostringstream oss;
tommi 2017/07/12 13:56:49 please don't use stringstream for anything else th
ehmaldonado_webrtc 2017/07/12 15:27:19 What about something like this? It looks like Stri
+ oss << stats_type << '.' << member_name;
+ return oss.str();
+}
+
std::string RTCCertificateIDFromFingerprint(const std::string& fingerprint) {
return "RTCCertificate_" + fingerprint;
}
@@ -751,6 +759,17 @@ void RTCStatsCollector::AddPartialResults_s(
channel_name_pairs_.reset();
track_media_info_map_.reset();
track_to_id_.clear();
+ for (const RTCStats& stats : *cached_report_) {
+ for (const RTCStatsMemberInterface* member : stats.Members()) {
+ if (member->is_defined()) {
+ TRACE_EVENT_INSTANT2("webrtc_stats",
+ TraceNameFromStatsTypeAndMemberName(
+ stats.type(), member->name()).c_str(),
+ "value", member->ValueToString(),
+ "id", stats.id());
+ }
+ }
+ }
DeliverCachedReport();
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698