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

Side by Side Diff: storage/common/storage_histograms.cc

Issue 2858133002: Add uma stats to help evaluate the impact of changes to the quota allocation logic. (Closed)
Patch Set: rebase Created 3 years, 7 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "storage/common/storage_histograms.h"
6
7 #include "base/metrics/histogram_macros.h"
8
9 namespace storage {
10
11 namespace {
12
13 base::HistogramBase* GetBytesCountHistogram(const std::string& name) {
14 const int kMin = 1;
15 const int kMax = 10000000;
16 const int kNumBuckets = 50;
17 return base::Histogram::FactoryGet(
18 name, kMin, kMax, kNumBuckets,
19 base::Histogram::kUmaTargetedHistogramFlag);
Ilya Sherman 2017/05/19 00:17:14 nit: Could you use base::UmaHistogramCustomCounts
michaeln 2017/05/19 01:22:05 yes, thats much better, thank you :)
20 }
21
22 } // anonomous namespace
23
24 void RecordBytesWritten(const char* label, int amount) {
25 std::string name("Storage.BytesWritten.");
26 name.append(label);
Ilya Sherman 2017/05/19 00:17:14 Optional nit: It might be cleaner to pass the labe
michaeln 2017/05/19 01:22:05 i'd rather not have to construct a string at each
27 GetBytesCountHistogram(name)->Add(amount);
28 }
29
30 void RecordBytesRead(const char* label, int amount) {
31 std::string name("Storage.BytesRead.");
32 name.append(label);
33 GetBytesCountHistogram(name)->Add(amount);
34 }
35
36 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698