Chromium Code Reviews| 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..163540141c9d994b8d9c97ffcc4c97159701faa9 100644 |
| --- a/components/sync/base/data_type_histogram.cc |
| +++ b/components/sync/base/data_type_histogram.cc |
| @@ -4,10 +4,27 @@ |
| #include "components/sync/base/data_type_histogram.h" |
| +#include "base/metrics/histogram.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::HistogramBase* histogram = base::Histogram::FactoryGet( |
| + full_histogram_name, 1, 500000, 50, |
| + base::HistogramBase::kUmaTargetedHistogramFlag); |
|
Ilya Sherman
2017/06/20 20:03:35
nit: Could you please use one of the convenience w
pavely
2017/06/20 20:51:39
I wanted to use UmaHistogramMemoryKB, but turned o
|
| + if (histogram) |
| + histogram->Add(value / 1024); |
| + } |
| +} |