OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/gcm_driver/gcm_stats_recorder_impl.h" | 5 #include "components/gcm_driver/gcm_stats_recorder_impl.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 inserted_data->details = details; | 409 inserted_data->details = details; |
410 NotifyActivityRecorded(); | 410 NotifyActivityRecorded(); |
411 } | 411 } |
412 | 412 |
413 void GCMStatsRecorderImpl::RecordDataMessageReceived( | 413 void GCMStatsRecorderImpl::RecordDataMessageReceived( |
414 const std::string& app_id, | 414 const std::string& app_id, |
415 const std::string& from, | 415 const std::string& from, |
416 int message_byte_size, | 416 int message_byte_size, |
417 bool to_registered_app, | 417 bool to_registered_app, |
418 ReceivedMessageType message_type) { | 418 ReceivedMessageType message_type) { |
419 UMA_HISTOGRAM_BOOLEAN("GCM.DataMessageReceivedHasRegisteredApp", | |
420 to_registered_app); | |
421 if (to_registered_app) | |
422 UMA_HISTOGRAM_COUNTS("GCM.DataMessageReceived", 1); | |
423 | |
424 base::TimeTicks new_timestamp = base::TimeTicks::Now(); | 419 base::TimeTicks new_timestamp = base::TimeTicks::Now(); |
425 if (last_received_data_message_burst_start_time_.is_null()) { | 420 if (last_received_data_message_burst_start_time_.is_null()) { |
426 last_received_data_message_burst_start_time_ = new_timestamp; | 421 last_received_data_message_burst_start_time_ = new_timestamp; |
427 last_received_data_message_time_within_burst_ = new_timestamp; | 422 last_received_data_message_time_within_burst_ = new_timestamp; |
428 received_data_message_burst_size_ = 1; | 423 received_data_message_burst_size_ = 1; |
429 } else if ((new_timestamp - last_received_data_message_burst_start_time_) >= | 424 } else if ((new_timestamp - last_received_data_message_burst_start_time_) >= |
430 base::TimeDelta::FromSeconds( | 425 base::TimeDelta::FromSeconds( |
431 RECEIVED_DATA_MESSAGE_BURST_LENGTH_SECONDS)) { | 426 RECEIVED_DATA_MESSAGE_BURST_LENGTH_SECONDS)) { |
432 UMA_HISTOGRAM_LONG_TIMES( | 427 UMA_HISTOGRAM_LONG_TIMES( |
433 "GCM.DataMessageBurstReceivedInterval", | 428 "GCM.DataMessageBurstReceivedInterval", |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 const std::string& receiver_id, | 548 const std::string& receiver_id, |
554 const std::string& message_id) { | 549 const std::string& message_id) { |
555 UMA_HISTOGRAM_COUNTS("GCM.IncomingSendErrors", 1); | 550 UMA_HISTOGRAM_COUNTS("GCM.IncomingSendErrors", 1); |
556 if (!is_recording_) | 551 if (!is_recording_) |
557 return; | 552 return; |
558 RecordSending(app_id, receiver_id, message_id, "Received 'send error' msg", | 553 RecordSending(app_id, receiver_id, message_id, "Received 'send error' msg", |
559 std::string()); | 554 std::string()); |
560 } | 555 } |
561 | 556 |
562 } // namespace gcm | 557 } // namespace gcm |
OLD | NEW |