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; |