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

Unified Diff: google_apis/gcm/engine/rmq_store.cc

Issue 123453004: [GCM] Add connection/persistent store metric collection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 6 years, 12 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 | « google_apis/gcm/engine/mcs_client.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « google_apis/gcm/engine/mcs_client.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698