| 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..524372d67ecf7dcbf0b2c40f823e66b7e712a104 100644
|
| --- a/components/gcm_driver/gcm_stats_recorder_impl.cc
|
| +++ b/components/gcm_driver/gcm_stats_recorder_impl.cc
|
| @@ -143,7 +143,9 @@ std::string GetUnregistrationStatusString(
|
|
|
| GCMStatsRecorderImpl::GCMStatsRecorderImpl()
|
| : is_recording_(false),
|
| - delegate_(NULL) {
|
| + delegate_(NULL),
|
| + data_message_received_since_connected_(false),
|
| + received_data_message_burst_size_(0) {
|
| }
|
|
|
| GCMStatsRecorderImpl::~GCMStatsRecorderImpl() {
|
| @@ -224,6 +226,9 @@ void GCMStatsRecorderImpl::RecordConnection(
|
| }
|
|
|
| void GCMStatsRecorderImpl::RecordConnectionInitiated(const std::string& host) {
|
| + last_connection_initiation_time_ = base::TimeTicks::Now();
|
| + last_connection_success_time_ = base::TimeTicks();
|
| + data_message_received_since_connected_ = false;
|
| if (!is_recording_)
|
| return;
|
| RecordConnection("Connection initiated", host);
|
| @@ -239,6 +244,12 @@ void GCMStatsRecorderImpl::RecordConnectionDelayedDueToBackoff(
|
| }
|
|
|
| void GCMStatsRecorderImpl::RecordConnectionSuccess() {
|
| + DCHECK(!last_connection_initiation_time_.is_null());
|
| + UMA_HISTOGRAM_MEDIUM_TIMES(
|
| + "GCM.ConnectionLatency",
|
| + (base::TimeTicks::Now() - last_connection_initiation_time_));
|
| + last_connection_success_time_ = base::TimeTicks::Now();
|
| + last_connection_initiation_time_ = base::TimeTicks();
|
| if (!is_recording_)
|
| return;
|
| RecordConnection("Connection succeeded", std::string());
|
| @@ -364,25 +375,44 @@ void GCMStatsRecorderImpl::RecordDataMessageReceived(
|
| if (to_registered_app)
|
| UMA_HISTOGRAM_COUNTS("GCM.DataMessageReceived", 1);
|
|
|
| - base::Time new_timestamp = base::Time::Now();
|
| + base::TimeTicks new_timestamp = base::TimeTicks::Now();
|
| if (last_received_data_message_burst_start_time_.is_null()) {
|
| last_received_data_message_burst_start_time_ = new_timestamp;
|
| + last_received_data_message_time_within_burst_ = new_timestamp;
|
| + received_data_message_burst_size_ = 1;
|
| } else if ((new_timestamp - last_received_data_message_burst_start_time_) >=
|
| base::TimeDelta::FromSeconds(
|
| RECEIVED_DATA_MESSAGE_BURST_LENGTH_SECONDS)) {
|
| - UMA_HISTOGRAM_COUNTS(
|
| - "GCM.DataMessageBurstReceivedIntervalSeconds",
|
| - (new_timestamp - last_received_data_message_burst_start_time_)
|
| - .InSeconds());
|
| + UMA_HISTOGRAM_LONG_TIMES(
|
| + "GCM.DataMessageBurstReceivedInterval",
|
| + (new_timestamp - last_received_data_message_burst_start_time_));
|
| + UMA_HISTOGRAM_COUNTS("GCM.ReceivedDataMessageBurstSize",
|
| + received_data_message_burst_size_);
|
| last_received_data_message_burst_start_time_ = new_timestamp;
|
| + last_received_data_message_time_within_burst_ = new_timestamp;
|
| + received_data_message_burst_size_ = 1;
|
| + } else {
|
| + UMA_HISTOGRAM_TIMES(
|
| + "GCM.ReceivedDataMessageIntervalWithinBurst",
|
| + (new_timestamp - last_received_data_message_time_within_burst_));
|
| + last_received_data_message_time_within_burst_ = new_timestamp;
|
| + ++received_data_message_burst_size_;
|
| + }
|
| + if (!data_message_received_since_connected_) {
|
| + DCHECK(!last_connection_success_time_.is_null());
|
| + UMA_HISTOGRAM_TIMES("GCM.FirstReceivedDataMessageLatencyAfterConnection",
|
| + (new_timestamp - last_connection_success_time_));
|
| + data_message_received_since_connected_ = true;
|
| }
|
|
|
| if (!is_recording_)
|
| return;
|
| if (!to_registered_app) {
|
| - RecordReceiving(app_id, from, message_byte_size, "Data msg received",
|
| - to_registered_app ? std::string() :
|
| - "No such registered app found");
|
| + RecordReceiving(app_id,
|
| + from,
|
| + message_byte_size,
|
| + "Data msg received",
|
| + "No such registered app found");
|
| } else {
|
| switch(message_type) {
|
| case GCMStatsRecorderImpl::DATA_MESSAGE:
|
|
|