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

Unified Diff: components/gcm_driver/gcm_stats_recorder_impl.cc

Issue 409653004: Record latencies of connection and arrival of first message in UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Jim's comments and merged issue 406723002 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 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:

Powered by Google App Engine
This is Rietveld 408576698