OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/sync/base/data_type_histogram.h" | 5 #include "components/sync/base/data_type_histogram.h" |
6 | 6 |
| 7 #include "base/metrics/histogram_functions.h" |
7 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
8 | 9 |
| 10 const char kModelTypeMemoryHistogramPrefix[] = "Sync.ModelTypeMemoryKB."; |
| 11 |
9 void SyncRecordDatatypeBin(const std::string& name, int sample, int value) { | 12 void SyncRecordDatatypeBin(const std::string& name, int sample, int value) { |
10 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( | 13 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( |
11 name, base::HistogramBase::kUmaTargetedHistogramFlag); | 14 name, base::HistogramBase::kUmaTargetedHistogramFlag); |
12 histogram->AddCount(sample, value); | 15 histogram->AddCount(sample, value); |
13 } | 16 } |
| 17 |
| 18 void SyncRecordMemoryKbHistogram(const std::string& histogram_name_prefix, |
| 19 syncer::ModelType model_type, |
| 20 size_t value) { |
| 21 std::string type_string; |
| 22 if (RealModelTypeToNotificationType(model_type, &type_string)) { |
| 23 std::string full_histogram_name = histogram_name_prefix + type_string; |
| 24 base::UmaHistogramCounts1M(full_histogram_name, value / 1024); |
| 25 } |
| 26 } |
OLD | NEW |