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

Side by Side Diff: base/metrics/histogram_snapshot_manager_unittest.cc

Issue 1425533011: Support "shared" histograms between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: moved Create-Result histogram to private space and added to histograms.xml Created 4 years, 10 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
« no previous file with comments | « base/metrics/histogram_snapshot_manager.cc ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/metrics/histogram_snapshot_manager.h" 5 #include "base/metrics/histogram_snapshot_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 StatisticsRecorder statistics_recorder_; 57 StatisticsRecorder statistics_recorder_;
58 HistogramFlattenerDeltaRecorder histogram_flattener_delta_recorder_; 58 HistogramFlattenerDeltaRecorder histogram_flattener_delta_recorder_;
59 HistogramSnapshotManager histogram_snapshot_manager_; 59 HistogramSnapshotManager histogram_snapshot_manager_;
60 }; 60 };
61 61
62 TEST_F(HistogramSnapshotManagerTest, PrepareDeltasNoFlagsFilter) { 62 TEST_F(HistogramSnapshotManagerTest, PrepareDeltasNoFlagsFilter) {
63 // kNoFlags filter should record all histograms. 63 // kNoFlags filter should record all histograms.
64 UMA_HISTOGRAM_ENUMERATION("UmaHistogram", 1, 2); 64 UMA_HISTOGRAM_ENUMERATION("UmaHistogram", 1, 2);
65 UMA_STABILITY_HISTOGRAM_ENUMERATION("UmaStabilityHistogram", 1, 2); 65 UMA_STABILITY_HISTOGRAM_ENUMERATION("UmaStabilityHistogram", 1, 2);
66 66
67 histogram_snapshot_manager_.PrepareDeltas(HistogramBase::kNoFlags, 67 histogram_snapshot_manager_.PrepareDeltas(
68 HistogramBase::kNoFlags); 68 StatisticsRecorder::begin(false), StatisticsRecorder::end(),
69 HistogramBase::kNoFlags, HistogramBase::kNoFlags);
69 70
70 const std::vector<std::string>& histograms = 71 const std::vector<std::string>& histograms =
71 histogram_flattener_delta_recorder_.GetRecordedDeltaHistogramNames(); 72 histogram_flattener_delta_recorder_.GetRecordedDeltaHistogramNames();
72 EXPECT_EQ(2U, histograms.size()); 73 EXPECT_EQ(2U, histograms.size());
73 EXPECT_EQ("UmaHistogram", histograms[0]); 74 EXPECT_EQ("UmaHistogram", histograms[0]);
74 EXPECT_EQ("UmaStabilityHistogram", histograms[1]); 75 EXPECT_EQ("UmaStabilityHistogram", histograms[1]);
75 } 76 }
76 77
77 TEST_F(HistogramSnapshotManagerTest, PrepareDeltasUmaHistogramFlagFilter) { 78 TEST_F(HistogramSnapshotManagerTest, PrepareDeltasUmaHistogramFlagFilter) {
78 // Note that kUmaStabilityHistogramFlag includes kUmaTargetedHistogramFlag. 79 // Note that kUmaStabilityHistogramFlag includes kUmaTargetedHistogramFlag.
79 UMA_HISTOGRAM_ENUMERATION("UmaHistogram", 1, 2); 80 UMA_HISTOGRAM_ENUMERATION("UmaHistogram", 1, 2);
80 UMA_STABILITY_HISTOGRAM_ENUMERATION("UmaStabilityHistogram", 1, 2); 81 UMA_STABILITY_HISTOGRAM_ENUMERATION("UmaStabilityHistogram", 1, 2);
81 82
82 histogram_snapshot_manager_.PrepareDeltas( 83 histogram_snapshot_manager_.PrepareDeltas(
84 StatisticsRecorder::begin(false), StatisticsRecorder::end(),
83 HistogramBase::kNoFlags, HistogramBase::kUmaTargetedHistogramFlag); 85 HistogramBase::kNoFlags, HistogramBase::kUmaTargetedHistogramFlag);
84 86
85 const std::vector<std::string>& histograms = 87 const std::vector<std::string>& histograms =
86 histogram_flattener_delta_recorder_.GetRecordedDeltaHistogramNames(); 88 histogram_flattener_delta_recorder_.GetRecordedDeltaHistogramNames();
87 EXPECT_EQ(2U, histograms.size()); 89 EXPECT_EQ(2U, histograms.size());
88 EXPECT_EQ("UmaHistogram", histograms[0]); 90 EXPECT_EQ("UmaHistogram", histograms[0]);
89 EXPECT_EQ("UmaStabilityHistogram", histograms[1]); 91 EXPECT_EQ("UmaStabilityHistogram", histograms[1]);
90 } 92 }
91 93
92 TEST_F(HistogramSnapshotManagerTest, 94 TEST_F(HistogramSnapshotManagerTest,
93 PrepareDeltasUmaStabilityHistogramFlagFilter) { 95 PrepareDeltasUmaStabilityHistogramFlagFilter) {
94 UMA_HISTOGRAM_ENUMERATION("UmaHistogram", 1, 2); 96 UMA_HISTOGRAM_ENUMERATION("UmaHistogram", 1, 2);
95 UMA_STABILITY_HISTOGRAM_ENUMERATION("UmaStabilityHistogram", 1, 2); 97 UMA_STABILITY_HISTOGRAM_ENUMERATION("UmaStabilityHistogram", 1, 2);
96 98
97 histogram_snapshot_manager_.PrepareDeltas( 99 histogram_snapshot_manager_.PrepareDeltas(
100 StatisticsRecorder::begin(false), StatisticsRecorder::end(),
98 HistogramBase::kNoFlags, HistogramBase::kUmaStabilityHistogramFlag); 101 HistogramBase::kNoFlags, HistogramBase::kUmaStabilityHistogramFlag);
99 102
100 const std::vector<std::string>& histograms = 103 const std::vector<std::string>& histograms =
101 histogram_flattener_delta_recorder_.GetRecordedDeltaHistogramNames(); 104 histogram_flattener_delta_recorder_.GetRecordedDeltaHistogramNames();
102 EXPECT_EQ(1U, histograms.size()); 105 EXPECT_EQ(1U, histograms.size());
103 EXPECT_EQ("UmaStabilityHistogram", histograms[0]); 106 EXPECT_EQ("UmaStabilityHistogram", histograms[0]);
104 } 107 }
105 108
106 } // namespace base 109 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_snapshot_manager.cc ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698