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

Side by Side 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 unified diff | Download patch
OLDNEW
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 }
OLDNEW
« 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