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

Unified 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: xml Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « storage/common/storage_histograms.h ('k') | third_party/leveldatabase/env_chromium.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/common/storage_histograms.cc
diff --git a/storage/common/storage_histograms.cc b/storage/common/storage_histograms.cc
new file mode 100644
index 0000000000000000000000000000000000000000..adb99124fc37f696fcbd83bcda8087d547431d54
--- /dev/null
+++ b/storage/common/storage_histograms.cc
@@ -0,0 +1,36 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "storage/common/storage_histograms.h"
+
+#include "base/metrics/histogram_macros.h"
+
+namespace storage {
+
+namespace {
+
+base::HistogramBase* GetBytesCountHistogram(const std::string& name) {
+ const int kMin = 1;
+ 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
+ const int kNumBuckets = 50;
+ return base::Histogram::FactoryGet(
+ name, kMin, kMax, kNumBuckets,
+ base::Histogram::kUmaTargetedHistogramFlag);
+}
+
+} // anonomous namespace
+
+void RecordBytesWritten(const char* label, int amount) {
+ std::string name("Storage.BytesWritten.");
+ name.append(label);
+ GetBytesCountHistogram(name)->Add(amount);
+}
+
+void RecordBytesRead(const char* label, int amount) {
+ std::string name("Storage.BytesRead.");
+ name.append(label);
+ GetBytesCountHistogram(name)->Add(amount);
+}
+
+} // namespace storage
« no previous file with comments | « storage/common/storage_histograms.h ('k') | third_party/leveldatabase/env_chromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698