Chromium Code Reviews| OLD | NEW |
|---|---|
| (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; | |
|
jsbell
2017/05/04 19:43:37
Hrm, actually... does this mean the histogram maxe
jsbell
2017/05/04 19:48:00
Never mind, it's per-operation. That should be ple
| |
| 16 const int kNumBuckets = 50; | |
| 17 return base::Histogram::FactoryGet( | |
| 18 name, kMin, kMax, kNumBuckets, | |
| 19 base::Histogram::kUmaTargetedHistogramFlag); | |
| 20 } | |
| 21 | |
| 22 } // anonomous namespace | |
| 23 | |
| 24 void RecordBytesWritten(const char* label, int amount) { | |
| 25 std::string name("Storage.BytesWritten."); | |
| 26 name.append(label); | |
| 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 | |
| OLD | NEW |