Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Connect SparseHistogram with the rest of stats system

With this CL, SparseHistogram is usable with SparseHistogram::FactoryGet.
Next step is to implement a Histogram like macro and implement WriteHTMLGraph
and WriteAscii to have a nice output.

BUG=139612


Review URL: https://chromiumcodereview.appspot.com/12207058

git-svn-id: http://src.chromium.org/svn/trunk/src/chrome/browser@185451 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
  • Loading branch information...
commit 86910939cd933cac9b9c5d5dc75ebdab6c3359ff 1 parent c83432d
kaiwang@chromium.org authored
View
8 chrome_browser_application_mac_unittest.mm
@@ -12,7 +12,7 @@
#import "chrome/browser/chrome_browser_application_mac.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::Histogram;
+using base::HistogramBase;
using base::HistogramSamples;
using base::StatisticsRecorder;
@@ -76,7 +76,7 @@ size_t BinForExceptionNamed(NSString* name) {
// We should have exactly the right number of exceptions.
StatisticsRecorder::GetSnapshot("OSX.NSException", &histograms);
EXPECT_EQ(1U, histograms.size());
- EXPECT_EQ(Histogram::kUmaTargetedHistogramFlag, histograms[0]->flags());
+ EXPECT_EQ(HistogramBase::kUmaTargetedHistogramFlag, histograms[0]->flags());
scoped_ptr<HistogramSamples> samples(histograms[0]->SnapshotSamples());
EXPECT_EQ(4, samples->GetCount(0));
@@ -85,7 +85,9 @@ size_t BinForExceptionNamed(NSString* name) {
EXPECT_EQ(2, samples->GetCount(3));
// The unknown exceptions should end up in the overflow bucket.
- EXPECT_EQ(kUnknownNSException + 1, histograms[0]->bucket_count());
+ EXPECT_TRUE(histograms[0]->HasConstructionArguments(1,
+ kUnknownNSException,
+ kUnknownNSException + 1));
EXPECT_EQ(4, samples->GetCount(kUnknownNSException));
}
View
7 extensions/api/metrics_private/metrics_apitest.cc
@@ -110,13 +110,12 @@ void ValidateHistograms(const RecordedHistogram* recorded,
const RecordedHistogram& r = recorded[i];
size_t j = 0;
for (j = 0; j < histograms.size(); ++j) {
- base::Histogram* histogram(histograms[j]);
+ base::HistogramBase* histogram(histograms[j]);
if (r.name == histogram->histogram_name()) {
EXPECT_EQ(r.type, histogram->GetHistogramType());
- EXPECT_EQ(r.min, histogram->declared_min());
- EXPECT_EQ(r.max, histogram->declared_max());
- EXPECT_EQ(r.buckets, histogram->bucket_count());
+ EXPECT_TRUE(
+ histogram->HasConstructionArguments(r.min, r.max, r.buckets));
break;
}
}
View
10 net/http_pipelining_compatibility_client_unittest.cc
@@ -25,7 +25,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::Histogram;
+using base::HistogramBase;
using base::HistogramSamples;
namespace chrome_browser_net {
@@ -210,8 +210,8 @@ class HttpPipeliningCompatibilityClientTest : public testing::Test {
private:
scoped_ptr<HistogramSamples> GetHistogram(const char* name) {
scoped_ptr<HistogramSamples> samples;
- Histogram* cached_histogram = NULL;
- Histogram* current_histogram =
+ HistogramBase* cached_histogram = NULL;
+ HistogramBase* current_histogram =
base::StatisticsRecorder::FindHistogram(name);
if (ContainsKey(histograms_, name)) {
cached_histogram = histograms_[name];
@@ -238,12 +238,12 @@ class HttpPipeliningCompatibilityClientTest : public testing::Test {
return samples.Pass();
}
- static std::map<std::string, Histogram*> histograms_;
+ static std::map<std::string, HistogramBase*> histograms_;
std::map<std::string, HistogramSamples*> original_samples_;
};
// static
-std::map<std::string, Histogram*>
+std::map<std::string, HistogramBase*>
HttpPipeliningCompatibilityClientTest::histograms_;
TEST_F(HttpPipeliningCompatibilityClientTest, Success) {
View
13 spellchecker/spellcheck_host_metrics_unittest.cc
@@ -13,7 +13,7 @@
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::Histogram;
+using base::HistogramBase;
using base::HistogramSamples;
using base::StatisticsRecorder;
@@ -37,7 +37,7 @@ class SpellcheckHostMetricsTest : public testing::Test {
TEST_F(SpellcheckHostMetricsTest, RecordEnabledStats) {
scoped_ptr<HistogramSamples> baseline;
- Histogram* histogram =
+ HistogramBase* histogram =
StatisticsRecorder::FindHistogram("SpellCheck.Enabled");
if (histogram)
baseline = histogram->SnapshotSamples();
@@ -69,7 +69,7 @@ TEST_F(SpellcheckHostMetricsTest, RecordEnabledStats) {
TEST_F(SpellcheckHostMetricsTest, CustomWordStats) {
metrics()->RecordCustomWordCountStats(123);
- Histogram* histogram =
+ HistogramBase* histogram =
StatisticsRecorder::FindHistogram("SpellCheck.CustomWords");
ASSERT_TRUE(histogram != NULL);
scoped_ptr<HistogramSamples> baseline = histogram->SnapshotSamples();
@@ -102,7 +102,7 @@ TEST_F(SpellcheckHostMetricsTest, RecordWordCountsDiscardsDuplicates) {
// Get baselines for all affected histograms.
scoped_ptr<HistogramSamples> baselines[arraysize(histogramName)];
for (size_t i = 0; i < arraysize(histogramName); ++i) {
- Histogram* histogram =
+ HistogramBase* histogram =
StatisticsRecorder::FindHistogram(histogramName[i]);
if (histogram)
baselines[i] = histogram->SnapshotSamples();
@@ -114,7 +114,7 @@ TEST_F(SpellcheckHostMetricsTest, RecordWordCountsDiscardsDuplicates) {
// Get samples for all affected histograms.
scoped_ptr<HistogramSamples> samples[arraysize(histogramName)];
for (size_t i = 0; i < arraysize(histogramName); ++i) {
- Histogram* histogram =
+ HistogramBase* histogram =
StatisticsRecorder::FindHistogram(histogramName[i]);
ASSERT_TRUE(histogram != NULL);
samples[i] = histogram->SnapshotSamples();
@@ -128,8 +128,7 @@ TEST_F(SpellcheckHostMetricsTest, RecordWordCountsDiscardsDuplicates) {
TEST_F(SpellcheckHostMetricsTest, RecordSpellingServiceStats) {
const char kMetricName[] = "SpellCheck.SpellingService.Enabled";
scoped_ptr<HistogramSamples> baseline;
- Histogram* histogram =
- StatisticsRecorder::FindHistogram(kMetricName);
+ HistogramBase* histogram = StatisticsRecorder::FindHistogram(kMetricName);
if (histogram)
baseline = histogram->SnapshotSamples();
View
7 ui/cocoa/browser/password_generation_bubble_controller_unittest.mm
@@ -14,7 +14,7 @@
#include "content/public/common/password_form.h"
#include "testing/gtest_mac.h"
-using base::Histogram;
+using base::HistogramBase;
using base::HistogramSamples;
using base::StatisticsRecorder;
@@ -34,7 +34,8 @@ virtual void SetUp() {
generator_.reset(new autofill::PasswordGenerator(20));
- Histogram* histogram = StatisticsRecorder::FindHistogram(kHistogramName);
+ HistogramBase* histogram =
+ StatisticsRecorder::FindHistogram(kHistogramName);
if (histogram)
original_ = histogram->SnapshotSamples();
@@ -65,7 +66,7 @@ void CloseController() {
}
HistogramSamples* GetHistogramSamples() {
- Histogram* histogram =
+ HistogramBase* histogram =
StatisticsRecorder::FindHistogram(kHistogramName);
if (histogram) {
current_ = histogram->SnapshotSamples();
Please sign in to comment.
Something went wrong with that request. Please try again.