Index: google_apis/gcm/engine/rmq_store.cc |
diff --git a/google_apis/gcm/engine/rmq_store.cc b/google_apis/gcm/engine/rmq_store.cc |
index 49c6809785974903cfce6a4ede966547a8f02326..894fc868fa0bdb1f15286fcda191340f479da733 100644 |
--- a/google_apis/gcm/engine/rmq_store.cc |
+++ b/google_apis/gcm/engine/rmq_store.cc |
@@ -7,9 +7,11 @@ |
#include "base/basictypes.h" |
#include "base/bind.h" |
#include "base/callback.h" |
+#include "base/file_util.h" |
#include "base/files/file_path.h" |
#include "base/logging.h" |
#include "base/message_loop/message_loop_proxy.h" |
+#include "base/metrics/histogram.h" |
#include "base/sequenced_task_runner.h" |
#include "base/stl_util.h" |
#include "base/strings/string_number_conversions.h" |
@@ -144,6 +146,7 @@ void RMQStore::Backend::Load(const LoadCallback& callback) { |
leveldb::Status status = leveldb::DB::Open(options, |
path_.AsUTF8Unsafe(), |
&db); |
+ UMA_HISTOGRAM_BOOLEAN("GCM.LoadSucceeded", status.ok()); |
if (!status.ok()) { |
LOG(ERROR) << "Failed to open database " << path_.value() |
<< ": " << status.ToString(); |
@@ -170,6 +173,20 @@ void RMQStore::Backend::Load(const LoadCallback& callback) { |
return; |
} |
+ // Only record histograms if GCM had already been set up for this device. |
+ if (result.device_android_id != 0 && result.device_security_token != 0) { |
+ int64 file_size = 0; |
+ if (base::GetFileSize(path_, &file_size)) { |
+ UMA_HISTOGRAM_COUNTS("GCM.StoreSizeKB", |
+ static_cast<int>(file_size / 1024)); |
fgorski
2014/01/02 23:45:40
That does not make a distinction between a 0 size
Nicolas Zea
2014/01/02 23:48:21
A 0 store should not happen if the store has been
|
+ } |
+ UMA_HISTOGRAM_COUNTS("GCM.RestoredOutgoingMessages", |
+ result.outgoing_messages.size()); |
+ UMA_HISTOGRAM_COUNTS("GCM.RestoredIncomingMessages", |
+ result.incoming_messages.size()); |
+ UMA_HISTOGRAM_COUNTS("GCM.NumUsers", result.user_serial_numbers.size()); |
+ } |
+ |
DVLOG(1) << "Succeeded in loading " << result.incoming_messages.size() |
<< " unacknowledged incoming messages and " |
<< result.outgoing_messages.size() |