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

Unified Diff: base/test/statistics_delta_reader.cc

Issue 379283002: Rework UMAHistogramHelper and StatisticsDeltaReader into [Chrome]HistogramTester. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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 | « base/test/statistics_delta_reader.h ('k') | base/test/statistics_delta_reader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/statistics_delta_reader.cc
diff --git a/base/test/statistics_delta_reader.cc b/base/test/statistics_delta_reader.cc
deleted file mode 100644
index 93ce1ad647255b082fb1bca18f75e150786b729e..0000000000000000000000000000000000000000
--- a/base/test/statistics_delta_reader.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 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 "base/test/statistics_delta_reader.h"
-
-#include "base/metrics/histogram.h"
-#include "base/metrics/histogram_samples.h"
-#include "base/metrics/statistics_recorder.h"
-#include "base/stl_util.h"
-
-namespace base {
-
-StatisticsDeltaReader::StatisticsDeltaReader() {
- StatisticsRecorder::Initialize(); // Safe to call multiple times.
-
- // Record any histogram data that exists when the object is created so it can
- // be subtracted later.
- StatisticsRecorder::Histograms histograms;
- StatisticsRecorder::GetSnapshot(std::string(), &histograms);
- for (size_t i = 0; i < histograms.size(); ++i) {
- original_samples_[histograms[i]->histogram_name()] =
- histograms[i]->SnapshotSamples().release();
- }
-}
-
-StatisticsDeltaReader::~StatisticsDeltaReader() {
- STLDeleteValues(&original_samples_);
-}
-
-scoped_ptr<HistogramSamples>
- StatisticsDeltaReader::GetHistogramSamplesSinceCreation(
- const std::string& histogram_name) {
- HistogramBase* histogram = StatisticsRecorder::FindHistogram(histogram_name);
- if (!histogram)
- return scoped_ptr<HistogramSamples>();
- scoped_ptr<HistogramSamples> named_samples(histogram->SnapshotSamples());
- HistogramSamples* named_original_samples = original_samples_[histogram_name];
- if (named_original_samples)
- named_samples->Subtract(*named_original_samples);
- return named_samples.Pass();
-}
-
-} // namespace base
« no previous file with comments | « base/test/statistics_delta_reader.h ('k') | base/test/statistics_delta_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698