Chromium Code Reviews| 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 746d5e3fa801a69e5c9025c794aae8c926b996e4..c0da3081a916844a92a7f7bfecdffd002bb5726f 100644 |
| --- a/components/gcm_driver/gcm_stats_recorder_impl.cc |
| +++ b/components/gcm_driver/gcm_stats_recorder_impl.cc |
| @@ -16,6 +16,7 @@ |
| namespace gcm { |
| const uint32 MAX_LOGGED_ACTIVITY_COUNT = 100; |
| +const int64 RECEIVED_DATA_MESSAGE_BUSRT_SECONDS = 2; |
|
fgorski
2014/07/16 04:11:11
s/BUSRT/BURST/
s/BURST/BURST_LENGTH/
juyik
2014/07/16 17:49:23
Done.
|
| namespace { |
| @@ -142,7 +143,8 @@ std::string GetUnregistrationStatusString( |
| GCMStatsRecorderImpl::GCMStatsRecorderImpl() |
| : is_recording_(false), |
| - delegate_(NULL) { |
| + delegate_(NULL), |
| + last_data_message_received_timestamp_(0) { |
| } |
| GCMStatsRecorderImpl::~GCMStatsRecorderImpl() { |
| @@ -362,6 +364,16 @@ void GCMStatsRecorderImpl::RecordDataMessageReceived( |
| ReceivedMessageType message_type) { |
| if (to_registered_app) |
| UMA_HISTOGRAM_COUNTS("GCM.DataMessageReceived", 1); |
| + |
| + int64 new_timestamp = base::Time::Now().ToTimeT(); |
|
fgorski
2014/07/16 04:11:11
use base::Time
juyik
2014/07/16 17:49:23
Done.
|
| + if (last_data_message_received_timestamp_ == 0) { |
| + last_data_message_received_timestamp_ = new_timestamp; |
| + } else if ((new_timestamp - last_data_message_received_timestamp_) >= |
|
fgorski
2014/07/16 04:11:11
new_timestamp - last_data_message_received_timesta
juyik
2014/07/16 17:49:23
Done.
|
| + RECEIVED_DATA_MESSAGE_BUSRT_SECONDS) { |
| + UMA_HISTOGRAM_COUNTS("GCM.DataMessageBurstReceivedIntervalSeconds", |
| + new_timestamp - last_data_message_received_timestamp_); |
|
fgorski
2014/07/16 04:11:11
(new_timestamp - last_data_message_received_timest
fgorski
2014/07/16 04:32:24
One more thing,
Remember to set last_data_message_
juyik
2014/07/16 17:49:23
Done.
juyik
2014/07/16 17:49:24
Done.
|
| + } |
| + |
| if (!is_recording_) |
| return; |
| if (!to_registered_app) { |