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

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

Issue 123453004: [GCM] Add connection/persistent store metric collection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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/connection_factory_impl.cc ('k') | google_apis/gcm/engine/mcs_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/engine/gcm_store_impl.cc
diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc
index 6ec56e9d9422e94e03705a5631c014a808e09ae1..3926d71002e4f665d578058ee52da6107394e384 100644
--- a/google_apis/gcm/engine/gcm_store_impl.cc
+++ b/google_apis/gcm/engine/gcm_store_impl.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"
@@ -141,6 +143,7 @@ void GCMStoreImpl::Backend::Load(const LoadCallback& callback) {
leveldb::DB* db;
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();
@@ -165,6 +168,21 @@ void GCMStoreImpl::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));
+ }
+ 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/connection_factory_impl.cc ('k') | google_apis/gcm/engine/mcs_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698