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

Unified Diff: sync/engine/commit.cc

Issue 1273303002: Measuring data use of different ModelTypes in Sync Service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NewServices
Patch Set: Changing the initialization of vectors in syncer_unittest.cc Created 5 years, 4 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 | « sync/BUILD.gn ('k') | sync/engine/directory_update_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/commit.cc
diff --git a/sync/engine/commit.cc b/sync/engine/commit.cc
index f607be4c8b4e91499e2d1184c9c8d491d6b0d7ba..743996d026ba062c777f01f5a0615a506cc40b3f 100644
--- a/sync/engine/commit.cc
+++ b/sync/engine/commit.cc
@@ -4,6 +4,7 @@
#include "sync/engine/commit.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/trace_event/trace_event.h"
#include "sync/engine/commit_contribution.h"
#include "sync/engine/commit_processor.h"
@@ -13,6 +14,7 @@
#include "sync/internal_api/public/events/commit_request_event.h"
#include "sync/internal_api/public/events/commit_response_event.h"
#include "sync/sessions/sync_session.h"
+#include "sync/util/data_type_histogram.h"
namespace syncer {
@@ -70,11 +72,19 @@ Commit* Commit::Init(
enabled_types,
commit_message);
+ int previous_message_size = message.ByteSize();
// Finally, serialize all our contributions.
- for (std::map<ModelType, CommitContribution*>::const_iterator it =
- contributions.begin();
- it != contributions.end(); ++it) {
- it->second->AddToCommitMessage(&message);
+ for (const auto& contribution : contributions) {
+ contribution.second->AddToCommitMessage(&message);
+ int current_entry_size = message.ByteSize() - previous_message_size;
+ previous_message_size = message.ByteSize();
+ int local_integer_model_type = ModelTypeToHistogramInt(contribution.first);
+ if (current_entry_size > 0) {
+ SyncRecordDatatypeBin("DataUse.Sync.Upload.Bytes",
+ local_integer_model_type, current_entry_size);
+ }
+ UMA_HISTOGRAM_SPARSE_SLOWLY("DataUse.Sync.Upload.Count",
+ local_integer_model_type);
}
// If we made it this far, then we've successfully prepared a commit message.
« no previous file with comments | « sync/BUILD.gn ('k') | sync/engine/directory_update_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698