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

Unified Diff: components/gcm_driver/gcm_stats_recorder_impl.cc

Issue 409653004: Record latencies of connection and arrival of first message in UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « components/gcm_driver/gcm_stats_recorder_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/gcm_stats_recorder_impl.cc
diff --git a/components/gcm_driver/gcm_stats_recorder_impl.cc b/components/gcm_driver/gcm_stats_recorder_impl.cc
index 0fd6fb3d411d263593af3c77cc4f2ba171401a59..96a6228a91f94fdd7d6e022c367cf28922f9bbc2 100644
--- a/components/gcm_driver/gcm_stats_recorder_impl.cc
+++ b/components/gcm_driver/gcm_stats_recorder_impl.cc
@@ -143,7 +143,8 @@ std::string GetUnregistrationStatusString(
GCMStatsRecorderImpl::GCMStatsRecorderImpl()
: is_recording_(false),
- delegate_(NULL) {
+ delegate_(NULL),
+ data_message_received_since_connected_(false) {
}
GCMStatsRecorderImpl::~GCMStatsRecorderImpl() {
@@ -224,6 +225,8 @@ void GCMStatsRecorderImpl::RecordConnection(
}
void GCMStatsRecorderImpl::RecordConnectionInitiated(const std::string& host) {
+ last_connection_initiation_time_ = base::Time::Now();
fgorski 2014/07/22 04:08:36 make sure last_connection_success_time_ is null fo
juyik 2014/07/22 17:51:20 Done.
+ data_message_received_since_connected_ = false;
if (!is_recording_)
return;
RecordConnection("Connection initiated", host);
@@ -239,6 +242,11 @@ void GCMStatsRecorderImpl::RecordConnectionDelayedDueToBackoff(
}
void GCMStatsRecorderImpl::RecordConnectionSuccess() {
+ DCHECK(!last_connection_initiation_time_.is_null());
+ UMA_HISTOGRAM_COUNTS(
+ "GCM.ConnectionLatency",
+ (base::Time::Now() - last_connection_initiation_time_).InMilliseconds());
+ last_connection_success_time_ = base::Time::Now();
fgorski 2014/07/22 04:08:36 make sure last_connection_initiation_time_ is set
juyik 2014/07/22 17:51:20 Done.
if (!is_recording_)
return;
RecordConnection("Connection succeeded", std::string());
@@ -376,6 +384,13 @@ void GCMStatsRecorderImpl::RecordDataMessageReceived(
.InSeconds());
last_received_data_message_burst_start_time_ = new_timestamp;
}
+ if (!data_message_received_since_connected_) {
+ DCHECK(!last_connection_success_time_.is_null());
+ UMA_HISTOGRAM_COUNTS(
+ "GCM.FirstReceivedDataMessageLatencyAfterConnection",
+ (new_timestamp - last_connection_success_time_).InMilliseconds());
+ data_message_received_since_connected_ = true;
+ }
if (!is_recording_)
return;
« no previous file with comments | « components/gcm_driver/gcm_stats_recorder_impl.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698