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

Unified Diff: components/sync/base/data_type_histogram.cc

Issue 2949923004: Reland: [Sync] Record sync memory usage in histogram broken by datatypes (Closed)
Patch Set: Fix linker error Created 3 years, 6 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 | « components/sync/base/data_type_histogram.h ('k') | components/sync/driver/data_type_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/base/data_type_histogram.cc
diff --git a/components/sync/base/data_type_histogram.cc b/components/sync/base/data_type_histogram.cc
index b8be026a135c73a5aecefd2b73b43b50f3b9111e..45f563e0adb76712f1ffc222e645ba18d62231c0 100644
--- a/components/sync/base/data_type_histogram.cc
+++ b/components/sync/base/data_type_histogram.cc
@@ -4,10 +4,23 @@
#include "components/sync/base/data_type_histogram.h"
+#include "base/metrics/histogram_functions.h"
#include "base/metrics/sparse_histogram.h"
+const char kModelTypeMemoryHistogramPrefix[] = "Sync.ModelTypeMemoryKB.";
+
void SyncRecordDatatypeBin(const std::string& name, int sample, int value) {
base::HistogramBase* histogram = base::SparseHistogram::FactoryGet(
name, base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->AddCount(sample, value);
}
+
+void SyncRecordMemoryKbHistogram(const std::string& histogram_name_prefix,
+ syncer::ModelType model_type,
+ size_t value) {
+ std::string type_string;
+ if (RealModelTypeToNotificationType(model_type, &type_string)) {
+ std::string full_histogram_name = histogram_name_prefix + type_string;
+ base::UmaHistogramCounts1M(full_histogram_name, value / 1024);
+ }
+}
« no previous file with comments | « components/sync/base/data_type_histogram.h ('k') | components/sync/driver/data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698