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

Unified Diff: components/gcm_driver/gcm_stats_recorder_impl.cc

Issue 344613003: Record GCM received data message intervals in UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed format issues. 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') | no next file » | 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 746d5e3fa801a69e5c9025c794aae8c926b996e4..0fd6fb3d411d263593af3c77cc4f2ba171401a59 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_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) {
« no previous file with comments | « components/gcm_driver/gcm_stats_recorder_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698