Commit b73bf250 authored by juyik@chromium.org's avatar juyik@chromium.org

Record GCM received data message intervals in UMA.

BUG=386273

Review URL: https://codereview.chromium.org/344613003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283847 0039d316-1c4b-4281-b951-d872f2087c98
parent 4ff21db5
......@@ -16,6 +16,7 @@
namespace gcm {
const uint32 MAX_LOGGED_ACTIVITY_COUNT = 100;
const int64 RECEIVED_DATA_MESSAGE_BURST_LENGTH_SECONDS = 2;
namespace {
......@@ -362,6 +363,20 @@ void GCMStatsRecorderImpl::RecordDataMessageReceived(
ReceivedMessageType message_type) {
if (to_registered_app)
UMA_HISTOGRAM_COUNTS("GCM.DataMessageReceived", 1);
base::Time new_timestamp = base::Time::Now();
if (last_received_data_message_burst_start_time_.is_null()) {
last_received_data_message_burst_start_time_ = new_timestamp;
} 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());
last_received_data_message_burst_start_time_ = new_timestamp;
}
if (!is_recording_)
return;
if (!to_registered_app) {
......
......@@ -147,6 +147,8 @@ class GCMStatsRecorderImpl : public GCMStatsRecorder {
std::deque<ReceivingActivity> receiving_activities_;
std::deque<SendingActivity> sending_activities_;
base::Time last_received_data_message_burst_start_time_;
DISALLOW_COPY_AND_ASSIGN(GCMStatsRecorderImpl);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment