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

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: Addressed Jian's and Filip's comments 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
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) {

Powered by Google App Engine
This is Rietveld 408576698