Bug 874670 - Telemetry for call duration. r=derf

This commit is contained in:
Ben Brittain 2013-08-26 14:54:55 -04:00
parent cdea73e968
commit 8aed309d71
3 changed files with 37 additions and 0 deletions

View File

@ -36,6 +36,8 @@
#include "nsDOMDataChannelDeclarations.h"
#ifdef MOZILLA_INTERNAL_API
#include "mozilla/TimeStamp.h"
#include "mozilla/Telemetry.h"
#include "nsDOMJSUtils.h"
#include "nsIDocument.h"
#include "nsIScriptError.h"
@ -245,6 +247,9 @@ public:
// providing non-fatal warnings.
mPC->ClearSdpParseErrorMessages();
mObserver->OnSetRemoteDescriptionSuccess();
#ifdef MOZILLA_INTERNAL_API
mPC->setStartTime();
#endif
break;
case SETLOCALDESCERROR:
@ -1326,6 +1331,14 @@ PeerConnectionImpl::ShutdownMedia()
if (!mMedia)
return;
#ifdef MOZILLA_INTERNAL_API
// End of call to be recorded in Telemetry
if (!mStartTime.IsNull()){
mozilla::TimeDuration timeDelta = mozilla::TimeStamp::Now() - mStartTime;
Telemetry::Accumulate(Telemetry::WEBRTC_CALL_DURATION, timeDelta.ToSeconds());
}
#endif
// Forget the reference so that we can transfer it to
// SelfDestruct().
mMedia.forget().get()->SelfDestruct();
@ -1543,6 +1556,13 @@ PeerConnectionImpl::GetSdpParseErrors() {
return mSDPParseErrorMessages;
}
#ifdef MOZILLA_INTERNAL_API
//Telemetry set start time
void
PeerConnectionImpl::setStartTime() {
mStartTime = mozilla::TimeStamp::Now();
}
#endif
#ifdef MOZILLA_INTERNAL_API
static nsresult

View File

@ -29,6 +29,7 @@
#include "PeerConnectionMedia.h"
#ifdef MOZILLA_INTERNAL_API
#include "mozilla/TimeStamp.h"
#include "mozilla/net/DataChannel.h"
#include "VideoUtils.h"
#include "VideoSegment.h"
@ -281,6 +282,11 @@ public:
// Sets the RTC Signaling State
void SetSignalingState_m(SignalingState aSignalingState);
#ifdef MOZILLA_INTERNAL_API
// Set start time for Telemetry
void setStartTime();
#endif
private:
PeerConnectionImpl(const PeerConnectionImpl&rhs);
PeerConnectionImpl& operator=(PeerConnectionImpl);
@ -366,6 +372,11 @@ private:
nsRefPtr<PeerConnectionMedia> mMedia;
#ifdef MOZILLA_INTERNAL_API
// Start time of call used for Telemetry
mozilla::TimeStamp mStartTime;
#endif
// Temporary: used to prevent multiple audio streams or multiple video streams
// in a single PC. This is tied up in the IETF discussion around proper
// representation of multiple streams in SDP, and strongly related to

View File

@ -3502,6 +3502,12 @@
"kind": "boolean",
"description": "The number of failed ICE Connections (0) vs. number of successful ICE connections (1)."
},
"WEBRTC_CALL_DURATION":{
"kind": "exponential",
"high": "10000",
"n_buckets": "1000",
"description": "The length of time (in seconds) that a call lasted."
},
"DEVTOOLS_DEBUGGER_RDP_LOCAL_TRACERDETACH_MS": {
"kind": "exponential",
"high": "10000",