diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 04:38:38 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 04:38:38 +0000 |
commit | 835d7c811c98f179090c57a827a9c9baa2130435 (patch) | |
tree | edcff6b2c9029c6f867f650d762837f2485d99fb | |
parent | 4b1deac7ba7e7a6bf0425e6ed4db26e0c29daa7f (diff) | |
download | chromium_src-835d7c811c98f179090c57a827a9c9baa2130435.zip chromium_src-835d7c811c98f179090c57a827a9c9baa2130435.tar.gz chromium_src-835d7c811c98f179090c57a827a9c9baa2130435.tar.bz2 |
Move Stats, histograms, and field trial into a metrics subdirectory of base and
put them in the base namespace.
TEST=it compiles
BUG=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62510 0039d316-1c4b-4281-b951-d872f2087c98
237 files changed, 938 insertions, 826 deletions
diff --git a/app/sql/diagnostic_error_delegate.h b/app/sql/diagnostic_error_delegate.h index 1c2d6e9..713c4aa 100644 --- a/app/sql/diagnostic_error_delegate.h +++ b/app/sql/diagnostic_error_delegate.h @@ -7,8 +7,8 @@ #pragma once #include "app/sql/connection.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" namespace sql { diff --git a/base/base.gyp b/base/base.gyp index 2f541ee..d6245ca 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -81,13 +81,11 @@ 'event_trace_consumer_win_unittest.cc', 'event_trace_controller_win_unittest.cc', 'event_trace_provider_win_unittest.cc', - 'field_trial_unittest.cc', 'file_descriptor_shuffle_unittest.cc', 'file_path_unittest.cc', 'file_util_unittest.cc', 'file_version_info_unittest.cc', 'gmock_unittest.cc', - 'histogram_unittest.cc', 'hmac_unittest.cc', 'id_map_unittest.cc', 'i18n/char_iterator_unittest.cc', @@ -108,6 +106,9 @@ 'message_loop_proxy_impl_unittest.cc', 'message_loop_unittest.cc', 'message_pump_glib_unittest.cc', + 'metrics/field_trial_unittest.cc', + 'metrics/histogram_unittest.cc', + 'metrics/stats_table_unittest.cc', 'non_thread_safe_unittest.cc', 'object_watcher_unittest.cc', 'observer_list_unittest.cc', @@ -135,7 +136,6 @@ 'simple_thread_unittest.cc', 'singleton_unittest.cc', 'stack_container_unittest.cc', - 'stats_table_unittest.cc', 'string_number_conversions_unittest.cc', 'string_piece_unittest.cc', 'string_split_unittest.cc', diff --git a/base/base.gypi b/base/base.gypi index bd15b00..9329ccb 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -95,8 +95,6 @@ 'gtk_util.cc', 'gtk_util.h', 'hash_tables.h', - 'histogram.cc', - 'histogram.h', 'iat_patch.cc', 'iat_patch.h', 'id_map.h', @@ -138,6 +136,12 @@ 'message_pump_default.h', 'message_pump_win.cc', 'message_pump_win.h', + 'metrics/histogram.cc', + 'metrics/histogram.h', + 'metrics/stats_counters.cc', + 'metrics/stats_counters.h', + 'metrics/stats_table.cc', + 'metrics/stats_table.h', 'mime_util.h', 'mime_util_xdg.cc', 'move.h', @@ -223,10 +227,6 @@ 'singleton.h', 'spin_wait.h', 'stack_container.h', - 'stats_counters.cc', - 'stats_counters.h', - 'stats_table.cc', - 'stats_table.h', 'stl_util-inl.h', 'string_number_conversions.cc', 'string_number_conversions.h', @@ -429,8 +429,6 @@ 'event_recorder.cc', 'event_recorder.h', 'event_recorder_stubs.cc', - 'field_trial.cc', - 'field_trial.h', 'file_descriptor_shuffle.cc', 'file_descriptor_shuffle.h', 'hmac.h', @@ -449,6 +447,8 @@ 'message_pump_libevent.h', 'message_pump_mac.h', 'message_pump_mac.mm', + 'metrics/field_trial.cc', + 'metrics/field_trial.h', 'nsimage_cache_mac.h', 'nsimage_cache_mac.mm', 'nss_util.cc', diff --git a/base/data_pack.cc b/base/data_pack.cc index 29ecf98..e01318f 100644 --- a/base/data_pack.cc +++ b/base/data_pack.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -7,8 +7,8 @@ #include <errno.h> #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/ref_counted_memory.h" #include "base/string_piece.h" diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 876b89d..dec4be6 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -13,8 +13,8 @@ #include <string> #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/pe_image.h" #include "base/scoped_comptr_win.h" #include "base/scoped_handle.h" diff --git a/base/message_loop.cc b/base/message_loop.cc index 56d1418..8f6c997b 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -7,10 +7,10 @@ #include <algorithm> #include "base/compiler_specific.h" -#include "base/histogram.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/message_pump_default.h" +#include "base/metrics/histogram.h" #include "base/thread_local.h" #if defined(OS_MACOSX) @@ -60,7 +60,7 @@ const int kNumberOfDistinctMessagesDisplayed = 1100; // in the pair (i.e., the quoted string) when printing out a histogram. #define VALUE_TO_NUMBER_AND_NAME(name) {name, #name}, -const LinearHistogram::DescriptionPair event_descriptions_[] = { +const base::LinearHistogram::DescriptionPair event_descriptions_[] = { // Provide some pretty print capability in our histogram for our internal // messages. @@ -617,9 +617,10 @@ void MessageLoop::EnableHistogrammer(bool enable) { void MessageLoop::StartHistogrammer() { if (enable_histogrammer_ && !message_histogram_.get() - && StatisticsRecorder::WasStarted()) { + && base::StatisticsRecorder::WasStarted()) { DCHECK(!thread_name_.empty()); - message_histogram_ = LinearHistogram::FactoryGet("MsgLoop:" + thread_name_, + message_histogram_ = base::LinearHistogram::FactoryGet( + "MsgLoop:" + thread_name_, kLeastNonZeroMessageId, kMaxMessageId, kNumberOfDistinctMessagesDisplayed, message_histogram_->kHexRangePrintingFlag); diff --git a/base/message_loop.h b/base/message_loop.h index 363c5d0..94e0096 100644 --- a/base/message_loop.h +++ b/base/message_loop.h @@ -27,7 +27,9 @@ #endif #endif +namespace base { class Histogram; +} // A MessageLoop is used to process events for a particular thread. There is // at most one MessageLoop instance per thread. @@ -457,7 +459,7 @@ class MessageLoop : public base::MessagePump::Delegate { std::string thread_name_; // A profiling histogram showing the counts of various messages and events. - scoped_refptr<Histogram> message_histogram_; + scoped_refptr<base::Histogram> message_histogram_; // A null terminated list which creates an incoming_queue of tasks that are // aquired under a mutex for processing on this instance's thread. These tasks diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc index fc4b2e4..d0afd51 100644 --- a/base/message_pump_win.cc +++ b/base/message_pump_win.cc @@ -6,9 +6,7 @@ #include <math.h> -#include "base/histogram.h" - -using base::Time; +#include "base/metrics/histogram.h" namespace base { diff --git a/base/field_trial.cc b/base/metrics/field_trial.cc index a3e6ac6..63d9ed5 100644 --- a/base/field_trial.cc +++ b/base/metrics/field_trial.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/field_trial.h" +#include "base/metrics/field_trial.h" #include "base/logging.h" #include "base/rand_util.h" #include "base/stringprintf.h" -using base::TimeTicks; +namespace base { // static const int FieldTrial::kNotParticipating = -1; @@ -190,3 +190,4 @@ bool FieldTrialList::StringAugmentsState(const std::string& prior_state) { return true; } +} // namespace base diff --git a/base/field_trial.h b/base/metrics/field_trial.h index deee838..348a1a7 100644 --- a/base/field_trial.h +++ b/base/metrics/field_trial.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -59,8 +59,8 @@ //------------------------------------------------------------------------------ -#ifndef BASE_FIELD_TRIAL_H_ -#define BASE_FIELD_TRIAL_H_ +#ifndef BASE_METRICS_FIELD_TRIAL_H_ +#define BASE_METRICS_FIELD_TRIAL_H_ #pragma once #include <map> @@ -70,8 +70,9 @@ #include "base/ref_counted.h" #include "base/time.h" +namespace base { -class FieldTrial : public base::RefCounted<FieldTrial> { +class FieldTrial : public RefCounted<FieldTrial> { public: typedef int Probability; // Probability type for being selected in a trial. @@ -117,7 +118,7 @@ class FieldTrial : public base::RefCounted<FieldTrial> { const std::string& trial_name); private: - friend class base::RefCounted<FieldTrial>; + friend class RefCounted<FieldTrial>; virtual ~FieldTrial(); @@ -198,11 +199,11 @@ class FieldTrialList { // of the application. In some experiments it may be useful to discount // data that is gathered before the application has reached sufficient // stability (example: most DLL have loaded, etc.) - static base::TimeTicks application_start_time() { + static TimeTicks application_start_time() { if (global_) return global_->application_start_time_; // For testing purposes only, or when we don't yet have a start time. - return base::TimeTicks::Now(); + return TimeTicks::Now(); } private: @@ -222,7 +223,7 @@ class FieldTrialList { // A helper value made availabel to users, that shows when the FieldTrialList // was initialized. Note that this is a singleton instance, and hence is a // good approximation to the start of the process. - base::TimeTicks application_start_time_; + TimeTicks application_start_time_; // Lock for access to registered_. Lock lock_; @@ -231,5 +232,7 @@ class FieldTrialList { DISALLOW_COPY_AND_ASSIGN(FieldTrialList); }; -#endif // BASE_FIELD_TRIAL_H_ +} // namespace base + +#endif // BASE_METRICS_FIELD_TRIAL_H_ diff --git a/base/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc index 94eb7fc..aea8e85 100644 --- a/base/field_trial_unittest.cc +++ b/base/metrics/field_trial_unittest.cc @@ -1,14 +1,16 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. // Test of FieldTrial class -#include "base/field_trial.h" +#include "base/metrics/field_trial.h" #include "base/stringprintf.h" #include "testing/gtest/include/gtest/gtest.h" +namespace base { + class FieldTrialTest : public testing::Test { public: FieldTrialTest() : trial_list_() { } @@ -76,7 +78,7 @@ TEST_F(FieldTrialTest, RemainingProbability) { scoped_refptr<FieldTrial> trial; int counter = 0; do { - std::string name = base::StringPrintf("trial%d", ++counter); + std::string name = StringPrintf("trial%d", ++counter); trial = new FieldTrial(name, 10); trial->AppendGroup(loser, 5); // 50% chance of not being chosen. } while (trial->group() != FieldTrial::kNotParticipating); @@ -227,3 +229,5 @@ TEST_F(FieldTrialTest, MakeName) { EXPECT_EQ("Histogram_Winner", FieldTrial::MakeName("Histogram", "Field Trial")); } + +} // namespace base diff --git a/base/histogram.cc b/base/metrics/histogram.cc index e045d81..9746e9c 100644 --- a/base/histogram.cc +++ b/base/metrics/histogram.cc @@ -7,7 +7,7 @@ // vector of numbers corresponding to each of the aggregating buckets). // See header file for details and examples. -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include <math.h> @@ -19,7 +19,7 @@ #include "base/pickle.h" #include "base/stringprintf.h" -using base::TimeDelta; +namespace base { typedef Histogram::Count Count; @@ -45,8 +45,10 @@ scoped_refptr<Histogram> Histogram::FactoryGet(const std::string& name, } scoped_refptr<Histogram> Histogram::FactoryTimeGet(const std::string& name, - base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count, - Flags flags) { + TimeDelta minimum, + TimeDelta maximum, + size_t bucket_count, + Flags flags) { return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), bucket_count, flags); } @@ -304,14 +306,15 @@ void Histogram::SnapshotSample(SampleSet* sample) const { *sample = sample_; } -bool Histogram::HasConstructorArguments(Sample minimum, Sample maximum, +bool Histogram::HasConstructorArguments(Sample minimum, + Sample maximum, size_t bucket_count) { return ((minimum == declared_min_) && (maximum == declared_max_) && (bucket_count == bucket_count_)); } -bool Histogram::HasConstructorTimeDeltaArguments(base::TimeDelta minimum, - base::TimeDelta maximum, +bool Histogram::HasConstructorTimeDeltaArguments(TimeDelta minimum, + TimeDelta maximum, size_t bucket_count) { return ((minimum.InMilliseconds() == declared_min_) && (maximum.InMilliseconds() == declared_max_) && @@ -342,10 +345,10 @@ double Histogram::GetPeakBucketSize(const SampleSet& snapshot) const { void Histogram::WriteAsciiHeader(const SampleSet& snapshot, Count sample_count, std::string* output) const { - base::StringAppendF(output, - "Histogram: %s recorded %d samples", - histogram_name().c_str(), - sample_count); + StringAppendF(output, + "Histogram: %s recorded %d samples", + histogram_name().c_str(), + sample_count); if (0 == sample_count) { DCHECK_EQ(snapshot.sum(), 0); } else { @@ -354,13 +357,12 @@ void Histogram::WriteAsciiHeader(const SampleSet& snapshot, - average * average; double standard_deviation = sqrt(variance); - base::StringAppendF(output, - ", average = %.1f, standard deviation = %.1f", - average, standard_deviation); + StringAppendF(output, + ", average = %.1f, standard deviation = %.1f", + average, standard_deviation); } - if (flags_ & ~kHexRangePrintingFlag ) - base::StringAppendF(output, " (flags = 0x%x)", - flags_ & ~kHexRangePrintingFlag); + if (flags_ & ~kHexRangePrintingFlag) + StringAppendF(output, " (flags = 0x%x)", flags_ & ~kHexRangePrintingFlag); } void Histogram::WriteAsciiBucketContext(const int64 past, @@ -372,22 +374,22 @@ void Histogram::WriteAsciiBucketContext(const int64 past, WriteAsciiBucketValue(current, scaled_sum, output); if (0 < i) { double percentage = past / scaled_sum; - base::StringAppendF(output, " {%3.1f%%}", percentage); + StringAppendF(output, " {%3.1f%%}", percentage); } } const std::string Histogram::GetAsciiBucketRange(size_t i) const { std::string result; if (kHexRangePrintingFlag & flags_) - base::StringAppendF(&result, "%#x", ranges(i)); + StringAppendF(&result, "%#x", ranges(i)); else - base::StringAppendF(&result, "%d", ranges(i)); + StringAppendF(&result, "%d", ranges(i)); return result; } void Histogram::WriteAsciiBucketValue(Count current, double scaled_sum, std::string* output) const { - base::StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); + StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); } void Histogram::WriteAsciiBucketGraph(double current_size, double max_size, @@ -600,9 +602,11 @@ bool Histogram::SampleSet::Deserialize(void** iter, const Pickle& pickle) { // buckets. //------------------------------------------------------------------------------ -scoped_refptr<Histogram> LinearHistogram::FactoryGet( - const std::string& name, Sample minimum, Sample maximum, - size_t bucket_count, Flags flags) { +scoped_refptr<Histogram> LinearHistogram::FactoryGet(const std::string& name, + Sample minimum, + Sample maximum, + size_t bucket_count, + Flags flags) { scoped_refptr<Histogram> histogram(NULL); if (minimum <= 0) @@ -622,8 +626,11 @@ scoped_refptr<Histogram> LinearHistogram::FactoryGet( } scoped_refptr<Histogram> LinearHistogram::FactoryTimeGet( - const std::string& name, base::TimeDelta minimum, base::TimeDelta maximum, - size_t bucket_count, Flags flags) { + const std::string& name, + TimeDelta minimum, + TimeDelta maximum, + size_t bucket_count, + Flags flags) { return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(), bucket_count, flags); } @@ -631,15 +638,19 @@ scoped_refptr<Histogram> LinearHistogram::FactoryTimeGet( LinearHistogram::~LinearHistogram() { } -LinearHistogram::LinearHistogram(const std::string& name, Sample minimum, - Sample maximum, size_t bucket_count) +LinearHistogram::LinearHistogram(const std::string& name, + Sample minimum, + Sample maximum, + size_t bucket_count) : Histogram(name, minimum >= 1 ? minimum : 1, maximum, bucket_count) { InitializeBucketRange(); DCHECK(ValidateBucketRanges()); } LinearHistogram::LinearHistogram(const std::string& name, - TimeDelta minimum, TimeDelta maximum, size_t bucket_count) + TimeDelta minimum, + TimeDelta maximum, + size_t bucket_count) : Histogram(name, minimum >= TimeDelta::FromMilliseconds(1) ? minimum : TimeDelta::FromMilliseconds(1), maximum, bucket_count) { @@ -727,7 +738,8 @@ BooleanHistogram::BooleanHistogram(const std::string& name) //------------------------------------------------------------------------------ scoped_refptr<Histogram> CustomHistogram::FactoryGet( - const std::string& name, const std::vector<int>& custom_ranges, + const std::string& name, + const std::vector<int>& custom_ranges, Flags flags) { scoped_refptr<Histogram> histogram(NULL); @@ -761,7 +773,7 @@ Histogram::ClassType CustomHistogram::histogram_type() const { } CustomHistogram::CustomHistogram(const std::string& name, - const std::vector<int>& custom_ranges) + const std::vector<int>& custom_ranges) : Histogram(name, custom_ranges[1], custom_ranges.back(), custom_ranges.size()) { DCHECK_GT(custom_ranges.size(), 1u); @@ -774,9 +786,8 @@ CustomHistogram::CustomHistogram(const std::string& name, void CustomHistogram::InitializeBucketRange() { DCHECK(ranges_vector_->size() <= bucket_count()); - for (size_t index = 0; index < ranges_vector_->size(); ++index) { + for (size_t index = 0; index < ranges_vector_->size(); ++index) SetBucketRange(index, (*ranges_vector_)[index]); - } } double CustomHistogram::GetBucketSize(Count current, size_t i) const { @@ -862,12 +873,10 @@ void StatisticsRecorder::WriteGraph(const std::string& query, std::string* output) { if (!histograms_) return; - if (query.length()) { - base::StringAppendF(output, "Collections of histograms for %s\n", - query.c_str()); - } else { + if (query.length()) + StringAppendF(output, "Collections of histograms for %s\n", query.c_str()); + else output->append("Collections of all histograms\n"); - } Histograms snapshot; GetSnapshot(query, &snapshot); @@ -922,3 +931,5 @@ StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL; Lock* StatisticsRecorder::lock_ = NULL; // static bool StatisticsRecorder::dump_on_exit_ = false; + +} // namespace base diff --git a/base/histogram.h b/base/metrics/histogram.h index 0287d37..20f67c2 100644 --- a/base/histogram.h +++ b/base/metrics/histogram.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -28,8 +28,8 @@ // at the low end of the histogram scale, but allows the histogram to cover a // gigantic range with the addition of very few buckets. -#ifndef BASE_HISTOGRAM_H_ -#define BASE_HISTOGRAM_H_ +#ifndef BASE_METRICS_HISTOGRAM_H_ +#define BASE_METRICS_HISTOGRAM_H_ #pragma once #include <map> @@ -41,6 +41,9 @@ #include "base/time.h" class Lock; +class Pickle; + +namespace base { //------------------------------------------------------------------------------ // Provide easy general purpose histogram in a macro, just like stats counters. @@ -60,8 +63,9 @@ class Lock; name, sample, 1, 10000, 50) #define HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) do { \ - static scoped_refptr<Histogram> counter = Histogram::FactoryGet( \ - name, min, max, bucket_count, Histogram::kNoFlags); \ + static scoped_refptr<base::Histogram> counter = \ + base::Histogram::FactoryGet(name, min, max, bucket_count, \ + base::Histogram::kNoFlags); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->Add(sample); \ } while (0) @@ -72,16 +76,18 @@ class Lock; // For folks that need real specific times, use this to select a precise range // of times you want plotted, and the number of buckets you want used. #define HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) do { \ - static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \ - name, min, max, bucket_count, Histogram::kNoFlags); \ + static scoped_refptr<base::Histogram> counter = \ + base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ + base::Histogram::kNoFlags); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->AddTime(sample); \ } while (0) // DO NOT USE THIS. It is being phased out, in favor of HISTOGRAM_CUSTOM_TIMES. #define HISTOGRAM_CLIPPED_TIMES(name, sample, min, max, bucket_count) do { \ - static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \ - name, min, max, bucket_count, Histogram::kNoFlags); \ + static scoped_refptr<base::Histogram> counter = \ + base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ + base::Histogram::kNoFlags); \ DCHECK_EQ(name, counter->histogram_name()); \ if ((sample) < (max) && counter.get()) counter->AddTime(sample); \ } while (0) @@ -90,15 +96,18 @@ class Lock; // less than boundary_value. #define HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ - static scoped_refptr<Histogram> counter = LinearHistogram::FactoryGet( \ - name, 1, boundary_value, boundary_value + 1, Histogram::kNoFlags); \ + static scoped_refptr<base::Histogram> counter = \ + base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ + boundary_value + 1, \ + base::Histogram::kNoFlags); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->Add(sample); \ } while (0) #define HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) do { \ - static scoped_refptr<Histogram> counter = CustomHistogram::FactoryGet( \ - name, custom_ranges, Histogram::kNoFlags); \ + static scoped_refptr<base::Histogram> counter = \ + base::CustomHistogram::FactoryGet(name, custom_ranges, \ + base::Histogram::kNoFlags); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->Add(sample); \ } while (0) @@ -160,16 +169,18 @@ class Lock; base::TimeDelta::FromHours(1), 50) #define UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) do { \ - static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \ - name, min, max, bucket_count, Histogram::kUmaTargetedHistogramFlag); \ + static scoped_refptr<base::Histogram> counter = \ + base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ + base::Histogram::kUmaTargetedHistogramFlag); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->AddTime(sample); \ } while (0) // DO NOT USE THIS. It is being phased out, in favor of HISTOGRAM_CUSTOM_TIMES. #define UMA_HISTOGRAM_CLIPPED_TIMES(name, sample, min, max, bucket_count) do { \ - static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \ - name, min, max, bucket_count, Histogram::kUmaTargetedHistogramFlag); \ + static scoped_refptr<base::Histogram> counter = \ + base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \ + base::Histogram::kUmaTargetedHistogramFlag); \ DCHECK_EQ(name, counter->histogram_name()); \ if ((sample) < (max) && counter.get()) counter->AddTime(sample); \ } while (0) @@ -184,8 +195,9 @@ class Lock; name, sample, 1, 10000, 50) #define UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) do { \ - static scoped_refptr<Histogram> counter = Histogram::FactoryGet( \ - name, min, max, bucket_count, Histogram::kUmaTargetedHistogramFlag); \ + static scoped_refptr<base::Histogram> counter = \ + base::Histogram::FactoryGet(name, min, max, bucket_count, \ + base::Histogram::kUmaTargetedHistogramFlag); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->Add(sample); \ } while (0) @@ -200,16 +212,17 @@ class Lock; UMA_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101) #define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ - static scoped_refptr<Histogram> counter = LinearHistogram::FactoryGet( \ - name, 1, boundary_value, boundary_value + 1, \ - Histogram::kUmaTargetedHistogramFlag); \ + static scoped_refptr<base::Histogram> counter = \ + base::LinearHistogram::FactoryGet(name, 1, boundary_value, \ + boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->Add(sample); \ } while (0) #define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) do { \ - static scoped_refptr<Histogram> counter = CustomHistogram::FactoryGet( \ - name, custom_ranges, Histogram::kUmaTargetedHistogramFlag); \ + static scoped_refptr<base::Histogram> counter = \ + base::CustomHistogram::FactoryGet(name, custom_ranges, \ + base::Histogram::kUmaTargetedHistogramFlag); \ DCHECK_EQ(name, counter->histogram_name()); \ if (counter.get()) counter->Add(sample); \ } while (0) @@ -220,7 +233,6 @@ class BooleanHistogram; class CustomHistogram; class Histogram; class LinearHistogram; -class Pickle; class Histogram : public base::RefCountedThreadSafe<Histogram> { public: @@ -319,7 +331,7 @@ class Histogram : public base::RefCountedThreadSafe<Histogram> { virtual void AddBoolean(bool value); // Accept a TimeDelta to increment. - void AddTime(base::TimeDelta time) { + void AddTime(TimeDelta time) { Add(static_cast<int>(time.InMilliseconds())); } @@ -371,16 +383,16 @@ class Histogram : public base::RefCountedThreadSafe<Histogram> { virtual bool HasConstructorArguments(Sample minimum, Sample maximum, size_t bucket_count); - virtual bool HasConstructorTimeDeltaArguments(base::TimeDelta minimum, - base::TimeDelta maximum, + virtual bool HasConstructorTimeDeltaArguments(TimeDelta minimum, + TimeDelta maximum, size_t bucket_count); protected: friend class base::RefCountedThreadSafe<Histogram>; Histogram(const std::string& name, Sample minimum, Sample maximum, size_t bucket_count); - Histogram(const std::string& name, base::TimeDelta minimum, - base::TimeDelta maximum, size_t bucket_count); + Histogram(const std::string& name, TimeDelta minimum, + TimeDelta maximum, size_t bucket_count); virtual ~Histogram(); @@ -489,7 +501,7 @@ class LinearHistogram : public Histogram { static scoped_refptr<Histogram> FactoryGet(const std::string& name, Sample minimum, Sample maximum, size_t bucket_count, Flags flags); static scoped_refptr<Histogram> FactoryTimeGet(const std::string& name, - base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count, + TimeDelta minimum, TimeDelta maximum, size_t bucket_count, Flags flags); virtual ~LinearHistogram(); @@ -498,8 +510,8 @@ class LinearHistogram : public Histogram { LinearHistogram(const std::string& name, Sample minimum, Sample maximum, size_t bucket_count); - LinearHistogram(const std::string& name, base::TimeDelta minimum, - base::TimeDelta maximum, size_t bucket_count); + LinearHistogram(const std::string& name, TimeDelta minimum, + TimeDelta maximum, size_t bucket_count); // Initialize ranges_ mapping. virtual void InitializeBucketRange(); @@ -626,4 +638,6 @@ class StatisticsRecorder { DISALLOW_COPY_AND_ASSIGN(StatisticsRecorder); }; -#endif // BASE_HISTOGRAM_H_ +} // namespace base + +#endif // BASE_METRICS_HISTOGRAM_H_ diff --git a/base/histogram_unittest.cc b/base/metrics/histogram_unittest.cc index 4637a5f..e7e3983 100644 --- a/base/histogram_unittest.cc +++ b/base/metrics/histogram_unittest.cc @@ -4,12 +4,11 @@ // Test of Histogram class -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "testing/gtest/include/gtest/gtest.h" -using base::TimeDelta; - +namespace base { namespace { class HistogramTest : public testing::Test { @@ -308,5 +307,5 @@ TEST(HistogramTest, BucketPlacementTest) { EXPECT_EQ(i + 1, sample.counts(i)); } - } // namespace +} // namespace base diff --git a/base/stats_counters.cc b/base/metrics/stats_counters.cc index 345e1d6..958f048 100644 --- a/base/stats_counters.cc +++ b/base/metrics/stats_counters.cc @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" + +namespace base { StatsCounter::StatsCounter(const std::string& name) : counter_id_(-1) { @@ -69,15 +71,15 @@ StatsCounterTimer::~StatsCounterTimer() { void StatsCounterTimer::Start() { if (!Enabled()) return; - start_time_ = base::TimeTicks::Now(); - stop_time_ = base::TimeTicks(); + start_time_ = TimeTicks::Now(); + stop_time_ = TimeTicks(); } // Stop the timer and record the results. void StatsCounterTimer::Stop() { if (!Enabled() || !Running()) return; - stop_time_ = base::TimeTicks::Now(); + stop_time_ = TimeTicks::Now(); Record(); } @@ -87,7 +89,7 @@ bool StatsCounterTimer::Running() { } // Accept a TimeDelta to increment. -void StatsCounterTimer::AddTime(base::TimeDelta time) { +void StatsCounterTimer::AddTime(TimeDelta time) { Add(static_cast<int>(time.InMilliseconds())); } @@ -96,10 +98,10 @@ void StatsCounterTimer::Record() { } -StatsRate::StatsRate(const char* name) +StatsRate::StatsRate(const std::string& name) : StatsCounterTimer(name), counter_(name), - largest_add_(std::string(" ").append(name).append("MAX").c_str()) { + largest_add_(std::string(" ").append(name).append("MAX")) { } StatsRate::~StatsRate() { @@ -111,3 +113,5 @@ void StatsRate::Add(int value) { if (value > largest_add_.value()) largest_add_.Set(value); } + +} // namespace base diff --git a/base/stats_counters.h b/base/metrics/stats_counters.h index defb9ee..2de2b73 100644 --- a/base/stats_counters.h +++ b/base/metrics/stats_counters.h @@ -1,16 +1,18 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. - -#ifndef BASE_STATS_COUNTERS_H__ -#define BASE_STATS_COUNTERS_H__ +#ifndef BASE_METRICS_STATS_COUNTERS_H_ +#define BASE_METRICS_STATS_COUNTERS_H_ #pragma once #include <string> -#include "base/stats_table.h" + +#include "base/metrics/stats_table.h" #include "base/time.h" +namespace base { + // StatsCounters are dynamically created values which can be tracked in // the StatsTable. They are designed to be lightweight to create and // easy to use. @@ -44,14 +46,14 @@ //------------------------------------------------------------------------------ // First provide generic macros, which exist in production as well as debug. #define STATS_COUNTER(name, delta) do { \ - static StatsCounter counter(name); \ + static base::StatsCounter counter(name); \ counter.Add(delta); \ } while (0) #define SIMPLE_STATS_COUNTER(name) STATS_COUNTER(name, 1) #define RATE_COUNTER(name, duration) do { \ - static StatsRate hit_count(name); \ + static base::StatsRate hit_count(name); \ hit_count.AddTime(duration); \ } while (0) @@ -142,14 +144,14 @@ class StatsCounterTimer : protected StatsCounter { bool Running(); // Accept a TimeDelta to increment. - virtual void AddTime(base::TimeDelta time); + virtual void AddTime(TimeDelta time); protected: // Compute the delta between start and stop, in milliseconds. void Record(); - base::TimeTicks start_time_; - base::TimeTicks stop_time_; + TimeTicks start_time_; + TimeTicks stop_time_; }; // A StatsRate is a timer that keeps a count of the number of intervals added so @@ -158,7 +160,7 @@ class StatsCounterTimer : protected StatsCounter { class StatsRate : public StatsCounterTimer { public: // Constructs and starts the timer. - explicit StatsRate(const char* name); + explicit StatsRate(const std::string& name); virtual ~StatsRate(); virtual void Add(int value); @@ -189,4 +191,6 @@ template<class T> class StatsScope { T& timer_; }; -#endif // BASE_STATS_COUNTERS_H__ +} // namespace base + +#endif // BASE_METRICS_STATS_COUNTERS_H_ diff --git a/base/stats_table.cc b/base/metrics/stats_table.cc index 2ef78e8..98b2f57 100644 --- a/base/stats_table.cc +++ b/base/metrics/stats_table.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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/stats_table.h" +#include "base/metrics/stats_table.h" #include "base/logging.h" #include "base/platform_thread.h" @@ -18,6 +18,8 @@ #include "errno.h" #endif +namespace base { + // The StatsTable uses a shared memory segment that is laid out as follows // // +-------------------------------------------+ @@ -84,23 +86,12 @@ inline int AlignedSize(int size) { return size + AlignOffset(size); } -// StatsTableTLSData carries the data stored in the TLS slots for the -// StatsTable. This is used so that we can properly cleanup when the -// thread exits and return the table slot. -// -// Each thread that calls RegisterThread in the StatsTable will have -// a StatsTableTLSData stored in its TLS. -struct StatsTableTLSData { - StatsTable* table; - int slot; -}; - } // namespace -// The StatsTablePrivate maintains convenience pointers into the +// The StatsTable::Private maintains convenience pointers into the // shared memory segment. Use this class to keep the data structure // clean and accessible. -class StatsTablePrivate { +class StatsTable::Private { public: // Various header information contained in the memory mapped segment. struct TableHeader { @@ -110,12 +101,12 @@ class StatsTablePrivate { int max_threads; }; - // Construct a new StatsTablePrivate based on expected size parameters, or + // Construct a new Private based on expected size parameters, or // return NULL on failure. - static StatsTablePrivate* New(const std::string& name, int size, + static Private* New(const std::string& name, int size, int max_threads, int max_counters); - base::SharedMemory* shared_memory() { return &shared_memory_; } + SharedMemory* shared_memory() { return &shared_memory_; } // Accessors for our header pointers TableHeader* table_header() const { return table_header_; } @@ -145,7 +136,7 @@ class StatsTablePrivate { private: // Constructor is private because you should use New() instead. - StatsTablePrivate() {} + Private() {} // Initializes the table on first access. Sets header values // appropriately and zeroes all counters. @@ -155,7 +146,7 @@ class StatsTablePrivate { // Initializes our in-memory pointers into a pre-created StatsTable. void ComputeMappedPointers(void* memory); - base::SharedMemory shared_memory_; + SharedMemory shared_memory_; TableHeader* table_header_; char* thread_names_table_; PlatformThreadId* thread_tid_table_; @@ -165,11 +156,11 @@ class StatsTablePrivate { }; // static -StatsTablePrivate* StatsTablePrivate::New(const std::string& name, - int size, - int max_threads, - int max_counters) { - scoped_ptr<StatsTablePrivate> priv(new StatsTablePrivate()); +StatsTable::Private* StatsTable::Private::New(const std::string& name, + int size, + int max_threads, + int max_counters) { + scoped_ptr<Private> priv(new Private()); if (!priv->shared_memory_.Create(name, false, true, size)) return NULL; if (!priv->shared_memory_.Map(size)) @@ -189,9 +180,9 @@ StatsTablePrivate* StatsTablePrivate::New(const std::string& name, return priv.release(); } -void StatsTablePrivate::InitializeTable(void* memory, int size, - int max_counters, - int max_threads) { +void StatsTable::Private::InitializeTable(void* memory, int size, + int max_counters, + int max_threads) { // Zero everything. memset(memory, 0, size); @@ -203,7 +194,7 @@ void StatsTablePrivate::InitializeTable(void* memory, int size, header->max_threads = max_threads; } -void StatsTablePrivate::ComputeMappedPointers(void* memory) { +void StatsTable::Private::ComputeMappedPointers(void* memory) { char* data = static_cast<char*>(memory); int offset = 0; @@ -238,7 +229,16 @@ void StatsTablePrivate::ComputeMappedPointers(void* memory) { DCHECK_EQ(offset, size()); } - +// TLSData carries the data stored in the TLS slots for the +// StatsTable. This is used so that we can properly cleanup when the +// thread exits and return the table slot. +// +// Each thread that calls RegisterThread in the StatsTable will have +// a TLSData stored in its TLS. +struct StatsTable::TLSData { + StatsTable* table; + int slot; +}; // We keep a singleton table which can be easily accessed. StatsTable* StatsTable::global_table_ = NULL; @@ -248,14 +248,14 @@ StatsTable::StatsTable(const std::string& name, int max_threads, : impl_(NULL), tls_index_(SlotReturnFunction) { int table_size = - AlignedSize(sizeof(StatsTablePrivate::TableHeader)) + + AlignedSize(sizeof(Private::TableHeader)) + AlignedSize((max_counters * sizeof(char) * kMaxCounterNameLength)) + AlignedSize((max_threads * sizeof(char) * kMaxThreadNameLength)) + AlignedSize(max_threads * sizeof(int)) + AlignedSize(max_threads * sizeof(int)) + AlignedSize((sizeof(int) * (max_counters * max_threads))); - impl_ = StatsTablePrivate::New(name, table_size, max_threads, max_counters); + impl_ = Private::New(name, table_size, max_threads, max_counters); if (!impl_) PLOG(ERROR) << "StatsTable did not initialize"; @@ -287,7 +287,7 @@ int StatsTable::RegisterThread(const std::string& name) { // so that two threads don't grab the same slot. Fortunately, // thread creation shouldn't happen in inner loops. { - base::SharedMemoryAutoLock lock(impl_->shared_memory()); + SharedMemoryAutoLock lock(impl_->shared_memory()); slot = FindEmptyThread(); if (!slot) { return 0; @@ -297,23 +297,23 @@ int StatsTable::RegisterThread(const std::string& name) { std::string thread_name = name; if (name.empty()) thread_name = kUnknownName; - base::strlcpy(impl_->thread_name(slot), thread_name.c_str(), - kMaxThreadNameLength); + strlcpy(impl_->thread_name(slot), thread_name.c_str(), + kMaxThreadNameLength); *(impl_->thread_tid(slot)) = PlatformThread::CurrentId(); - *(impl_->thread_pid(slot)) = base::GetCurrentProcId(); + *(impl_->thread_pid(slot)) = GetCurrentProcId(); } // Set our thread local storage. - StatsTableTLSData* data = new StatsTableTLSData; + TLSData* data = new TLSData; data->table = this; data->slot = slot; tls_index_.Set(data); return slot; } -StatsTableTLSData* StatsTable::GetTLSData() const { - StatsTableTLSData* data = - static_cast<StatsTableTLSData*>(tls_index_.Get()); +StatsTable::TLSData* StatsTable::GetTLSData() const { + TLSData* data = + static_cast<TLSData*>(tls_index_.Get()); if (!data) return NULL; @@ -326,7 +326,7 @@ void StatsTable::UnregisterThread() { UnregisterThread(GetTLSData()); } -void StatsTable::UnregisterThread(StatsTableTLSData* data) { +void StatsTable::UnregisterThread(TLSData* data) { if (!data) return; DCHECK(impl_); @@ -344,7 +344,7 @@ void StatsTable::SlotReturnFunction(void* data) { // This is called by the TLS destructor, which on some platforms has // already cleared the TLS info, so use the tls_data argument // rather than trying to fetch it ourselves. - StatsTableTLSData* tls_data = static_cast<StatsTableTLSData*>(data); + TLSData* tls_data = static_cast<TLSData*>(data); if (tls_data) { DCHECK(tls_data->table); tls_data->table->UnregisterThread(tls_data); @@ -367,7 +367,7 @@ int StatsTable::CountThreadsRegistered() const { } int StatsTable::GetSlot() const { - StatsTableTLSData* data = GetTLSData(); + TLSData* data = GetTLSData(); if (!data) return 0; return data->slot; @@ -448,7 +448,7 @@ int StatsTable::AddCounter(const std::string& name) { { // To add a counter to the shared memory, we need the // shared memory lock. - base::SharedMemoryAutoLock lock(impl_->shared_memory()); + SharedMemoryAutoLock lock(impl_->shared_memory()); // We have space, so create a new counter. counter_id = FindCounterOrEmptyRow(name); @@ -458,8 +458,8 @@ int StatsTable::AddCounter(const std::string& name) { std::string counter_name = name; if (name.empty()) counter_name = kUnknownName; - base::strlcpy(impl_->counter_name(counter_id), counter_name.c_str(), - kMaxCounterNameLength); + strlcpy(impl_->counter_name(counter_id), counter_name.c_str(), + kMaxCounterNameLength); } // now add to our in-memory cache @@ -549,3 +549,5 @@ int* StatsTable::FindLocation(const char* name) { // Now we can find the location in the table. return table->GetLocation(counter, slot); } + +} // namespace base diff --git a/base/stats_table.h b/base/metrics/stats_table.h index 3522876..e83039c 100644 --- a/base/stats_table.h +++ b/base/metrics/stats_table.h @@ -17,21 +17,18 @@ // threads/processes which can use it. // -#ifndef BASE_STATS_TABLE_H__ -#define BASE_STATS_TABLE_H__ +#ifndef BASE_METRICS_STATS_TABLE_H_ +#define BASE_METRICS_STATS_TABLE_H_ #pragma once #include <string> + #include "base/basictypes.h" #include "base/hash_tables.h" #include "base/lock.h" #include "base/thread_local_storage.h" -class StatsTablePrivate; - -namespace { -struct StatsTableTLSData; -} +namespace base { class StatsTable { public: @@ -133,6 +130,9 @@ class StatsTable { static int* FindLocation(const char *name); private: + class Private; + struct TLSData; + // Returns the space occupied by a thread in the table. Generally used // if a thread terminates but the process continues. This function // does not zero out the thread's counters. @@ -141,7 +141,7 @@ class StatsTable { // This variant expects the tls data to be passed in, so it is safe to // call from inside a posix tls destructor (see doc for pthread_key_create). - void UnregisterThread(StatsTableTLSData* tls_data); + void UnregisterThread(TLSData* tls_data); // The SlotReturnFunction is called at thread exit for each thread // which used the StatsTable. @@ -169,13 +169,15 @@ class StatsTable { // Get the TLS data for the calling thread. Returns NULL if none is // initialized. - StatsTableTLSData* GetTLSData() const; + TLSData* GetTLSData() const; - typedef base::hash_map<std::string, int> CountersMap; + typedef hash_map<std::string, int> CountersMap; + + Private* impl_; - StatsTablePrivate* impl_; // The counters_lock_ protects the counters_ hash table. Lock counters_lock_; + // The counters_ hash map is an in-memory hash of the counters. // It is used for quick lookup of counters, but is cannot be used // as a substitute for what is in the shared memory. Even though @@ -189,4 +191,6 @@ class StatsTable { DISALLOW_COPY_AND_ASSIGN(StatsTable); }; -#endif // BASE_STATS_TABLE_H__ +} // namespace base + +#endif // BASE_METRICS_STATS_TABLE_H_ diff --git a/base/stats_table_unittest.cc b/base/metrics/stats_table_unittest.cc index f926f29..c9eb9a2 100644 --- a/base/stats_table_unittest.cc +++ b/base/metrics/stats_table_unittest.cc @@ -1,17 +1,12 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. -#if defined(OS_WIN) -#include <process.h> -#include <windows.h> -#endif - #include "base/platform_thread.h" #include "base/simple_thread.h" #include "base/shared_memory.h" -#include "base/stats_table.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_table.h" +#include "base/metrics/stats_counters.h" #include "base/string_piece.h" #include "base/string_util.h" #include "base/test/multiprocess_test.h" @@ -24,7 +19,7 @@ namespace base { class StatsTableTest : public MultiProcessTest { public: void DeleteShmem(const std::string& name) { - base::SharedMemory mem; + SharedMemory mem; mem.Delete(name); } }; @@ -77,10 +72,11 @@ const std::string kCounterMixed = "CounterMixed"; // The number of thread loops that we will do. const int kThreadLoops = 100; -class StatsTableThread : public base::SimpleThread { +class StatsTableThread : public SimpleThread { public: StatsTableThread(std::string name, int id) - : base::SimpleThread(name), id_(id) { } + : SimpleThread(name), + id_(id) {} virtual void Run(); private: int id_; @@ -208,13 +204,13 @@ TEST_F(StatsTableTest, FLAKY_MultipleProcesses) { // Spawn the processes. for (int16 index = 0; index < kMaxProcs; index++) { procs[index] = this->SpawnChild("StatsTableMultipleProcessMain", false); - EXPECT_NE(base::kNullProcessHandle, procs[index]); + EXPECT_NE(kNullProcessHandle, procs[index]); } // Wait for the processes to finish. for (int index = 0; index < kMaxProcs; index++) { EXPECT_TRUE(WaitForSingleProcess(procs[index], 60 * 1000)); - base::CloseProcessHandle(procs[index]); + CloseProcessHandle(procs[index]); } StatsCounter zero_counter(kCounterZero); diff --git a/base/process_util_win.cc b/base/process_util_win.cc index 9b62b26..4b701e9 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -14,8 +14,8 @@ #include "base/command_line.h" #include "base/debug_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/scoped_handle_win.h" #include "base/scoped_ptr.h" #include "base/win_util.h" diff --git a/base/worker_pool_mac.mm b/base/worker_pool_mac.mm index b9d4192..a301bf8 100644 --- a/base/worker_pool_mac.mm +++ b/base/worker_pool_mac.mm @@ -1,16 +1,16 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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/worker_pool_mac.h" -#include "base/third_party/dynamic_annotations/dynamic_annotations.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #import "base/scoped_nsautorelease_pool.h" #include "base/scoped_ptr.h" #import "base/singleton_objc.h" #include "base/task.h" +#include "base/third_party/dynamic_annotations/dynamic_annotations.h" // When C++ exceptions are disabled, the C++ library defines |try| and // |catch| so as to allow exception-expecting C++ code to build properly when diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index c08e109..dad27d8 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -40,11 +40,11 @@ #include "base/debug_util.h" #include "base/i18n/icu_util.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" +#include "base/metrics/stats_table.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_nsautorelease_pool.h" -#include "base/stats_counters.h" -#include "base/stats_table.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -450,9 +450,9 @@ void InitializeStatsTable(base::ProcessId browser_pid, std::string statsfile = StringPrintf("%s-%u", chrome::kStatsFilename, static_cast<unsigned int>(browser_pid)); - StatsTable *stats_table = new StatsTable(statsfile, + base::StatsTable *stats_table = new base::StatsTable(statsfile, chrome::kStatsMaxThreads, chrome::kStatsMaxCounters); - StatsTable::set_current(stats_table); + base::StatsTable::set_current(stats_table); } } @@ -705,7 +705,7 @@ int ChromeMain(int argc, char** argv) { InitializeStatsTable(browser_pid, parsed_command_line); - StatsScope<StatsCounterTimer> + base::StatsScope<base::StatsCounterTimer> startup_timer(chrome::Counters::chrome_main()); // Enable the heap profiler as early as possible! diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index dd6b14c..d5faec3 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -7,7 +7,7 @@ #include <string> #include "base/basictypes.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" diff --git a/chrome/browser/autocomplete/history_contents_provider.cc b/chrome/browser/autocomplete/history_contents_provider.cc index 911f429..06e46d2 100644 --- a/chrome/browser/autocomplete/history_contents_provider.cc +++ b/chrome/browser/autocomplete/history_contents_provider.cc @@ -5,7 +5,7 @@ #include "chrome/browser/autocomplete/history_contents_provider.h" #include "base/callback.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc index 776c343..04d1c7e1 100644 --- a/chrome/browser/autocomplete/history_quick_provider.cc +++ b/chrome/browser/autocomplete/history_quick_provider.cc @@ -5,7 +5,6 @@ #include "chrome/browser/autocomplete/history_quick_provider.h" #include "base/basictypes.h" -#include "base/histogram.h" #include "base/i18n/word_iterator.h" #include "base/string_util.h" #include "base/logging.h" diff --git a/chrome/browser/autocomplete/history_url_provider.cc b/chrome/browser/autocomplete/history_url_provider.cc index 234bed4..f86e5db 100644 --- a/chrome/browser/autocomplete/history_url_provider.cc +++ b/chrome/browser/autocomplete/history_url_provider.cc @@ -7,8 +7,8 @@ #include <algorithm> #include "base/basictypes.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/history/history.h" diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc index bc47eca..01b49eb 100644 --- a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc +++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc @@ -6,7 +6,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "chrome/browser/autofill/autofill_cc_infobar.h" #include "chrome/browser/autofill/autofill_manager.h" #include "chrome/browser/browser_list.h" diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc index 9230b86..abdf099 100644 --- a/chrome/browser/automation/automation_resource_message_filter.cc +++ b/chrome/browser/automation/automation_resource_message_filter.cc @@ -4,8 +4,8 @@ #include "chrome/browser/automation/automation_resource_message_filter.h" -#include "base/histogram.h" #include "base/path_service.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "chrome/browser/automation/url_request_automation_job.h" #include "chrome/browser/browser_thread.h" @@ -396,7 +396,7 @@ void AutomationResourceMessageFilter::OnGetFilteredInetHitCount( void AutomationResourceMessageFilter::OnRecordHistograms( const std::vector<std::string>& histogram_list) { for (size_t index = 0; index < histogram_list.size(); ++index) { - Histogram::DeserializeHistogramInfo(histogram_list[index]); + base::Histogram::DeserializeHistogramInfo(histogram_list[index]); } } diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index 4debf38..6cbe433 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -6,7 +6,7 @@ #include "base/compiler_specific.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/browser/bookmarks/bookmark_codec.h" #include "chrome/browser/bookmarks/bookmark_model.h" diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index c8f3ceb..c4f0b2a 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -16,8 +16,8 @@ #include "app/l10n_util.h" #include "base/base_paths.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/string_util.h" #include "base/thread.h" diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 03afaaf..9a75983 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -12,11 +12,11 @@ #include "app/resource_bundle.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/i18n/number_formatting.h" +#include "base/metrics/histogram.h" +#include "base/metrics/stats_table.h" #include "base/path_service.h" #include "base/platform_thread.h" -#include "base/stats_table.h" #include "base/stringprintf.h" #include "base/string_number_conversions.h" #include "base/string_piece.h" @@ -403,7 +403,7 @@ std::string AboutHistograms(const std::string& query) { current_synchronizer->FetchRendererHistogramsSynchronously(wait_time); std::string data; - StatisticsRecorder::WriteHTMLGraph(query, &data); + base::StatisticsRecorder::WriteHTMLGraph(query, &data); return data; } @@ -428,7 +428,7 @@ std::string AboutStats() { // stats computations across runs. static DictionaryValue root; - StatsTable* table = StatsTable::current(); + base::StatsTable* table = base::StatsTable::current(); if (!table) return std::string(); diff --git a/chrome/browser/browser_child_process_host.cc b/chrome/browser/browser_child_process_host.cc index 2c8ba34..a317f26 100644 --- a/chrome/browser/browser_child_process_host.cc +++ b/chrome/browser/browser_child_process_host.cc @@ -6,8 +6,8 @@ #include "base/command_line.h" #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/singleton.h" diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 6e5cd9a..e8d3945 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -11,7 +11,7 @@ #include "base/environment.h" #include "base/event_recorder.h" #include "base/file_path.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/scoped_ptr.h" #include "base/string_number_conversions.h" @@ -490,7 +490,7 @@ bool BrowserInit::LaunchWithProfile::Launch(Profile* profile, chrome_browser_net::EnablePredictor(false); if (command_line_.HasSwitch(switches::kDumpHistogramsOnExit)) - StatisticsRecorder::set_dump_on_exit(true); + base::StatisticsRecorder::set_dump_on_exit(true); if (command_line_.HasSwitch(switches::kRemoteShellPort)) { std::string port_str = diff --git a/chrome/browser/browser_list.cc b/chrome/browser/browser_list.cc index 0803db5..2652c1a 100644 --- a/chrome/browser/browser_list.cc +++ b/chrome/browser/browser_list.cc @@ -4,9 +4,9 @@ #include "chrome/browser/browser_list.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_shutdown.h" diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 7dce691..0cbcc66 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -14,10 +14,10 @@ #include "app/system_monitor.h" #include "base/at_exit.h" #include "base/command_line.h" -#include "base/field_trial.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/scoped_nsautorelease_pool.h" #include "base/path_service.h" #include "base/platform_thread.h" @@ -206,11 +206,11 @@ void BrowserMainParts::EarlyInitialization() { // on browsing. Too large a value might cause us to run into SYN flood detection // mechanisms. void BrowserMainParts::ConnectionFieldTrial() { - const FieldTrial::Probability kConnectDivisor = 100; - const FieldTrial::Probability kConnectProbability = 1; // 1% probability + const base::FieldTrial::Probability kConnectDivisor = 100; + const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. - scoped_refptr<FieldTrial> connect_trial = - new FieldTrial("ConnCountImpact", kConnectDivisor); + scoped_refptr<base::FieldTrial> connect_trial = + new base::FieldTrial("ConnCountImpact", kConnectDivisor); const int connect_5 = connect_trial->AppendGroup("conn_count_5", kConnectProbability); @@ -225,7 +225,7 @@ void BrowserMainParts::ConnectionFieldTrial() { // probability value will be assigned to all the other groups, while // preserving the remainder of the of probability space to the default value. const int connect_6 = connect_trial->AppendGroup("conn_count_6", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); const int connect_trial_group = connect_trial->group(); @@ -250,12 +250,12 @@ void BrowserMainParts::ConnectionFieldTrial() { // result in more ERR_CONNECT_RESETs, requiring one RTT to receive the RST // packet and possibly another RTT to re-establish the connection. void BrowserMainParts::SocketTimeoutFieldTrial() { - const FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; + const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; // 1% probability for all experimental settings. - const FieldTrial::Probability kSocketTimeoutProbability = 1; + const base::FieldTrial::Probability kSocketTimeoutProbability = 1; - scoped_refptr<FieldTrial> socket_timeout_trial = - new FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor); + scoped_refptr<base::FieldTrial> socket_timeout_trial = + new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor); const int socket_timeout_5 = socket_timeout_trial->AppendGroup("idle_timeout_5", @@ -268,7 +268,7 @@ void BrowserMainParts::SocketTimeoutFieldTrial() { kSocketTimeoutProbability); const int socket_timeout_60 = socket_timeout_trial->AppendGroup("idle_timeout_60", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); const int idle_to_trial_group = socket_timeout_trial->group(); @@ -286,12 +286,12 @@ void BrowserMainParts::SocketTimeoutFieldTrial() { } void BrowserMainParts::ProxyConnectionsFieldTrial() { - const FieldTrial::Probability kProxyConnectionsDivisor = 100; + const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; // 25% probability - const FieldTrial::Probability kProxyConnectionProbability = 1; + const base::FieldTrial::Probability kProxyConnectionProbability = 1; - scoped_refptr<FieldTrial> proxy_connection_trial = - new FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor); + scoped_refptr<base::FieldTrial> proxy_connection_trial = + new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor); // The number of max sockets per group cannot be greater than the max number // of sockets per proxy server. We tried using 8, and it can easily @@ -309,7 +309,7 @@ void BrowserMainParts::ProxyConnectionsFieldTrial() { // which allows for cleaner and quicker changes down the line if needed. const int proxy_connections_32 = proxy_connection_trial->AppendGroup("proxy_connections_32", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); const int proxy_connections_trial_group = proxy_connection_trial->group(); @@ -338,15 +338,16 @@ void BrowserMainParts::SpdyFieldTrial() { parsed_command_line().GetSwitchValueASCII(switches::kUseSpdy); net::HttpNetworkLayer::EnableSpdy(spdy_mode); } else { - const FieldTrial::Probability kSpdyDivisor = 100; - FieldTrial::Probability npnhttp_probability = 10; // 10% to preclude SPDY. - scoped_refptr<FieldTrial> trial = - new FieldTrial("SpdyImpact", kSpdyDivisor); + const base::FieldTrial::Probability kSpdyDivisor = 100; + // 10% to preclude SPDY. + base::FieldTrial::Probability npnhttp_probability = 10; + scoped_refptr<base::FieldTrial> trial = + new base::FieldTrial("SpdyImpact", kSpdyDivisor); // npn with only http support, no spdy. int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); // npn with spdy support. int npn_spdy_grp = trial->AppendGroup("npn_with_spdy", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); int trial_grp = trial->group(); if (trial_grp == npn_http_grp) { is_spdy_trial = true; @@ -368,14 +369,14 @@ void BrowserMainParts::PrefetchFieldTrial() { else if (parsed_command_line().HasSwitch(switches::kDisableContentPrefetch)) { ResourceDispatcherHost::set_is_prefetch_enabled(false); } else { - const FieldTrial::Probability kPrefetchDivisor = 1000; - const FieldTrial::Probability no_prefetch_probability = 500; - scoped_refptr<FieldTrial> trial = - new FieldTrial("Prefetch", kPrefetchDivisor); + const base::FieldTrial::Probability kPrefetchDivisor = 1000; + const base::FieldTrial::Probability no_prefetch_probability = 500; + scoped_refptr<base::FieldTrial> trial = + new base::FieldTrial("Prefetch", kPrefetchDivisor); trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); const int yes_prefetch_grp = trial->AppendGroup("ContentPrefetchEnabled", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); const int trial_grp = trial->group(); ResourceDispatcherHost::set_is_prefetch_enabled( trial_grp == yes_prefetch_grp); @@ -394,16 +395,17 @@ void BrowserMainParts::ConnectBackupJobsFieldTrial() { net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( false); } else { - const FieldTrial::Probability kConnectBackupJobsDivisor = 100; - // 50% probability. - const FieldTrial::Probability kConnectBackupJobsProbability = 1; // 1%. - scoped_refptr<FieldTrial> trial = new FieldTrial("ConnnectBackupJobs", - kConnectBackupJobsDivisor); + const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; + // 1% probability. + const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; + scoped_refptr<base::FieldTrial> trial = + new base::FieldTrial("ConnnectBackupJobs", + kConnectBackupJobsDivisor); trial->AppendGroup("ConnectBackupJobsDisabled", kConnectBackupJobsProbability); const int connect_backup_jobs_enabled = trial->AppendGroup("ConnectBackupJobsEnabled", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); const int trial_group = trial->group(); net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( trial_group == connect_backup_jobs_enabled); @@ -942,7 +944,7 @@ int BrowserMain(const MainFunctionParams& parameters) { InitializeBrokerServices(parameters, parsed_command_line); // Initialize histogram statistics gathering system. - StatisticsRecorder statistics; + base::StatisticsRecorder statistics; PrefService* local_state = InitializeLocalState(parsed_command_line, is_first_run); @@ -1354,10 +1356,10 @@ int BrowserMain(const MainFunctionParams& parameters) { // Perform A/B test to measure global impact of SDCH support. // Set up a field trial to see what disabling SDCH does to latency of page // layout globally. - FieldTrial::Probability kSDCH_DIVISOR = 1000; - FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% probability. - scoped_refptr<FieldTrial> sdch_trial = - new FieldTrial("GlobalSdch", kSDCH_DIVISOR); + base::FieldTrial::Probability kSDCH_DIVISOR = 1000; + base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. + scoped_refptr<base::FieldTrial> sdch_trial = + new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR); // Use default of "" so that all domains are supported. std::string sdch_supported_domain(""); @@ -1368,7 +1370,7 @@ int BrowserMain(const MainFunctionParams& parameters) { sdch_trial->AppendGroup("global_disable_sdch", kSDCH_DISABLE_PROBABILITY); int sdch_enabled = sdch_trial->AppendGroup("global_enable_sdch", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); if (sdch_enabled != sdch_trial->group()) sdch_supported_domain = "never_enabled_sdch_for_any_domain"; } diff --git a/chrome/browser/browser_main.h b/chrome/browser/browser_main.h index 033fb1b..9154a4c 100644 --- a/chrome/browser/browser_main.h +++ b/chrome/browser/browser_main.h @@ -7,7 +7,7 @@ #pragma once #include "base/basictypes.h" -#include "base/field_trial.h" +#include "base/metrics/field_trial.h" #include "base/scoped_ptr.h" #include "base/tracked_objects.h" @@ -140,7 +140,7 @@ class BrowserMainParts { #endif // Statistical testing infrastructure for the entire browser. - FieldTrialList field_trial_; + base::FieldTrialList field_trial_; // Members initialized in |MainMessageLoopStart()| --------------------------- scoped_ptr<MessageLoop> main_message_loop_; diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index f9cc83c..9e7d411 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -10,7 +10,7 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/string_number_conversions.h" diff --git a/chrome/browser/browser_trial.h b/chrome/browser/browser_trial.h index 9af5a27..c1a3290 100644 --- a/chrome/browser/browser_trial.h +++ b/chrome/browser/browser_trial.h @@ -9,7 +9,7 @@ #define CHROME_BROWSER_BROWSER_TRIAL_H_ #pragma once -#include "base/field_trial.h" +#include "base/basictypes.h" // Currently we use this as a name space, to hold static shared constants which // define current and past trials. diff --git a/chrome/browser/chrome_browser_application_mac.mm b/chrome/browser/chrome_browser_application_mac.mm index f696e96..b4bb7cb 100644 --- a/chrome/browser/chrome_browser_application_mac.mm +++ b/chrome/browser/chrome_browser_application_mac.mm @@ -4,8 +4,8 @@ #import "chrome/browser/chrome_browser_application_mac.h" -#import "base/histogram.h" #import "base/logging.h" +#import "base/metrics/histogram.h" #import "base/scoped_nsobject.h" #import "base/sys_string_conversions.h" #import "chrome/app/breakpad_mac.h" diff --git a/chrome/browser/chrome_browser_application_mac_unittest.mm b/chrome/browser/chrome_browser_application_mac_unittest.mm index d5f26c5..c5a589c 100644 --- a/chrome/browser/chrome_browser_application_mac_unittest.mm +++ b/chrome/browser/chrome_browser_application_mac_unittest.mm @@ -4,10 +4,13 @@ #import <Cocoa/Cocoa.h> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #import "chrome/browser/chrome_browser_application_mac.h" #include "testing/gtest/include/gtest/gtest.h" +using base::Histogram; +using base::StatisticsRecorder; + namespace chrome_browser_application_mac { // Generate an NSException with the given name. diff --git a/chrome/browser/chrome_plugin_host.cc b/chrome/browser/chrome_plugin_host.cc index 3b48914..76d4756 100644 --- a/chrome/browser/chrome_plugin_host.cc +++ b/chrome/browser/chrome_plugin_host.cc @@ -10,8 +10,8 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/perftimer.h" #include "base/singleton.h" diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index 8a52e39..97172be 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -9,8 +9,8 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/process_util.h" #include "base/singleton.h" #include "base/string_number_conversions.h" diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc index 6224f22..73e24d8 100644 --- a/chrome/browser/chromeos/external_metrics.cc +++ b/chrome/browser/chromeos/external_metrics.cc @@ -15,7 +15,7 @@ #include "base/basictypes.h" #include "base/eintr_wrapper.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/perftimer.h" #include "base/time.h" #include "chrome/browser/browser_thread.h" @@ -91,8 +91,8 @@ void ExternalMetrics::RecordHistogram(const char* histogram_data) { } // Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram // instance and thus only work if |name| is constant. - scoped_refptr<Histogram> counter = Histogram::FactoryGet( - name, min, max, nbuckets, Histogram::kUmaTargetedHistogramFlag); + scoped_refptr<base::Histogram> counter = base::Histogram::FactoryGet( + name, min, max, nbuckets, base::Histogram::kUmaTargetedHistogramFlag); counter->Add(sample); } @@ -106,8 +106,8 @@ void ExternalMetrics::RecordLinearHistogram(const char* histogram_data) { } // Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram // instance and thus only work if |name| is constant. - scoped_refptr<Histogram> counter = LinearHistogram::FactoryGet( - name, 1, max, max + 1, Histogram::kUmaTargetedHistogramFlag); + scoped_refptr<base::Histogram> counter = base::LinearHistogram::FactoryGet( + name, 1, max, max + 1, base::Histogram::kUmaTargetedHistogramFlag); counter->Add(sample); } diff --git a/chrome/browser/chromeos/external_protocol_dialog.cc b/chrome/browser/chromeos/external_protocol_dialog.cc index e0d799f..38d1cdf 100644 --- a/chrome/browser/chromeos/external_protocol_dialog.cc +++ b/chrome/browser/chromeos/external_protocol_dialog.cc @@ -6,7 +6,7 @@ #include "app/l10n_util.h" #include "app/message_box_flags.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/external_protocol_handler.h" diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc index 8d9f4dd..c3b88d5 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.cc +++ b/chrome/browser/chromeos/offline/offline_load_page.cc @@ -6,8 +6,8 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/histogram.h" #include "base/i18n/rtl.h" +#include "base/metrics/histogram.h" #include "base/string_piece.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/cocoa/download_item_controller.mm b/chrome/browser/cocoa/download_item_controller.mm index cbd18fc..a5288c2 100644 --- a/chrome/browser/cocoa/download_item_controller.mm +++ b/chrome/browser/cocoa/download_item_controller.mm @@ -7,8 +7,8 @@ #include "app/l10n_util_mac.h" #include "app/resource_bundle.h" #include "app/text_elider.h" -#include "base/histogram.h" #include "base/mac_util.h" +#include "base/metrics/histogram.h" #include "base/string16.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" diff --git a/chrome/browser/cocoa/external_protocol_dialog.mm b/chrome/browser/cocoa/external_protocol_dialog.mm index 3a7849a..0513ae0 100644 --- a/chrome/browser/cocoa/external_protocol_dialog.mm +++ b/chrome/browser/cocoa/external_protocol_dialog.mm @@ -5,8 +5,8 @@ #import "chrome/browser/cocoa/external_protocol_dialog.h" #include "app/l10n_util_mac.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/cocoa/objc_method_swizzle.mm b/chrome/browser/cocoa/objc_method_swizzle.mm index 4471efc..433bc66 100644 --- a/chrome/browser/cocoa/objc_method_swizzle.mm +++ b/chrome/browser/cocoa/objc_method_swizzle.mm @@ -4,7 +4,6 @@ #import "chrome/browser/cocoa/objc_method_swizzle.h" -#import "base/histogram.h" #import "base/logging.h" #import "base/scoped_nsobject.h" #import "chrome/app/breakpad_mac.h" diff --git a/chrome/browser/cocoa/translate/translate_infobar_base.mm b/chrome/browser/cocoa/translate/translate_infobar_base.mm index b396de8..bdc34f0 100644 --- a/chrome/browser/cocoa/translate/translate_infobar_base.mm +++ b/chrome/browser/cocoa/translate/translate_infobar_base.mm @@ -6,9 +6,9 @@ #import "chrome/browser/cocoa/translate/translate_infobar_base.h" #include "app/l10n_util.h" -#include "base/histogram.h" -#include "base/logging.h" // for NOTREACHED() +#include "base/logging.h" #include "base/mac_util.h" +#include "base/metrics/histogram.h" #include "base/sys_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" #import "chrome/browser/cocoa/hover_close_button.h" diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.cc b/chrome/browser/diagnostics/sqlite_diagnostics.cc index 15c758a..5030301 100644 --- a/chrome/browser/diagnostics/sqlite_diagnostics.cc +++ b/chrome/browser/diagnostics/sqlite_diagnostics.cc @@ -8,8 +8,8 @@ #include "app/sql/diagnostic_error_delegate.h" #include "app/sql/statement.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/singleton.h" #include "base/string_number_conversions.h" diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index e96f1e6..e5b5a12 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -11,8 +11,8 @@ #include "app/l10n_util.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/i18n/rtl.h" +#include "base/metrics/histogram.h" #include "base/singleton.h" #include "base/string_number_conversions.h" #include "base/thread.h" diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index f91c259..b35d58c 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -9,9 +9,9 @@ #include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/histogram.h" #include "base/message_loop.h" #include "base/singleton.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" diff --git a/chrome/browser/extensions/extension_metrics_apitest.cc b/chrome/browser/extensions/extension_metrics_apitest.cc index 5a91e9f..ee4761c 100644 --- a/chrome/browser/extensions/extension_metrics_apitest.cc +++ b/chrome/browser/extensions/extension_metrics_apitest.cc @@ -4,7 +4,7 @@ #include <map> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/common/chrome_switches.h" @@ -29,20 +29,20 @@ struct RecordedUserAction { // updated. struct RecordedHistogram { const char* name; // base name of metric without extension id. - Histogram::ClassType type; + base::Histogram::ClassType type; int min; int max; size_t buckets; } g_histograms[] = { - {"test.h.1", Histogram::HISTOGRAM, 1, 100, 50}, // custom - {"test.h.2", Histogram::LINEAR_HISTOGRAM, 1, 200, 50}, // custom - {"test.h.3", Histogram::LINEAR_HISTOGRAM, 1, 101, 102}, // percentage - {"test.time", Histogram::HISTOGRAM, 1, 10000, 50}, - {"test.medium.time", Histogram::HISTOGRAM, 1, 180000, 50}, - {"test.long.time", Histogram::HISTOGRAM, 1, 3600000, 50}, - {"test.count", Histogram::HISTOGRAM, 1, 1000000, 50}, - {"test.medium.count", Histogram::HISTOGRAM, 1, 10000, 50}, - {"test.small.count", Histogram::HISTOGRAM, 1, 100, 50}, + {"test.h.1", base::Histogram::HISTOGRAM, 1, 100, 50}, // custom + {"test.h.2", base::Histogram::LINEAR_HISTOGRAM, 1, 200, 50}, // custom + {"test.h.3", base::Histogram::LINEAR_HISTOGRAM, 1, 101, 102}, // percentage + {"test.time", base::Histogram::HISTOGRAM, 1, 10000, 50}, + {"test.medium.time", base::Histogram::HISTOGRAM, 1, 180000, 50}, + {"test.long.time", base::Histogram::HISTOGRAM, 1, 3600000, 50}, + {"test.count", base::Histogram::HISTOGRAM, 1, 1000000, 50}, + {"test.medium.count", base::Histogram::HISTOGRAM, 1, 10000, 50}, + {"test.small.count", base::Histogram::HISTOGRAM, 1, 100, 50}, }; // Build the full name of a metrics for the given extension. Each metric @@ -110,8 +110,8 @@ void UserActionObserver::ValidateUserActions(const Extension* extension, void ValidateHistograms(const Extension* extension, const RecordedHistogram* recorded, int count) { - StatisticsRecorder::Histograms histograms; - StatisticsRecorder::GetHistograms(&histograms); + base::StatisticsRecorder::Histograms histograms; + base::StatisticsRecorder::GetHistograms(&histograms); // Code other than the tests tun here will record some histogram values, but // we will ignore those. This function validates that all the histogram we @@ -123,7 +123,7 @@ void ValidateHistograms(const Extension* extension, size_t j = 0; for (j = 0; j < histograms.size(); ++j) { - scoped_refptr<Histogram> histogram(histograms[j]); + scoped_refptr<base::Histogram> histogram(histograms[j]); if (name == histogram->histogram_name()) { EXPECT_EQ(r.type, histogram->histogram_type()); diff --git a/chrome/browser/extensions/extension_metrics_module.cc b/chrome/browser/extensions/extension_metrics_module.cc index 0f0ab14..a1815f2 100644 --- a/chrome/browser/extensions/extension_metrics_module.cc +++ b/chrome/browser/extensions/extension_metrics_module.cc @@ -4,11 +4,14 @@ #include "chrome/browser/extensions/extension_metrics_module.h" +#include "base/metrics/histogram.h" #include "base/values.h" -#include "base/histogram.h" #include "chrome/common/extensions/extension.h" #include "chrome/browser/metrics/user_metrics.h" +using base::Histogram; +using base::LinearHistogram; + namespace { // Build the full name of a metrics for the given extension. Each metric diff --git a/chrome/browser/extensions/extension_metrics_module.h b/chrome/browser/extensions/extension_metrics_module.h index f7a91dc..523acc0 100644 --- a/chrome/browser/extensions/extension_metrics_module.h +++ b/chrome/browser/extensions/extension_metrics_module.h @@ -8,7 +8,7 @@ #include <string> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "chrome/browser/extensions/extension_function.h" class MetricsRecordUserActionFunction : public SyncExtensionFunction { @@ -19,8 +19,9 @@ class MetricsRecordUserActionFunction : public SyncExtensionFunction { class MetricsHistogramHelperFunction : public SyncExtensionFunction { protected: bool GetNameAndSample(std::string* name, int* sample); - virtual bool RecordValue(const std::string& name, Histogram::ClassType type, - int min, int max, size_t buckets, int sample); + virtual bool RecordValue(const std::string& name, + base::Histogram::ClassType type, + int min, int max, size_t buckets, int sample); }; class MetricsRecordValueFunction : public MetricsHistogramHelperFunction { diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index da669c6..52a4b4fe 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -9,7 +9,7 @@ #include "base/logging.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/sha2.h" #include "base/stl_util-inl.h" diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 693779b7..3c65525 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/command_line.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string16.h" #include "base/string_number_conversions.h" diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc index 5da78ca1..63d3093 100644 --- a/chrome/browser/gtk/download_item_gtk.cc +++ b/chrome/browser/gtk/download_item_gtk.cc @@ -10,7 +10,7 @@ #include "app/text_elider.h" #include "base/basictypes.h" #include "base/callback.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/gtk/external_protocol_dialog_gtk.cc b/chrome/browser/gtk/external_protocol_dialog_gtk.cc index 2819fbb..f59a26e 100644 --- a/chrome/browser/gtk/external_protocol_dialog_gtk.cc +++ b/chrome/browser/gtk/external_protocol_dialog_gtk.cc @@ -9,7 +9,7 @@ #include <string> #include "app/l10n_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 286ddb5..4b37ccd 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -9,7 +9,7 @@ #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/scoped_vector.h" diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc index 4661814..56ee054 100644 --- a/chrome/browser/history/history_database.cc +++ b/chrome/browser/history/history_database.cc @@ -13,7 +13,7 @@ #if defined(OS_MACOSX) #include "base/mac_util.h" #endif -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/string_util.h" #include "chrome/browser/diagnostics/sqlite_diagnostics.h" diff --git a/chrome/browser/history/in_memory_database.cc b/chrome/browser/history/in_memory_database.cc index a6a9a6f..3227a7a 100644 --- a/chrome/browser/history/in_memory_database.cc +++ b/chrome/browser/history/in_memory_database.cc @@ -5,8 +5,8 @@ #include "chrome/browser/history/in_memory_database.h" #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "build/build_config.h" diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc index 7084aa1..6827a78 100644 --- a/chrome/browser/history/in_memory_history_backend.cc +++ b/chrome/browser/history/in_memory_history_backend.cc @@ -5,7 +5,7 @@ #include "chrome/browser/history/in_memory_history_backend.h" #include "base/command_line.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc index 71c801f..7454681 100644 --- a/chrome/browser/history/text_database.cc +++ b/chrome/browser/history/text_database.cc @@ -11,8 +11,8 @@ #include "app/sql/statement.h" #include "app/sql/transaction.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/history/text_database_manager.cc b/chrome/browser/history/text_database_manager.cc index 99f068ea..c23158e 100644 --- a/chrome/browser/history/text_database_manager.cc +++ b/chrome/browser/history/text_database_manager.cc @@ -6,7 +6,7 @@ #include "base/compiler_specific.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/string_util.h" diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc index e1ac790..a9a99b0 100644 --- a/chrome/browser/jankometer.cc +++ b/chrome/browser/jankometer.cc @@ -8,10 +8,10 @@ #include "base/basictypes.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" +#include "base/metrics/stats_counters.h" #include "base/ref_counted.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "base/thread.h" #include "base/time.h" @@ -102,10 +102,10 @@ class JankObserverHelper { TimeDelta queueing_time_; // Counters for the two types of jank we measure. - StatsCounter slow_processing_counter_; // Messages with long processing time. - StatsCounter queueing_delay_counter_; // Messages with long queueing delay. - scoped_refptr<Histogram> process_times_; // Time spent processing task. - scoped_refptr<Histogram> total_times_; // Total queueing plus processing. + base::StatsCounter slow_processing_counter_; // Msgs w/ long proc time. + base::StatsCounter queueing_delay_counter_; // Msgs w/ long queueing delay. + scoped_refptr<base::Histogram> process_times_; // Time spent proc. task. + scoped_refptr<base::Histogram> total_times_; // Total queueing plus proc. JankWatchdog total_time_watchdog_; // Watching for excessive total_time. DISALLOW_COPY_AND_ASSIGN(JankObserverHelper); @@ -119,12 +119,12 @@ JankObserverHelper::JankObserverHelper( slow_processing_counter_(std::string("Chrome.SlowMsg") + thread_name), queueing_delay_counter_(std::string("Chrome.DelayMsg") + thread_name), total_time_watchdog_(excessive_duration, thread_name, watchdog_enable) { - process_times_ = Histogram::FactoryGet( + process_times_ = base::Histogram::FactoryGet( std::string("Chrome.ProcMsgL ") + thread_name, - 1, 3600000, 50, Histogram::kUmaTargetedHistogramFlag); - total_times_ = Histogram::FactoryGet( + 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag); + total_times_ = base::Histogram::FactoryGet( std::string("Chrome.TotalMsgL ") + thread_name, - 1, 3600000, 50, Histogram::kUmaTargetedHistogramFlag); + 1, 3600000, 50, base::Histogram::kUmaTargetedHistogramFlag); } JankObserverHelper::~JankObserverHelper() {} diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 5bfbf1a..6c1ea77 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -5,7 +5,7 @@ #include "chrome/browser/memory_details.h" #include "base/file_version_info.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/process_util.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/metrics/histogram_synchronizer.cc b/chrome/browser/metrics/histogram_synchronizer.cc index 288d552..3311bb5 100644 --- a/chrome/browser/metrics/histogram_synchronizer.cc +++ b/chrome/browser/metrics/histogram_synchronizer.cc @@ -4,7 +4,7 @@ #include "chrome/browser/metrics/histogram_synchronizer.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/thread.h" #include "chrome/browser/browser_thread.h" @@ -140,7 +140,7 @@ void HistogramSynchronizer::DeserializeHistogramList( for (std::vector<std::string>::const_iterator it = histograms.begin(); it < histograms.end(); ++it) { - Histogram::DeserializeHistogramInfo(*it); + base::Histogram::DeserializeHistogramInfo(*it); } // Record that we have received a histogram from renderer process. diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index e4c9a12..2687eba 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -160,8 +160,8 @@ #include "base/base64.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/md5.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/string_number_conversions.h" #include "base/thread.h" diff --git a/chrome/browser/net/preconnect.cc b/chrome/browser/net/preconnect.cc index a799f66..6780ade 100644 --- a/chrome/browser/net/preconnect.cc +++ b/chrome/browser/net/preconnect.cc @@ -4,8 +4,8 @@ #include "chrome/browser/net/preconnect.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "chrome/browser/profile.h" #include "chrome/browser/browser_thread.h" diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc index 10b19a4..fd55d2f 100644 --- a/chrome/browser/net/predictor.cc +++ b/chrome/browser/net/predictor.cc @@ -9,8 +9,7 @@ #include <sstream> #include "base/compiler_specific.h" -#include "base/histogram.h" -#include "base/stats_counters.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/time.h" #include "base/values.h" diff --git a/chrome/browser/net/predictor_api.cc b/chrome/browser/net/predictor_api.cc index 23f54f0..a1270dc 100644 --- a/chrome/browser/net/predictor_api.cc +++ b/chrome/browser/net/predictor_api.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -7,8 +7,8 @@ #include <map> #include <string> +#include "base/metrics/field_trial.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/thread.h" @@ -506,11 +506,11 @@ PredictorInit::PredictorInit(PrefService* user_prefs, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Set up a field trial to see what disabling DNS pre-resolution does to // latency of page loads. - FieldTrial::Probability kDivisor = 1000; + base::FieldTrial::Probability kDivisor = 1000; // For each option (i.e., non-default), we have a fixed probability. - FieldTrial::Probability kProbabilityPerGroup = 1; // 0.1% probability. + base::FieldTrial::Probability kProbabilityPerGroup = 1; // 0.1% probability. - trial_ = new FieldTrial("DnsImpact", kDivisor); + trial_ = new base::FieldTrial("DnsImpact", kDivisor); // First option is to disable prefetching completely. int disabled_prefetch = trial_->AppendGroup("disabled_prefetch", @@ -546,7 +546,7 @@ PredictorInit::PredictorInit(PrefService* user_prefs, "max_6 concurrent_prefetch", kProbabilityPerGroup); trial_->AppendGroup("default_enabled_prefetch", - FieldTrial::kAllRemainingProbability); + base::FieldTrial::kAllRemainingProbability); // We will register the incognito observer regardless of whether prefetching // is enabled, as it is also used to clear the host cache. @@ -585,5 +585,7 @@ PredictorInit::PredictorInit(PrefService* user_prefs, } } +PredictorInit::~PredictorInit() { +} } // namespace chrome_browser_net diff --git a/chrome/browser/net/predictor_api.h b/chrome/browser/net/predictor_api.h index 062a2a6..3e04e11 100644 --- a/chrome/browser/net/predictor_api.h +++ b/chrome/browser/net/predictor_api.h @@ -16,11 +16,14 @@ #include <string> #include <vector> -#include "base/field_trial.h" #include "base/ref_counted.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/net/predictor.h" +namespace base { +class FieldTrial; +} + class PrefService; namespace chrome_browser_net { @@ -90,10 +93,11 @@ class PredictorInit { PredictorInit(PrefService* user_prefs, PrefService* local_state, bool preconnect_enabled); + ~PredictorInit(); private: // Maintain a field trial instance when we do A/B testing. - scoped_refptr<FieldTrial> trial_; + scoped_refptr<base::FieldTrial> trial_; DISALLOW_COPY_AND_ASSIGN(PredictorInit); }; diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc index 83fa6fd..003c302 100644 --- a/chrome/browser/net/sqlite_persistent_cookie_store.cc +++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc @@ -10,8 +10,8 @@ #include "app/sql/transaction.h" #include "base/basictypes.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/string_util.h" diff --git a/chrome/browser/net/url_info.cc b/chrome/browser/net/url_info.cc index 994cfe7..cbf35db 100644 --- a/chrome/browser/net/url_info.cc +++ b/chrome/browser/net/url_info.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -9,10 +9,9 @@ #include <algorithm> #include <string> -#include "base/field_trial.h" #include "base/format_macros.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" using base::Time; @@ -110,9 +109,10 @@ void UrlInfo::RemoveFromQueue() { } // Make a custom linear histogram for the region from 0 to boundary. const size_t kBucketCount = 52; - static scoped_refptr<Histogram> histogram = LinearHistogram::FactoryTimeGet( - "DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount, - Histogram::kUmaTargetedHistogramFlag); + static scoped_refptr<base::Histogram> histogram = + base::LinearHistogram::FactoryTimeGet( + "DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount, + base::Histogram::kUmaTargetedHistogramFlag); histogram->AddTime(queue_duration_); } diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc index 692d4d0..e09febc 100644 --- a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc +++ b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc @@ -6,8 +6,8 @@ #include "base/command_line.h" #include "base/compiler_specific.h" -#include "base/field_trial.h" #include "base/message_loop.h" +#include "base/metrics/field_trial.h" #include "base/task.h" #include "base/string_util.h" #include "chrome/browser/browser_thread.h" @@ -28,10 +28,12 @@ static scoped_refptr<WebSocketExperimentRunner> runner; void WebSocketExperimentRunner::Start() { DCHECK(!runner.get()); - scoped_refptr<FieldTrial> trial = new FieldTrial("WebSocketExperiment", 1000); + scoped_refptr<base::FieldTrial> trial = + new base::FieldTrial("WebSocketExperiment", 1000); trial->AppendGroup("active", 5); // 0.5% in active group. - bool run_experiment = (trial->group() != FieldTrial::kNotParticipating); + bool run_experiment = + (trial->group() != base::FieldTrial::kNotParticipating); #ifndef NDEBUG const CommandLine& command_line = *CommandLine::ForCurrentProcess(); std::string experiment_host = command_line.GetSwitchValueASCII( diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.h b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.h index 16b20f0..785b5cf 100644 --- a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.h +++ b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.h @@ -16,7 +16,6 @@ #pragma once #include "base/basictypes.h" -#include "base/histogram.h" #include "base/linked_ptr.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc index cc7929c..6279615 100644 --- a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc +++ b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc @@ -5,7 +5,7 @@ #include "chrome/browser/net/websocket_experiment/websocket_experiment_task.h" #include "base/hash_tables.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/profile.h" #include "chrome/common/net/url_request_context_getter.h" @@ -14,6 +14,9 @@ #include "net/base/net_errors.h" #include "net/websockets/websocket.h" +using base::Histogram; +using base::LinearHistogram; + namespace chrome_browser_net_websocket_experiment { static std::string GetProtocolVersionName( diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 4df30e9..351485f 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -6,7 +6,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/thread.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_child_process_host.h" diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc index 1a91efe..e1ab84c 100644 --- a/chrome/browser/omnibox_search_hint.cc +++ b/chrome/browser/omnibox_search_hint.cc @@ -7,7 +7,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/command_line.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/task.h" #include "chrome/browser/autocomplete/autocomplete_edit.h" #include "chrome/browser/autocomplete/autocomplete_edit_view.h" diff --git a/chrome/browser/password_manager/login_database.cc b/chrome/browser/password_manager/login_database.cc index 700dd3f..a7c26b4 100644 --- a/chrome/browser/password_manager/login_database.cc +++ b/chrome/browser/password_manager/login_database.cc @@ -11,8 +11,8 @@ #include "app/sql/transaction.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/password_manager/password_form_manager.cc b/chrome/browser/password_manager/password_form_manager.cc index e268317..977806d 100644 --- a/chrome/browser/password_manager/password_form_manager.cc +++ b/chrome/browser/password_manager/password_form_manager.cc @@ -6,7 +6,7 @@ #include <algorithm> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_split.h" #include "base/string_util.h" #include "chrome/browser/password_manager/password_manager.h" diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index eb1e0e3..80b3d38 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -11,9 +11,9 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_util.h" diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc index e2ea94a..491008c 100644 --- a/chrome/browser/profile_impl.cc +++ b/chrome/browser/profile_impl.cc @@ -9,7 +9,7 @@ #include "base/environment.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/scoped_ptr.h" #include "base/string_number_conversions.h" diff --git a/chrome/browser/renderer_host/audio_renderer_host.cc b/chrome/browser/renderer_host/audio_renderer_host.cc index af63515..9493799 100644 --- a/chrome/browser/renderer_host/audio_renderer_host.cc +++ b/chrome/browser/renderer_host/audio_renderer_host.cc @@ -4,8 +4,8 @@ #include "chrome/browser/renderer_host/audio_renderer_host.h" -#include "base/histogram.h" #include "base/lock.h" +#include "base/metrics/histogram.h" #include "base/process.h" #include "base/shared_memory.h" #include "base/sys_info.h" diff --git a/chrome/browser/renderer_host/backing_store_x.cc b/chrome/browser/renderer_host/backing_store_x.cc index f2704c8..a79a8fc 100644 --- a/chrome/browser/renderer_host/backing_store_x.cc +++ b/chrome/browser/renderer_host/backing_store_x.cc @@ -22,8 +22,8 @@ #include "app/x11_util.h" #include "app/x11_util_internal.h" #include "base/compiler_specific.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "gfx/rect.h" diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 4c152e06..65172c8 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -17,9 +17,9 @@ #include "app/app_switches.h" #include "base/command_line.h" -#include "base/field_trial.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/platform_file.h" #include "base/stl_util-inl.h" #include "base/string_util.h" @@ -490,11 +490,11 @@ void BrowserRenderProcessHost::AppendRendererCommandLine( const std::string locale = g_browser_process->GetApplicationLocale(); command_line->AppendSwitchASCII(switches::kLang, locale); - // If we run FieldTrials, we want to pass to their state to the renderer so + // If we run base::FieldTrials, we want to pass to their state to the renderer so // that it can act in accordance with each state, or record histograms - // relating to the FieldTrial states. + // relating to the base::FieldTrial states. std::string field_trial_states; - FieldTrialList::StatesToString(&field_trial_states); + base::FieldTrialList::StatesToString(&field_trial_states); if (!field_trial_states.empty()) { command_line->AppendSwitchASCII(switches::kForceFieldTestNameAndValue, field_trial_states); diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc index 78389f0..a19d3c3 100644 --- a/chrome/browser/renderer_host/buffered_resource_handler.cc +++ b/chrome/browser/renderer_host/buffered_resource_handler.cc @@ -6,8 +6,8 @@ #include <vector> -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" @@ -29,19 +29,21 @@ namespace { void RecordSnifferMetrics(bool sniffing_blocked, bool we_would_like_to_sniff, const std::string& mime_type) { - static scoped_refptr<Histogram> nosniff_usage = BooleanHistogram::FactoryGet( - "nosniff.usage", Histogram::kUmaTargetedHistogramFlag); + static scoped_refptr<base::Histogram> nosniff_usage = + base::BooleanHistogram::FactoryGet( + "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag); nosniff_usage->AddBoolean(sniffing_blocked); if (sniffing_blocked) { - static scoped_refptr<Histogram> nosniff_otherwise = - BooleanHistogram::FactoryGet("nosniff.otherwise", - Histogram::kUmaTargetedHistogramFlag); + static scoped_refptr<base::Histogram> nosniff_otherwise = + base::BooleanHistogram::FactoryGet( + "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag); nosniff_otherwise->AddBoolean(we_would_like_to_sniff); - static scoped_refptr<Histogram> nosniff_empty_mime_type = - BooleanHistogram::FactoryGet("nosniff.empty_mime_type", - Histogram::kUmaTargetedHistogramFlag); + static scoped_refptr<base::Histogram> nosniff_empty_mime_type = + base::BooleanHistogram::FactoryGet( + "nosniff.empty_mime_type", + base::Histogram::kUmaTargetedHistogramFlag); nosniff_empty_mime_type->AddBoolean(mime_type.empty()); } } diff --git a/chrome/browser/renderer_host/offline_resource_handler.cc b/chrome/browser/renderer_host/offline_resource_handler.cc index dafa911..68a036d 100644 --- a/chrome/browser/renderer_host/offline_resource_handler.cc +++ b/chrome/browser/renderer_host/offline_resource_handler.cc @@ -6,8 +6,8 @@ #include <vector> -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/singleton.h" #include "base/string_util.h" #include "chrome/browser/browser_thread.h" diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index c91671f..3781bed 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -11,7 +11,7 @@ #include "base/command_line.h" #include "base/i18n/rtl.h" #include "base/json/json_reader.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "base/time.h" #include "base/values.h" @@ -1145,7 +1145,7 @@ void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache( const std::string& frame_origin, const std::string& main_frame_origin, const std::string& security_info) { - static StatsCounter cache("WebKit.CacheHit"); + static base::StatsCounter cache("WebKit.CacheHit"); cache.Increment(); RenderViewHostDelegate::Resource* resource_delegate = diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index 684c7ef..7d4aa79f 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -7,8 +7,8 @@ #include "app/keyboard_codes.h" #include "base/auto_reset.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "chrome/browser/accessibility/browser_accessibility_state.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/renderer_host/backing_store.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index c69397d..5f4a843 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -22,8 +22,8 @@ #include "app/x11_util.h" #include "base/command_line.h" #include "base/logging.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/time.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index e6a6ba6..ce0f8c0 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -10,8 +10,8 @@ #include "app/surface/io_surface_support_mac.h" #import "base/chrome_application_mac.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #import "base/scoped_nsautorelease_pool.h" #import "base/scoped_nsobject.h" #include "base/string_util.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc index 76f6cd6..25e8a88 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_views.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc @@ -11,9 +11,9 @@ #include "app/l10n_util.h" #include "app/x11_util.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/task.h" #include "base/time.h" diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 29d4174..0b66f0c 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -8,8 +8,8 @@ #include "app/l10n_util_win.h" #include "app/resource_bundle.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/i18n/rtl.h" +#include "base/metrics/histogram.h" #include "base/process_util.h" #include "base/scoped_comptr_win.h" #include "base/thread.h" diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index 3faa6f8..a17b12b7 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -10,8 +10,8 @@ #include "base/logging.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/scoped_ptr.h" #include "base/shared_memory.h" #include "base/stl_util-inl.h" diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 1351962..d62f6d1 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -12,7 +12,7 @@ #endif #include "base/file_util.h" #include "base/file_path.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/process_util.h" #include "base/shared_memory.h" #include "base/thread.h" diff --git a/chrome/browser/renderer_host/web_cache_manager.cc b/chrome/browser/renderer_host/web_cache_manager.cc index 04da747..88baa7b 100644 --- a/chrome/browser/renderer_host/web_cache_manager.cc +++ b/chrome/browser/renderer_host/web_cache_manager.cc @@ -7,7 +7,7 @@ #include <algorithm> #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/singleton.h" #include "base/sys_info.h" #include "base/time.h" diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc index 52ccbace..d7ba1a8 100644 --- a/chrome/browser/safe_browsing/protocol_manager.cc +++ b/chrome/browser/safe_browsing/protocol_manager.cc @@ -8,8 +8,8 @@ #include "base/base64.h" #endif #include "base/environment.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/stl_util-inl.h" #include "base/string_util.h" diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc index 72d2554..df76d47 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database.cc @@ -6,12 +6,12 @@ #include "base/command_line.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" +#include "base/metrics/stats_counters.h" #include "base/time.h" #include "base/message_loop.h" #include "base/process_util.h" #include "base/sha2.h" -#include "base/stats_counters.h" #include "chrome/browser/safe_browsing/bloom_filter.h" #include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h" #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc index 0c636ef..36a03c0 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc @@ -6,11 +6,11 @@ #include "base/auto_reset.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/process_util.h" #include "base/sha2.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "chrome/browser/safe_browsing/bloom_filter.h" #include "chrome/common/sqlite_compiled_statement.h" diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom_unittest.cc index 4359cc5..2032efd 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_bloom_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom_unittest.cc @@ -11,11 +11,11 @@ #include "base/format_macros.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_temp_dir.h" #include "base/sha2.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "base/time.h" #include "chrome/browser/safe_browsing/protocol_parser.h" @@ -1093,7 +1093,7 @@ TEST_F(SafeBrowsingDatabaseBloomTest, DISABLED_SqliteCorruptionHandling) { namespace { void PrintStat(const char* name) { - int value = StatsTable::current()->GetCounterValue(name); + int value = base::StatsTable::current()->GetCounterValue(name); SB_DLOG(INFO) << StringPrintf("%s %d", name, value); } diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index d381d55..6407e53 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -10,11 +10,11 @@ #include "base/format_macros.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/scoped_temp_dir.h" #include "base/sha2.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "base/time.h" #include "chrome/browser/safe_browsing/protocol_parser.h" @@ -1168,7 +1168,7 @@ TEST_F(SafeBrowsingDatabaseTest, DISABLED_FileCorruptionHandling) { namespace { void PrintStat(const char* name) { - int value = StatsTable::current()->GetCounterValue(name); + int value = base::StatsTable::current()->GetCounterValue(name); SB_DLOG(INFO) << StringPrintf("%s %d", name, value); } diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc index a5cec62..196cf0d 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc @@ -5,7 +5,7 @@ #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" #include "base/callback.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/md5.h" // TODO(shess): Remove after migration. diff --git a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc index 486d6f2..8deeff4 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc @@ -8,7 +8,7 @@ #include "base/callback.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/common/sqlite_compiled_statement.h" diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc index 342c1f0..f5a0c39 100644 --- a/chrome/browser/sessions/session_backend.cc +++ b/chrome/browser/sessions/session_backend.cc @@ -7,7 +7,7 @@ #include <limits> #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/scoped_vector.h" #include "net/base/file_stream.h" diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 542d3e3..a430d56 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -10,8 +10,8 @@ #include "base/callback.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/pickle.h" #include "base/scoped_vector.h" #include "base/thread.h" diff --git a/chrome/browser/spellchecker_mac.mm b/chrome/browser/spellchecker_mac.mm index 70db304..91d6f3e 100644 --- a/chrome/browser/spellchecker_mac.mm +++ b/chrome/browser/spellchecker_mac.mm @@ -10,8 +10,8 @@ #import <Cocoa/Cocoa.h> #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/time.h" -#include "base/histogram.h" #include "base/sys_string_conversions.h" #include "chrome/common/spellcheck_common.h" diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 9a1ba76..91d87c7 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -6,8 +6,8 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/histogram.h" #include "base/i18n/rtl.h" +#include "base/metrics/histogram.h" #include "base/string_piece.h" #include "base/utf_string_conversions.h" #include "base/values.h" diff --git a/chrome/browser/sync/glue/app_data_type_controller.cc b/chrome/browser/sync/glue/app_data_type_controller.cc index 8a86b1a..cb6cb54 100644 --- a/chrome/browser/sync/glue/app_data_type_controller.cc +++ b/chrome/browser/sync/glue/app_data_type_controller.cc @@ -4,7 +4,7 @@ #include "chrome/browser/sync/glue/app_data_type_controller.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/time.h" #include "chrome/browser/browser_thread.h" diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index b7ee19b..8c33872 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/histogram.h" +#include "chrome/browser/sync/glue/autofill_data_type_controller.h" + #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/task.h" #include "base/time.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/glue/autofill_change_processor.h" -#include "chrome/browser/sync/glue/autofill_data_type_controller.h" #include "chrome/browser/sync/glue/autofill_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.cc b/chrome/browser/sync/glue/bookmark_data_type_controller.cc index 1662d5d..093fc16 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller.cc @@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/histogram.h" +#include "chrome/browser/sync/glue/bookmark_data_type_controller.h" + #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/glue/bookmark_change_processor.h" -#include "chrome/browser/sync/glue/bookmark_data_type_controller.h" #include "chrome/browser/sync/glue/bookmark_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" diff --git a/chrome/browser/sync/glue/extension_data_type_controller.cc b/chrome/browser/sync/glue/extension_data_type_controller.cc index 2e3368b..d5b7900 100644 --- a/chrome/browser/sync/glue/extension_data_type_controller.cc +++ b/chrome/browser/sync/glue/extension_data_type_controller.cc @@ -4,8 +4,8 @@ #include "chrome/browser/sync/glue/extension_data_type_controller.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/profile.h" diff --git a/chrome/browser/sync/glue/password_data_type_controller.cc b/chrome/browser/sync/glue/password_data_type_controller.cc index 20d9ef6..095306a 100644 --- a/chrome/browser/sync/glue/password_data_type_controller.cc +++ b/chrome/browser/sync/glue/password_data_type_controller.cc @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/histogram.h" +#include "chrome/browser/sync/glue/password_data_type_controller.h" + +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/task.h" #include "base/time.h" @@ -10,7 +12,6 @@ #include "chrome/browser/password_manager/password_store.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/glue/password_change_processor.h" -#include "chrome/browser/sync/glue/password_data_type_controller.h" #include "chrome/browser/sync/glue/password_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" diff --git a/chrome/browser/sync/glue/preference_data_type_controller.cc b/chrome/browser/sync/glue/preference_data_type_controller.cc index cb3fc6c7..f714ed1 100644 --- a/chrome/browser/sync/glue/preference_data_type_controller.cc +++ b/chrome/browser/sync/glue/preference_data_type_controller.cc @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/histogram.h" +#include "chrome/browser/sync/glue/preference_data_type_controller.h" + #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/sync/glue/preference_change_processor.h" -#include "chrome/browser/sync/glue/preference_data_type_controller.h" #include "chrome/browser/sync/glue/preference_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" diff --git a/chrome/browser/sync/glue/session_data_type_controller.cc b/chrome/browser/sync/glue/session_data_type_controller.cc index 1e2a072..8b68972 100644 --- a/chrome/browser/sync/glue/session_data_type_controller.cc +++ b/chrome/browser/sync/glue/session_data_type_controller.cc @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/histogram.h" +#include "chrome/browser/sync/glue/session_data_type_controller.h" + +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/time.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/sync/glue/session_change_processor.h" -#include "chrome/browser/sync/glue/session_data_type_controller.h" #include "chrome/browser/sync/glue/session_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" diff --git a/chrome/browser/sync/glue/session_data_type_controller.h b/chrome/browser/sync/glue/session_data_type_controller.h index 0dc56eb..ae815d4 100644 --- a/chrome/browser/sync/glue/session_data_type_controller.h +++ b/chrome/browser/sync/glue/session_data_type_controller.h @@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "chrome/browser/sync/glue/data_type_controller.h" +#include "chrome/browser/sync/glue/session_model_associator.h" class ProfileSyncFactory; class ProfileSyncService; diff --git a/chrome/browser/sync/glue/theme_data_type_controller.cc b/chrome/browser/sync/glue/theme_data_type_controller.cc index ecad426..03cf3cd 100644 --- a/chrome/browser/sync/glue/theme_data_type_controller.cc +++ b/chrome/browser/sync/glue/theme_data_type_controller.cc @@ -2,13 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/histogram.h" +#include "chrome/browser/sync/glue/theme_data_type_controller.h" + +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/time.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/glue/theme_change_processor.h" -#include "chrome/browser/sync/glue/theme_data_type_controller.h" #include "chrome/browser/sync/glue/theme_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.cc b/chrome/browser/sync/glue/typed_url_data_type_controller.cc index ca9f5cd..6fca194 100644 --- a/chrome/browser/sync/glue/typed_url_data_type_controller.cc +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.cc @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/histogram.h" +#include "chrome/browser/sync/glue/typed_url_data_type_controller.h" + +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/task.h" #include "base/time.h" @@ -10,7 +12,6 @@ #include "chrome/browser/history/history.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/glue/typed_url_change_processor.h" -#include "chrome/browser/sync/glue/typed_url_data_type_controller.h" #include "chrome/browser/sync/glue/typed_url_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_factory.h" diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.h b/chrome/browser/sync/glue/typed_url_data_type_controller.h index db28208..0301135 100644 --- a/chrome/browser/sync/glue/typed_url_data_type_controller.h +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.h @@ -23,6 +23,10 @@ class Profile; class ProfileSyncFactory; class ProfileSyncService; +namespace history { +class HistoryBackend; +} + namespace browser_sync { class AssociatorInterface; diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index bad0859..ddaff62 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -10,8 +10,8 @@ #include "app/l10n_util.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string16.h" #include "base/string_util.h" diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 0f22e8c..9cef9768 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -6,9 +6,9 @@ #include "app/gfx/font_util.h" #include "base/callback.h" -#include "base/histogram.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" diff --git a/chrome/browser/sync/syncable/directory_backing_store.cc b/chrome/browser/sync/syncable/directory_backing_store.cc index abba0a6..c0036d3 100644 --- a/chrome/browser/sync/syncable/directory_backing_store.cc +++ b/chrome/browser/sync/syncable/directory_backing_store.cc @@ -14,8 +14,8 @@ #include "base/file_util.h" #include "base/hash_tables.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_util.h" diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 1b5af98..4dc7b11 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -9,8 +9,8 @@ #include "app/l10n_util.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index ebf4756..0ed29a0 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -14,8 +14,8 @@ #include "app/text_elider.h" #include "base/auto_reset.h" #include "base/file_version_info.h" -#include "base/histogram.h" #include "base/i18n/rtl.h" +#include "base/metrics/histogram.h" #include "base/process_util.h" #include "base/string16.h" #include "base/string_util.h" diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc index 4d5826a..520faf4 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.cc +++ b/chrome/browser/tab_contents/thumbnail_generator.cc @@ -7,7 +7,7 @@ #include <algorithm> #include <map> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "build/build_config.h" #include "chrome/browser/renderer_host/backing_store.h" diff --git a/chrome/browser/translate/languages_menu_model.cc b/chrome/browser/translate/languages_menu_model.cc index 93bd100..544410e 100644 --- a/chrome/browser/translate/languages_menu_model.cc +++ b/chrome/browser/translate/languages_menu_model.cc @@ -4,7 +4,7 @@ #include "chrome/browser/translate/languages_menu_model.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "chrome/browser/translate/translate_infobar_delegate.h" LanguagesMenuModel::LanguagesMenuModel( diff --git a/chrome/browser/translate/options_menu_model.cc b/chrome/browser/translate/options_menu_model.cc index 56b707b..bb5b157 100644 --- a/chrome/browser/translate/options_menu_model.cc +++ b/chrome/browser/translate/options_menu_model.cc @@ -5,7 +5,7 @@ #include "chrome/browser/translate/options_menu_model.h" #include "app/l10n_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profile.h" diff --git a/chrome/browser/translate/translate_infobar_delegate.cc b/chrome/browser/translate/translate_infobar_delegate.cc index af73d11..6b27cd5 100644 --- a/chrome/browser/translate/translate_infobar_delegate.cc +++ b/chrome/browser/translate/translate_infobar_delegate.cc @@ -8,7 +8,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index df5db9e..b948a25 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -7,7 +7,7 @@ #include "app/resource_bundle.h" #include "base/command_line.h" #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_split.h" #include "base/string_util.h" #include "chrome/browser/browser.h" diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 1f753e9..ebaa8916 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -11,8 +11,8 @@ #include "app/text_elider.h" #include "base/callback.h" #include "base/file_path.h" -#include "base/histogram.h" #include "base/i18n/rtl.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/views/external_protocol_dialog.cc b/chrome/browser/views/external_protocol_dialog.cc index 9546f25..6dda2e3 100644 --- a/chrome/browser/views/external_protocol_dialog.cc +++ b/chrome/browser/views/external_protocol_dialog.cc @@ -6,7 +6,7 @@ #include "app/l10n_util.h" #include "app/message_box_flags.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/registry.h" #include "base/string_util.h" #include "base/thread.h" diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc index 452c5d9..a4d74c2 100644 --- a/chrome/browser/views/task_manager_view.cc +++ b/chrome/browser/views/task_manager_view.cc @@ -7,7 +7,7 @@ #include "app/l10n_util.h" #include "app/table_model_observer.h" #include "base/command_line.h" -#include "base/stats_table.h" +#include "base/metrics/stats_table.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser_list.h" @@ -384,7 +384,7 @@ void TaskManagerView::Init() { } void TaskManagerView::UpdateStatsCounters() { - StatsTable* stats = StatsTable::current(); + base::StatsTable* stats = base::StatsTable::current(); if (stats != NULL) { int max = stats->GetMaxCounters(); // skip the first row (it's header data) diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc index 318312a..b001eff 100644 --- a/chrome/common/child_process_host.cc +++ b/chrome/common/child_process_host.cc @@ -5,7 +5,7 @@ #include "chrome/common/child_process_host.h" #include "base/command_line.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "chrome/common/child_process_info.h" #include "chrome/common/chrome_constants.h" diff --git a/chrome/common/chrome_counters.cc b/chrome/common/chrome_counters.cc index fea0906..91ebf55 100644 --- a/chrome/common/chrome_counters.cc +++ b/chrome/common/chrome_counters.cc @@ -1,13 +1,16 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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 "chrome/common/chrome_counters.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" namespace chrome { +using base::StatsCounterTimer; +using base::StatsRate; + // Note: We use the construct-on-first-use pattern here, because we don't // want to fight with any static initializer ordering problems later. // The downside of this is that the objects don't ever get cleaned up. diff --git a/chrome/common/chrome_counters.h b/chrome/common/chrome_counters.h index e655b83..e53d5b2 100644 --- a/chrome/common/chrome_counters.h +++ b/chrome/common/chrome_counters.h @@ -8,31 +8,33 @@ #define CHROME_COMMON_CHROME_COUNTERS_H_ #pragma once +namespace base { class StatsCounter; class StatsCounterTimer; class StatsRate; +} namespace chrome { class Counters { public: // The amount of time spent in chrome initialization. - static StatsCounterTimer& chrome_main(); + static base::StatsCounterTimer& chrome_main(); // The amount of time spent in renderer initialization. - static StatsCounterTimer& renderer_main(); + static base::StatsCounterTimer& renderer_main(); // Time spent in spellchecker initialization. - static StatsCounterTimer& spellcheck_init(); + static base::StatsCounterTimer& spellcheck_init(); // Time/Count of spellcheck lookups. - static StatsRate& spellcheck_lookup(); + static base::StatsRate& spellcheck_lookup(); // Time spent loading the Chrome plugins. - static StatsCounterTimer& plugin_load(); + static base::StatsCounterTimer& plugin_load(); // Time/Count of plugin network interception. - static StatsRate& plugin_intercept(); + static base::StatsRate& plugin_intercept(); }; } // namespace chrome diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc index 2b78ed25c..5d1264b 100644 --- a/chrome/common/chrome_plugin_lib.cc +++ b/chrome/common/chrome_plugin_lib.cc @@ -6,8 +6,8 @@ #include "base/command_line.h" #include "base/hash_tables.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/perftimer.h" #include "base/thread.h" diff --git a/chrome/common/metrics_helpers.cc b/chrome/common/metrics_helpers.cc index b0fdac1..4fb11b7 100644 --- a/chrome/common/metrics_helpers.cc +++ b/chrome/common/metrics_helpers.cc @@ -27,6 +27,8 @@ #define OPEN_ELEMENT_FOR_SCOPE(name) ScopedElement scoped_element(this, name) +using base::Histogram; +using base::StatisticsRecorder; using base::Time; using base::TimeDelta; diff --git a/chrome/common/metrics_helpers.h b/chrome/common/metrics_helpers.h index 990a9fe..b0bbec2 100644 --- a/chrome/common/metrics_helpers.h +++ b/chrome/common/metrics_helpers.h @@ -13,7 +13,7 @@ #include <string> #include "base/basictypes.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/common/page_transition_types.h" @@ -54,8 +54,8 @@ class MetricsLogBase { base::TimeDelta load_time); // Record any changes in a given histogram for transmission. - void RecordHistogramDelta(const Histogram& histogram, - const Histogram::SampleSet& snapshot); + void RecordHistogramDelta(const base::Histogram& histogram, + const base::Histogram::SampleSet& snapshot); // Stop writing to this record and generate the encoded representation. // None of the Record* methods can be called after this is called. @@ -200,7 +200,7 @@ class MetricsServiceBase { void RecordCurrentHistograms(); // Record a specific histogram . - void RecordHistogram(const Histogram& histogram); + void RecordHistogram(const base::Histogram& histogram); // A log that we are currently transmiting, or about to try to transmit. MetricsLogBase* pending_log_; @@ -214,7 +214,7 @@ class MetricsServiceBase { MetricsLogBase* current_log_; // Maintain a map of histogram names to the sample stats we've sent. - typedef std::map<std::string, Histogram::SampleSet> LoggedSampleMap; + typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap; // For histograms, record what we've already logged (as a sample for each // histogram) so that we can send only the delta with the next log. diff --git a/chrome/renderer/net/predictor_queue.cc b/chrome/renderer/net/predictor_queue.cc index 40996e5..4f680ba 100644 --- a/chrome/renderer/net/predictor_queue.cc +++ b/chrome/renderer/net/predictor_queue.cc @@ -7,7 +7,7 @@ #include "chrome/renderer/net/predictor_queue.h" #include "base/logging.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" DnsQueue::DnsQueue(BufferSize size) : buffer_(new char[size + 2]), diff --git a/chrome/renderer/paint_aggregator.cc b/chrome/renderer/paint_aggregator.cc index c5c4405..943e012 100644 --- a/chrome/renderer/paint_aggregator.cc +++ b/chrome/renderer/paint_aggregator.cc @@ -4,8 +4,8 @@ #include "chrome/renderer/paint_aggregator.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" // ---------------------------------------------------------------------------- // ALGORITHM NOTES @@ -25,7 +25,7 @@ // If the combined area of paint rects contained within the scroll rect grows // too large, then we might as well just treat the scroll rect as a paint rect. // This constant sets the max ratio of paint rect area to scroll rect area that -// we will tolerate before downgrading the scroll into a repaint. +// we will tolerate before dograding the scroll into a repaint. static const float kMaxRedundantPaintToScrollArea = 0.8f; // The maximum number of paint rects. If we exceed this limit, then we'll @@ -227,7 +227,7 @@ void PaintAggregator::InvalidateScrollRect() { } void PaintAggregator::CombinePaintRects() { - // Combine paint rects down to at most two rects: one inside the scroll_rect + // Combine paint rects do to at most two rects: one inside the scroll_rect // and one outside the scroll_rect. If there is no scroll_rect, then just // use the smallest bounding box for all paint rects. // diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc index d23a08a..2350213 100644 --- a/chrome/renderer/render_process_impl.cc +++ b/chrome/renderer/render_process_impl.cc @@ -18,7 +18,7 @@ #include "base/compiler_specific.h" #include "base/file_util.h" #include "base/message_loop.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/sys_info.h" #include "base/utf_string_conversions.h" @@ -159,7 +159,7 @@ RenderProcessImpl::RenderProcessImpl() } if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) { - StatisticsRecorder::set_dump_on_exit(true); + base::StatisticsRecorder::set_dump_on_exit(true); } #if !defined(DISABLE_NACL) diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 595dc9c..f29bb0a 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -10,13 +10,13 @@ #include <vector> #include "base/command_line.h" -#include "base/field_trial.h" #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/stats_table.h" #include "base/nullable_string16.h" #include "base/process_util.h" #include "base/shared_memory.h" -#include "base/stats_table.h" #include "base/string_util.h" #include "base/task.h" #include "base/thread_local.h" @@ -283,8 +283,8 @@ void RenderThread::Init() { // channel is established in time, EstablishGpuChannelSync will not block when // it is later called. Delays by a fixed period of time to avoid loading the // GPU immediately in an attempt to not slow startup time. - scoped_refptr<FieldTrial> prelaunch_trial( - new FieldTrial("PrelaunchGpuProcessExperiment", 100)); + scoped_refptr<base::FieldTrial> prelaunch_trial( + new base::FieldTrial("PrelaunchGpuProcessExperiment", 100)); int prelaunch_group = prelaunch_trial->AppendGroup("prelaunch_gpu_process", kPrelauchGpuPercentage); if (prelaunch_group == prelaunch_trial->group() || @@ -808,8 +808,8 @@ static void* CreateHistogram( const char *name, int min, int max, size_t buckets) { if (min <= 0) min = 1; - scoped_refptr<Histogram> histogram = Histogram::FactoryGet( - name, min, max, buckets, Histogram::kUmaTargetedHistogramFlag); + scoped_refptr<base::Histogram> histogram = base::Histogram::FactoryGet( + name, min, max, buckets, base::Histogram::kUmaTargetedHistogramFlag); // We'll end up leaking these histograms, unless there is some code hiding in // there to do the dec-ref. // TODO(jar): Handle reference counting in webkit glue. @@ -818,7 +818,7 @@ static void* CreateHistogram( } static void AddHistogramSample(void* hist, int sample) { - Histogram* histogram = static_cast<Histogram *>(hist); + base::Histogram* histogram = static_cast<base::Histogram*>(hist); histogram->Add(sample); } @@ -834,7 +834,7 @@ void RenderThread::EnsureWebKitInitialized() { this, &RenderThread::IdleHandler); } - v8::V8::SetCounterFunction(StatsTable::FindLocation); + v8::V8::SetCounterFunction(base::StatsTable::FindLocation); v8::V8::SetCreateHistogramFunction(CreateHistogram); v8::V8::SetAddHistogramSampleFunction(AddHistogramSample); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 2ffaf26..0b17633 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -15,8 +15,8 @@ #include "base/callback.h" #include "base/command_line.h" #include "base/compiler_specific.h" -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/singleton.h" @@ -5065,33 +5065,33 @@ void RenderView::DumpLoadHistograms() const { } // Histograms to determine if DNS prefetching has an impact on PLT. - static bool use_dns_histogram(FieldTrialList::Find("DnsImpact") && - !FieldTrialList::Find("DnsImpact")->group_name().empty()); + static bool use_dns_histogram(base::FieldTrialList::Find("DnsImpact") && + !base::FieldTrialList::Find("DnsImpact")->group_name().empty()); if (use_dns_histogram) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.Abandoned", "DnsImpact"), + base::FieldTrial::MakeName("PLT.Abandoned", "DnsImpact"), abandoned_page ? 1 : 0, 2); UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.LoadType", "DnsImpact"), + base::FieldTrial::MakeName("PLT.LoadType", "DnsImpact"), load_type, NavigationState::kLoadTypeMax); switch (load_type) { case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad", "DnsImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal", "DnsImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadReload", "DnsImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadStaleOk", "DnsImpact"), begin_to_finish_all_loads); break; @@ -5102,66 +5102,68 @@ void RenderView::DumpLoadHistograms() const { // Histograms to determine if content prefetching has an impact on PLT. static const bool prefetching_fieldtrial = - FieldTrialList::Find("Prefetch") && - !FieldTrialList::Find("Prefetch")->group_name().empty(); + base::FieldTrialList::Find("Prefetch") && + !base::FieldTrialList::Find("Prefetch")->group_name().empty(); if (prefetching_fieldtrial) { if (navigation_state->was_prefetcher()) { PLT_HISTOGRAM( - FieldTrial::MakeName("PLT.BeginToFinishDoc_ContentPrefetcher", + base::FieldTrial::MakeName("PLT.BeginToFinishDoc_ContentPrefetcher", "Prefetch"), begin_to_finish_doc); PLT_HISTOGRAM( - FieldTrial::MakeName("PLT.BeginToFinish_ContentPrefetcher", - "Prefetch"), + base::FieldTrial::MakeName("PLT.BeginToFinish_ContentPrefetcher", + "Prefetch"), begin_to_finish_all_loads); } if (navigation_state->was_referred_by_prefetcher()) { - PLT_HISTOGRAM( - FieldTrial::MakeName("PLT.BeginToFinishDoc_ContentPrefetcherReferrer", - "Prefetch"), + PLT_HISTOGRAM(base::FieldTrial::MakeName( + "PLT.BeginToFinishDoc_ContentPrefetcherReferrer", + "Prefetch"), begin_to_finish_doc); - PLT_HISTOGRAM( - FieldTrial::MakeName("PLT.BeginToFinish_ContentPrefetcherReferrer", - "Prefetch"), + PLT_HISTOGRAM(base::FieldTrial::MakeName( + "PLT.BeginToFinish_ContentPrefetcherReferrer", + "Prefetch"), begin_to_finish_all_loads); } - UMA_HISTOGRAM_ENUMERATION(FieldTrial::MakeName("PLT.Abandoned", "Prefetch"), - abandoned_page ? 1 : 0, 2); - PLT_HISTOGRAM(FieldTrial::MakeName("PLT.BeginToFinishDoc", "Prefetch"), + UMA_HISTOGRAM_ENUMERATION( + base::FieldTrial::MakeName("PLT.Abandoned", "Prefetch"), + abandoned_page ? 1 : 0, 2); + PLT_HISTOGRAM(base::FieldTrial::MakeName("PLT.BeginToFinishDoc", + "Prefetch"), begin_to_finish_doc); - PLT_HISTOGRAM(FieldTrial::MakeName("PLT.BeginToFinish", "Prefetch"), + PLT_HISTOGRAM(base::FieldTrial::MakeName("PLT.BeginToFinish", "Prefetch"), begin_to_finish_all_loads); } // Histograms to determine if backup connection jobs have an impact on PLT. static const bool connect_backup_jobs_fieldtrial( - FieldTrialList::Find("ConnnectBackupJobs") && - !FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty()); + base::FieldTrialList::Find("ConnnectBackupJobs") && + !base::FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty()); if (connect_backup_jobs_fieldtrial) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.Abandoned", "ConnnectBackupJobs"), + base::FieldTrial::MakeName("PLT.Abandoned", "ConnnectBackupJobs"), abandoned_page ? 1 : 0, 2); UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.LoadType", "ConnnectBackupJobs"), + base::FieldTrial::MakeName("PLT.LoadType", "ConnnectBackupJobs"), load_type, NavigationState::kLoadTypeMax); switch (load_type) { case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad", "ConnnectBackupJobs"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal", "ConnnectBackupJobs"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadReload", "ConnnectBackupJobs"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadStaleOk", "ConnnectBackupJobs"), begin_to_finish_all_loads); break; @@ -5175,30 +5177,30 @@ void RenderView::DumpLoadHistograms() const { // TODO(jar): Consider removing the per-link-type versions. We // really only need LINK_LOAD_NORMAL and NORMAL_LOAD. static bool use_connection_impact_histogram( - FieldTrialList::Find("ConnCountImpact") && - !FieldTrialList::Find("ConnCountImpact")->group_name().empty()); + base::FieldTrialList::Find("ConnCountImpact") && + !base::FieldTrialList::Find("ConnCountImpact")->group_name().empty()); if (use_connection_impact_histogram) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.Abandoned", "ConnCountImpact"), + base::FieldTrial::MakeName("PLT.Abandoned", "ConnCountImpact"), abandoned_page ? 1 : 0, 2); switch (load_type) { case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad", "ConnCountImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal", "ConnCountImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadReload", "ConnCountImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadStaleOk", "ConnCountImpact"), begin_to_finish_all_loads); break; @@ -5209,30 +5211,30 @@ void RenderView::DumpLoadHistograms() const { // Histograms to determine effect of idle socket timeout. static bool use_idle_socket_timeout_histogram( - FieldTrialList::Find("IdleSktToImpact") && - !FieldTrialList::Find("IdleSktToImpact")->group_name().empty()); + base::FieldTrialList::Find("IdleSktToImpact") && + !base::FieldTrialList::Find("IdleSktToImpact")->group_name().empty()); if (use_idle_socket_timeout_histogram) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.Abandoned", "IdleSktToImpact"), + base::FieldTrial::MakeName("PLT.Abandoned", "IdleSktToImpact"), abandoned_page ? 1 : 0, 2); switch (load_type) { case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad", "IdleSktToImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal", "IdleSktToImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadReload", "IdleSktToImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadStaleOk", "IdleSktToImpact"), begin_to_finish_all_loads); break; @@ -5243,30 +5245,31 @@ void RenderView::DumpLoadHistograms() const { // Histograms to determine effect of number of connections per proxy. static bool use_proxy_connection_impact_histogram( - FieldTrialList::Find("ProxyConnectionImpact") && - !FieldTrialList::Find("ProxyConnectionImpact")->group_name().empty()); + base::FieldTrialList::Find("ProxyConnectionImpact") && + !base::FieldTrialList::Find("ProxyConnectionImpact")-> + group_name().empty()); if (use_proxy_connection_impact_histogram) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.Abandoned", "ProxyConnectionImpact"), + base::FieldTrial::MakeName("PLT.Abandoned", "ProxyConnectionImpact"), abandoned_page ? 1 : 0, 2); switch (load_type) { case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad", "ProxyConnectionImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal", "ProxyConnectionImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadReload", "ProxyConnectionImpact"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadStaleOk", "ProxyConnectionImpact"), begin_to_finish_all_loads); break; @@ -5277,35 +5280,35 @@ void RenderView::DumpLoadHistograms() const { // Histograms to determine if SDCH has an impact. // TODO(jar): Consider removing per-link load types and the enumeration. - static bool use_sdch_histogram(FieldTrialList::Find("GlobalSdch") && - !FieldTrialList::Find("GlobalSdch")->group_name().empty()); + static bool use_sdch_histogram(base::FieldTrialList::Find("GlobalSdch") && + !base::FieldTrialList::Find("GlobalSdch")->group_name().empty()); if (use_sdch_histogram) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.LoadType", "GlobalSdch"), + base::FieldTrial::MakeName("PLT.LoadType", "GlobalSdch"), load_type, NavigationState::kLoadTypeMax); switch (load_type) { case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad", "GlobalSdch"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal", "GlobalSdch"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadReload", "GlobalSdch"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadStaleOk", "GlobalSdch"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_ONLY: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadCacheOnly", "GlobalSdch"), begin_to_finish_all_loads); break; @@ -5315,56 +5318,57 @@ void RenderView::DumpLoadHistograms() const { } // Histograms to determine if cache size has an impact on PLT. - static bool use_cache_histogram1(FieldTrialList::Find("CacheSize") && - !FieldTrialList::Find("CacheSize")->group_name().empty()); - if (use_cache_histogram1 && NavigationState::LINK_LOAD_NORMAL <= load_type && + static bool use_cache_histogram1(base::FieldTrialList::Find("CacheSize") && + !base::FieldTrialList::Find("CacheSize")->group_name().empty()); + if (use_cache_histogram1 && + NavigationState::LINK_LOAD_NORMAL <= load_type && NavigationState::LINK_LOAD_CACHE_ONLY >= load_type) { // TODO(mbelshe): Do we really want BeginToFinishDoc here? It seems like // StartToFinish or BeginToFinish would be better. - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinishDoc_LinkLoad", "CacheSize"), begin_to_finish_doc); } // Histograms to determine if cache throttling has an impact on PLT. - static bool use_cache_histogram2(FieldTrialList::Find("CacheThrottle") && - !FieldTrialList::Find("CacheThrottle")->group_name().empty()); + static bool use_cache_histogram2(base::FieldTrialList::Find("CacheThrottle") && + !base::FieldTrialList::Find("CacheThrottle")->group_name().empty()); if (use_cache_histogram2) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.Abandoned", "CacheThrottle"), + base::FieldTrial::MakeName("PLT.Abandoned", "CacheThrottle"), abandoned_page ? 1 : 0, 2); switch (load_type) { case NavigationState::RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_Reload", "CacheThrottle"), begin_to_finish_all_loads); break; case NavigationState::HISTORY_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_HistoryLoad", "CacheThrottle"), begin_to_finish_all_loads); break; case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad", "CacheThrottle"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal", "CacheThrottle"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_RELOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadReload", "CacheThrottle"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_STALE_OK: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadStaleOk", "CacheThrottle"), begin_to_finish_all_loads); break; case NavigationState::LINK_LOAD_CACHE_ONLY: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadCacheOnly", "CacheThrottle"), begin_to_finish_all_loads); break; @@ -5373,7 +5377,7 @@ void RenderView::DumpLoadHistograms() const { } if (NavigationState::RELOAD <= load_type && NavigationState::LINK_LOAD_CACHE_ONLY >= load_type) { - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish", "CacheThrottle"), begin_to_finish_all_loads); } @@ -5385,14 +5389,16 @@ void RenderView::DumpLoadHistograms() const { // if we asked for a HTTP request, we got a HTTP request // Due to spdy version mismatches, it is possible that we ask for SPDY // but didn't get SPDY. - static bool use_spdy_histogram(FieldTrialList::Find("SpdyImpact") && - !FieldTrialList::Find("SpdyImpact")->group_name().empty()); + static bool use_spdy_histogram(base::FieldTrialList::Find("SpdyImpact") && + !base::FieldTrialList::Find("SpdyImpact")->group_name().empty()); if (use_spdy_histogram) { // We take extra effort to only compute these once. static bool in_spdy_trial = - FieldTrialList::Find("SpdyImpact")->group_name() == "npn_with_spdy"; + base::FieldTrialList::Find("SpdyImpact")->group_name() == + "npn_with_spdy"; static bool in_http_trial = - FieldTrialList::Find("SpdyImpact")->group_name() == "npn_with_http"; + base::FieldTrialList::Find("SpdyImpact")->group_name() == + "npn_with_http"; bool spdy_trial_success = navigation_state->was_fetched_via_spdy() ? in_spdy_trial : in_http_trial; @@ -5403,28 +5409,28 @@ void RenderView::DumpLoadHistograms() const { if (scheme_type == URLPattern::SCHEME_HTTPS && navigation_state->was_npn_negotiated()) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), + base::FieldTrial::MakeName("PLT.Abandoned", "SpdyImpact"), abandoned_page ? 1 : 0, 2); switch (load_type) { case NavigationState::LINK_LOAD_NORMAL: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_LinkLoadNormal_SpdyTrial", "SpdyImpact"), begin_to_finish_all_loads); - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.StartToFinish_LinkLoadNormal_SpdyTrial", "SpdyImpact"), start_to_finish_all_loads); - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.StartToCommit_LinkLoadNormal_SpdyTrial", "SpdyImpact"), start_to_commit); break; case NavigationState::NORMAL_LOAD: - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.BeginToFinish_NormalLoad_SpdyTrial", "SpdyImpact"), begin_to_finish_all_loads); - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.StartToFinish_NormalLoad_SpdyTrial", "SpdyImpact"), start_to_finish_all_loads); - PLT_HISTOGRAM(FieldTrial::MakeName( + PLT_HISTOGRAM(base::FieldTrial::MakeName( "PLT.StartToCommit_NormalLoad_SpdyTrial", "SpdyImpact"), start_to_commit); break; @@ -5439,7 +5445,7 @@ void RenderView::DumpLoadHistograms() const { navigation_state->was_alternate_protocol_available()) { if (!navigation_state->was_npn_negotiated()) { // This means that even there is alternate protocols for npn_http or - // npn_spdy, they are not taken (due to the fieldtrial). + // npn_spdy, they are not taken (due to the base::FieldTrial). switch (load_type) { case NavigationState::LINK_LOAD_NORMAL: PLT_HISTOGRAM( diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index f5a7ebe..8880a03 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -7,8 +7,8 @@ #include "app/surface/transport_dib.h" #include "base/command_line.h" #include "base/logging.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/scoped_ptr.h" #include "build/build_config.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/renderer/renderer_histogram_snapshots.cc b/chrome/renderer/renderer_histogram_snapshots.cc index 5246141..ae9ee1d 100644 --- a/chrome/renderer/renderer_histogram_snapshots.cc +++ b/chrome/renderer/renderer_histogram_snapshots.cc @@ -6,15 +6,18 @@ #include <ctype.h> -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/render_process.h" #include "chrome/renderer/render_thread.h" // TODO(raman): Before renderer shuts down send final snapshot lists. +using base::Histogram; +using base::StatisticsRecorder; + RendererHistogramSnapshots::RendererHistogramSnapshots() : ALLOW_THIS_IN_INITIALIZER_LIST( renderer_histogram_snapshots_factory_(this)) { diff --git a/chrome/renderer/renderer_histogram_snapshots.h b/chrome/renderer/renderer_histogram_snapshots.h index d7e3f84..eff6f3e 100644 --- a/chrome/renderer/renderer_histogram_snapshots.h +++ b/chrome/renderer/renderer_histogram_snapshots.h @@ -11,7 +11,7 @@ #include <vector> #include "base/basictypes.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/process.h" #include "base/task.h" @@ -24,17 +24,17 @@ class RendererHistogramSnapshots { void SendHistograms(int sequence_number); // Maintain a map of histogram names to the sample stats we've sent. - typedef std::map<std::string, Histogram::SampleSet> LoggedSampleMap; + typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap; typedef std::vector<std::string> HistogramPickledList; private: // Extract snapshot data and then send it off the the Browser process. // Send only a delta to what we have already sent. void UploadAllHistrograms(int sequence_number); - void UploadHistrogram(const Histogram& histogram, + void UploadHistrogram(const base::Histogram& histogram, HistogramPickledList* histograms); - void UploadHistogramDelta(const Histogram& histogram, - const Histogram::SampleSet& snapshot, + void UploadHistogramDelta(const base::Histogram& histogram, + const base::Histogram::SampleSet& snapshot, HistogramPickledList* histograms); ScopedRunnableMethodFactory<RendererHistogramSnapshots> diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index dae703a..83dcd07 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -10,14 +10,14 @@ #include "app/hi_res_timer_manager.h" #include "app/system_monitor.h" #include "base/command_line.h" -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" +#include "base/metrics/stats_counters.h" #include "base/path_service.h" #include "base/platform_thread.h" #include "base/process_util.h" #include "base/scoped_nsautorelease_pool.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "base/trace_event.h" #include "chrome/common/chrome_constants.h" @@ -223,7 +223,7 @@ int RendererMain(const MainFunctionParams& parameters) { RendererMainPlatformDelegate platform(parameters); - StatsScope<StatsCounterTimer> + base::StatsScope<base::StatsCounterTimer> startup_timer(chrome::Counters::renderer_main()); #if defined(OS_MACOSX) @@ -249,13 +249,13 @@ int RendererMain(const MainFunctionParams& parameters) { // Initialize histogram statistics gathering system. // Don't create StatisticsRecorder in the single process mode. - scoped_ptr<StatisticsRecorder> statistics; - if (!StatisticsRecorder::WasStarted()) { - statistics.reset(new StatisticsRecorder()); + scoped_ptr<base::StatisticsRecorder> statistics; + if (!base::StatisticsRecorder::WasStarted()) { + statistics.reset(new base::StatisticsRecorder()); } // Initialize statistical testing infrastructure. - FieldTrialList field_trial; + base::FieldTrialList field_trial; // Ensure any field trials in browser are reflected into renderer. if (parsed_command_line.HasSwitch(switches::kForceFieldTestNameAndValue)) { std::string persistent = parsed_command_line.GetSwitchValueASCII( diff --git a/chrome/renderer/safe_browsing/features.cc b/chrome/renderer/safe_browsing/features.cc index 40fd97b..29675db 100644 --- a/chrome/renderer/safe_browsing/features.cc +++ b/chrome/renderer/safe_browsing/features.cc @@ -4,8 +4,8 @@ #include "chrome/renderer/safe_browsing/features.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" namespace safe_browsing { diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc index e1db151..1f3e394 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor.cc @@ -6,9 +6,9 @@ #include "base/compiler_specific.h" #include "base/hash_tables.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "chrome/renderer/render_view.h" #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" diff --git a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc index 0ec0dbc..ea5af10 100644 --- a/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_term_feature_extractor.cc @@ -9,10 +9,10 @@ #include "app/l10n_util.h" #include "base/compiler_specific.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/sha2.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" diff --git a/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc b/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc index 54f924a..9298749 100644 --- a/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc +++ b/chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc @@ -8,9 +8,9 @@ #include <string> #include <vector> -#include "base/histogram.h" #include "base/logging.h" #include "base/perftimer.h" +#include "base/metrics/histogram.h" #include "base/string_split.h" #include "base/string_util.h" #include "chrome/renderer/safe_browsing/features.h" diff --git a/chrome/renderer/spellchecker/spellcheck.cc b/chrome/renderer/spellchecker/spellcheck.cc index ab4809e..4220f4a 100644 --- a/chrome/renderer/spellchecker/spellcheck.cc +++ b/chrome/renderer/spellchecker/spellcheck.cc @@ -5,7 +5,7 @@ #include "chrome/renderer/spellchecker/spellcheck.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "chrome/common/render_messages.h" diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc index 032406f..c295294 100644 --- a/chrome/renderer/user_script_slave.cc +++ b/chrome/renderer/user_script_slave.cc @@ -6,11 +6,11 @@ #include "app/resource_bundle.h" #include "base/command_line.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/perftimer.h" #include "base/pickle.h" #include "base/shared_memory.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 292ef48..ea434f6 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -15,19 +15,19 @@ #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #if defined(OS_MACOSX) #include "base/mac_util.h" #endif #include "base/md5.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" +#include "base/metrics/stats_counters.h" #include "base/path_service.h" #include "base/process_util.h" #if defined(OS_MACOSX) #include "base/scoped_cftyperef.h" #endif #include "base/scoped_ptr.h" -#include "base/stats_counters.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/task.h" diff --git a/chrome/test/unit/chrome_test_suite.cc b/chrome/test/unit/chrome_test_suite.cc index d9b9c65..9613341 100644 --- a/chrome/test/unit/chrome_test_suite.cc +++ b/chrome/test/unit/chrome_test_suite.cc @@ -7,9 +7,9 @@ #include "app/app_paths.h" #include "app/resource_bundle.h" #include "base/command_line.h" +#include "base/metrics/stats_table.h" #include "base/process_util.h" #include "base/scoped_nsautorelease_pool.h" -#include "base/stats_table.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/common/chrome_constants.h" @@ -120,8 +120,8 @@ void ChromeTestSuite::Initialize() { std::string pid_string = StringPrintf("-%d", base::GetCurrentProcId()); stats_filename_ += pid_string; RemoveSharedMemoryFile(stats_filename_); - stats_table_ = new StatsTable(stats_filename_, 20, 200); - StatsTable::set_current(stats_table_); + stats_table_ = new base::StatsTable(stats_filename_, 20, 200); + base::StatsTable::set_current(stats_table_); } void ChromeTestSuite::Shutdown() { @@ -135,7 +135,7 @@ void ChromeTestSuite::Shutdown() { g_browser_process = NULL; // Tear down shared StatsTable; prevents unit_tests from leaking it. - StatsTable::set_current(NULL); + base::StatsTable::set_current(NULL); delete stats_table_; RemoveSharedMemoryFile(stats_filename_); diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h index 7f63c4e..87a644d 100644 --- a/chrome/test/unit/chrome_test_suite.h +++ b/chrome/test/unit/chrome_test_suite.h @@ -19,7 +19,9 @@ #include "net/base/mock_host_resolver.h" #include "net/base/net_util.h" +namespace base { class StatsTable; +} // In many cases it may be not obvious that a test makes a real DNS lookup. // We generally don't want to rely on external DNS servers for our tests, @@ -50,7 +52,8 @@ class ChromeTestSuite : public base::TestSuite { browser_dir_ = browser_dir; } - StatsTable* stats_table_; + base::StatsTable* stats_table_; + // The name used for the stats file so it can be cleaned up on posix during // test shutdown. std::string stats_filename_; diff --git a/chrome_frame/chrome_frame_activex_base.h b/chrome_frame/chrome_frame_activex_base.h index 84fccd5..e5b1097 100644 --- a/chrome_frame/chrome_frame_activex_base.h +++ b/chrome_frame/chrome_frame_activex_base.h @@ -16,7 +16,7 @@ #include <string> #include <vector> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/scoped_bstr_win.h" #include "base/scoped_comptr_win.h" #include "base/scoped_variant_win.h" diff --git a/chrome_frame/chrome_frame_histograms.cc b/chrome_frame/chrome_frame_histograms.cc index 3dac19f..a920828 100644 --- a/chrome_frame/chrome_frame_histograms.cc +++ b/chrome_frame/chrome_frame_histograms.cc @@ -4,11 +4,14 @@ #include "chrome_frame/chrome_frame_histograms.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/message_loop.h" +using base::Histogram; +using base::StatisticsRecorder; + // Initialize histogram statistics gathering system. base::LazyInstance<StatisticsRecorder> g_statistics_recorder_(base::LINKER_INITIALIZED); diff --git a/chrome_frame/chrome_frame_histograms.h b/chrome_frame/chrome_frame_histograms.h index 0afcc69..b33efac 100644 --- a/chrome_frame/chrome_frame_histograms.h +++ b/chrome_frame/chrome_frame_histograms.h @@ -11,7 +11,7 @@ #include "base/basictypes.h" #include "base/lock.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/process.h" #include "base/scoped_ptr.h" #include "base/task.h" @@ -26,7 +26,7 @@ class ChromeFrameHistogramSnapshots { public: // Maintain a map of histogram names to the sample stats we've sent. - typedef std::map<std::string, Histogram::SampleSet> LoggedSampleMap; + typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap; typedef std::vector<std::string> HistogramPickledList; ChromeFrameHistogramSnapshots(); @@ -38,11 +38,11 @@ class ChromeFrameHistogramSnapshots { HistogramPickledList GatherAllHistograms(); private: - void GatherHistogram(const Histogram& histogram, + void GatherHistogram(const base::Histogram& histogram, HistogramPickledList* histograms); - void GatherHistogramDelta(const Histogram& histogram, - const Histogram::SampleSet& snapshot, + void GatherHistogramDelta(const base::Histogram& histogram, + const base::Histogram::SampleSet& snapshot, HistogramPickledList* histograms); // For histograms, record what we've already logged (as a sample for each diff --git a/chrome_frame/crash_reporting/crash_metrics.cc b/chrome_frame/crash_reporting/crash_metrics.cc index 81c2296..3a6c9ee 100644 --- a/chrome_frame/crash_reporting/crash_metrics.cc +++ b/chrome_frame/crash_reporting/crash_metrics.cc @@ -4,7 +4,7 @@ #include "chrome_frame/crash_reporting/crash_metrics.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/registry.h" #include "chrome_frame/utils.h" diff --git a/chrome_frame/metrics_service.cc b/chrome_frame/metrics_service.cc index 20d55ce..4e46708 100644 --- a/chrome_frame/metrics_service.cc +++ b/chrome_frame/metrics_service.cc @@ -125,7 +125,7 @@ base::LazyInstance<base::Thread, UploadThreadInstanceTraits> Lock g_metrics_service_lock; -extern base::LazyInstance<StatisticsRecorder> g_statistics_recorder_; +extern base::LazyInstance<base::StatisticsRecorder> g_statistics_recorder_; // This class provides HTTP request context information for metrics upload // requests initiated by ChromeFrame. diff --git a/chrome_frame/metrics_service.h b/chrome_frame/metrics_service.h index 252f716..38eb1f4 100644 --- a/chrome_frame/metrics_service.h +++ b/chrome_frame/metrics_service.h @@ -12,8 +12,8 @@ #include <string> #include "base/basictypes.h" -#include "base/histogram.h" #include "base/lazy_instance.h" +#include "base/metrics/histogram.h" #include "base/platform_thread.h" #include "base/scoped_ptr.h" #include "base/thread_local.h" @@ -49,7 +49,7 @@ class MetricsService : public MetricsServiceBase { }; // Maintain a map of histogram names to the sample stats we've sent. - typedef std::map<std::string, Histogram::SampleSet> LoggedSampleMap; + typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap; // Sets and gets whether metrics recording is active. // SetRecording(false) also forces a persistent save of logging state (if diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h index 8189faf..4ec548a 100644 --- a/chrome_frame/utils.h +++ b/chrome_frame/utils.h @@ -13,9 +13,9 @@ #include <string> #include "base/basictypes.h" -#include "base/histogram.h" #include "base/lock.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/thread.h" #include "gfx/rect.h" #include "googleurl/src/gurl.h" @@ -433,8 +433,8 @@ extern Lock g_ChromeFrameHistogramLock; // Thread safe versions of the UMA histogram macros we use for ChromeFrame. // These should be used for histograms in ChromeFrame. If other histogram -// macros from base/histogram.h are needed then thread safe versions of those -// should be defined and used. +// macros from base/metrics/histogram.h are needed then thread safe versions of +// those should be defined and used. #define THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, \ bucket_count) { \ AutoLock lock(g_ChromeFrameHistogramLock); \ diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc index 1c1b4e6..3dded13 100644 --- a/ipc/ipc_channel_posix.cc +++ b/ipc/ipc_channel_posix.cc @@ -23,7 +23,6 @@ #include "base/process_util.h" #include "base/scoped_ptr.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "ipc/ipc_descriptors.h" #include "ipc/ipc_switches.h" diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index 051bb8d..e6bcd3c 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -11,7 +11,6 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/non_thread_safe.h" -#include "base/stats_counters.h" #include "base/utf_string_conversions.h" #include "base/win_util.h" #include "ipc/ipc_logging.h" diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index 9a07493..09d9f79 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -659,7 +659,7 @@ void AlsaPcmOutputStream::ScheduleNextWrite(bool source_exhausted) { NewRunnableMethod(this, &AlsaPcmOutputStream::WriteTask)); } else { // TODO(ajwong): Measure the reliability of the delay interval. Use - // base/histogram.h. + // base/metrics/histogram.h. message_loop_->PostDelayedTask( FROM_HERE, NewRunnableMethod(this, &AlsaPcmOutputStream::WriteTask), diff --git a/net/base/bandwidth_metrics.h b/net/base/bandwidth_metrics.h index c82d1a9..80fa005 100644 --- a/net/base/bandwidth_metrics.h +++ b/net/base/bandwidth_metrics.h @@ -8,7 +8,7 @@ #include <list> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/time.h" diff --git a/net/base/connection_type_histograms.cc b/net/base/connection_type_histograms.cc index de780f2..5146e91e 100644 --- a/net/base/connection_type_histograms.cc +++ b/net/base/connection_type_histograms.cc @@ -4,7 +4,7 @@ #include "net/base/connection_type_histograms.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" namespace net { diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index fae7671..455a739 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -48,8 +48,8 @@ #include "base/basictypes.h" #include "base/format_macros.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/scoped_ptr.h" #include "base/string_tokenizer.h" #include "base/string_util.h" @@ -148,49 +148,49 @@ CookieMonster::~CookieMonster() { // initialization is based are included in comments below. void CookieMonster::InitializeHistograms() { // From UMA_HISTOGRAM_CUSTOM_COUNTS - histogram_expiration_duration_minutes_ = Histogram::FactoryGet( + histogram_expiration_duration_minutes_ = base::Histogram::FactoryGet( "Cookie.ExpirationDurationMinutes", 1, kMinutesInTenYears, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_between_access_interval_minutes_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_between_access_interval_minutes_ = base::Histogram::FactoryGet( "Cookie.BetweenAccessIntervalMinutes", 1, kMinutesInTenYears, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_evicted_last_access_minutes_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_evicted_last_access_minutes_ = base::Histogram::FactoryGet( "Cookie.EvictedLastAccessMinutes", 1, kMinutesInTenYears, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_count_ = base::Histogram::FactoryGet( "Cookie.Count", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_domain_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_domain_count_ = base::Histogram::FactoryGet( "Cookie.DomainCount", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_etldp1_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_etldp1_count_ = base::Histogram::FactoryGet( "Cookie.Etldp1Count", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_domain_per_etldp1_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_domain_per_etldp1_count_ = base::Histogram::FactoryGet( "Cookie.DomainPerEtldp1Count", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); // From UMA_HISTOGRAM_COUNTS_10000 & UMA_HISTOGRAM_CUSTOM_COUNTS - histogram_number_duplicate_db_cookies_ = Histogram::FactoryGet( + histogram_number_duplicate_db_cookies_ = base::Histogram::FactoryGet( "Net.NumDuplicateCookiesInDb", 1, 10000, 50, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); // From UMA_HISTOGRAM_ENUMERATION - histogram_cookie_deletion_cause_ = LinearHistogram::FactoryGet( + histogram_cookie_deletion_cause_ = base::LinearHistogram::FactoryGet( "Cookie.DeletionCause", 1, DELETE_COOKIE_LAST_ENTRY - 1, DELETE_COOKIE_LAST_ENTRY, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); // From UMA_HISTOGRAM_{CUSTOM_,}TIMES - histogram_time_get_ = Histogram::FactoryTimeGet("Cookie.TimeGet", + histogram_time_get_ = base::Histogram::FactoryTimeGet("Cookie.TimeGet", base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), - 50, Histogram::kUmaTargetedHistogramFlag); - histogram_time_load_ = Histogram::FactoryTimeGet("Cookie.TimeLoad", + 50, base::Histogram::kUmaTargetedHistogramFlag); + histogram_time_load_ = base::Histogram::FactoryTimeGet("Cookie.TimeLoad", base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), - 50, Histogram::kUmaTargetedHistogramFlag); + 50, base::Histogram::kUmaTargetedHistogramFlag); } void CookieMonster::InitStore() { diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 33953d9..2f18283 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -22,7 +22,10 @@ #include "net/base/cookie_store.h" class GURL; + +namespace base { class Histogram; +} namespace net { @@ -409,17 +412,17 @@ class CookieMonster : public CookieStore { // Histogram variables; see CookieMonster::InitializeHistograms() in // cookie_monster.cc for details. - scoped_refptr<Histogram> histogram_expiration_duration_minutes_; - scoped_refptr<Histogram> histogram_between_access_interval_minutes_; - scoped_refptr<Histogram> histogram_evicted_last_access_minutes_; - scoped_refptr<Histogram> histogram_count_; - scoped_refptr<Histogram> histogram_domain_count_; - scoped_refptr<Histogram> histogram_etldp1_count_; - scoped_refptr<Histogram> histogram_domain_per_etldp1_count_; - scoped_refptr<Histogram> histogram_number_duplicate_db_cookies_; - scoped_refptr<Histogram> histogram_cookie_deletion_cause_; - scoped_refptr<Histogram> histogram_time_get_; - scoped_refptr<Histogram> histogram_time_load_; + scoped_refptr<base::Histogram> histogram_expiration_duration_minutes_; + scoped_refptr<base::Histogram> histogram_between_access_interval_minutes_; + scoped_refptr<base::Histogram> histogram_evicted_last_access_minutes_; + scoped_refptr<base::Histogram> histogram_count_; + scoped_refptr<base::Histogram> histogram_domain_count_; + scoped_refptr<base::Histogram> histogram_etldp1_count_; + scoped_refptr<base::Histogram> histogram_domain_per_etldp1_count_; + scoped_refptr<base::Histogram> histogram_number_duplicate_db_cookies_; + scoped_refptr<base::Histogram> histogram_cookie_deletion_cause_; + scoped_refptr<base::Histogram> histogram_time_get_; + scoped_refptr<base::Histogram> histogram_time_load_; // Initialize the above variables; should only be called from // the constructor. diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc index 45c4cfb..1e20efe 100644 --- a/net/base/file_stream_posix.cc +++ b/net/base/file_stream_posix.cc @@ -17,9 +17,9 @@ #include "base/callback.h" #include "base/eintr_wrapper.h" #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/waitable_event.h" #include "base/worker_pool.h" diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc index 234ddf9..9408ae0 100644 --- a/net/base/file_stream_win.cc +++ b/net/base/file_stream_win.cc @@ -7,9 +7,9 @@ #include <windows.h> #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "net/base/net_errors.h" namespace net { diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 6d1e2ba..e3e3a94 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -17,9 +17,9 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/debug_util.h" -#include "base/histogram.h" #include "base/lock.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc index 4ad4e1d..1a52b99 100644 --- a/net/base/mime_sniffer.cc +++ b/net/base/mime_sniffer.cc @@ -97,8 +97,8 @@ #include "net/base/mime_sniffer.h" #include "base/basictypes.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" #include "net/base/mime_util.h" @@ -207,11 +207,11 @@ static const MagicNumber kSniffableTags[] = { MAGIC_HTML_TAG("p") // Mozilla }; -static scoped_refptr<Histogram> UMASnifferHistogramGet(const char* name, - int array_size) { - scoped_refptr<Histogram> counter = - LinearHistogram::FactoryGet(name, 1, array_size - 1, array_size, - Histogram::kUmaTargetedHistogramFlag); +static scoped_refptr<base::Histogram> UMASnifferHistogramGet(const char* name, + int array_size) { + scoped_refptr<base::Histogram> counter = + base::LinearHistogram::FactoryGet(name, 1, array_size - 1, array_size, + base::Histogram::kUmaTargetedHistogramFlag); return counter; } @@ -251,7 +251,7 @@ static bool MatchMagicNumber(const char* content, size_t size, static bool CheckForMagicNumbers(const char* content, size_t size, const MagicNumber* magic, size_t magic_len, - Histogram* counter, std::string* result) { + base::Histogram* counter, std::string* result) { for (size_t i = 0; i < magic_len; ++i) { if (MatchMagicNumber(content, size, &(magic[i]), result)) { if (counter) counter->Add(static_cast<int>(i)); @@ -292,7 +292,7 @@ static bool SniffForHTML(const char* content, if (!IsAsciiWhitespace(*pos)) break; } - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTags2", arraysize(kSniffableTags)); // |pos| now points to first non-whitespace character (or at end). @@ -310,7 +310,7 @@ static bool SniffForMagicNumbers(const char* content, *have_enough_content &= TruncateSize(kBytesRequiredForMagic, &size); // Check our big table of Magic Numbers - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kMagicNumbers2", arraysize(kMagicNumbers)); return CheckForMagicNumbers(content, size, @@ -351,7 +351,7 @@ static bool SniffXML(const char* content, // We want to skip XML processing instructions (of the form "<?xml ...") // and stop at the first "plain" tag, then make a decision on the mime-type // based on the name (or possibly attributes) of that tag. - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kMagicXML2", arraysize(kMagicXML)); const int kMaxTagIterations = 5; @@ -435,7 +435,7 @@ static bool SniffBinary(const char* content, const bool is_truncated = TruncateSize(kMaxBytesToSniff, &size); // First, we look for a BOM. - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kByteOrderMark2", arraysize(kByteOrderMark)); std::string unused; @@ -477,7 +477,7 @@ static bool IsUnknownMimeType(const std::string& mime_type) { // Firefox rejects a mime type if it is exactly */* "*/*", }; - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kUnknownMimeTypes2", arraysize(kUnknownMimeTypes) + 1); for (size_t i = 0; i < arraysize(kUnknownMimeTypes); ++i) { @@ -503,7 +503,7 @@ static bool SniffCRX(const char* content, const std::string& type_hint, bool* have_enough_content, std::string* result) { - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffCRX", 3); // Technically, the crx magic number is just Cr24, but the bytes after that @@ -541,7 +541,7 @@ static bool SniffCRX(const char* content, } bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) { - static scoped_refptr<Histogram> should_sniff_counter = + static scoped_refptr<base::Histogram> should_sniff_counter = UMASnifferHistogramGet("mime_sniffer.ShouldSniffMimeType2", 3); // We are willing to sniff the mime type for HTTP, HTTPS, and FTP bool sniffable_scheme = url.is_empty() || @@ -566,7 +566,7 @@ bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) { "text/xml", "application/xml", }; - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTypes2", arraysize(kSniffableTypes) + 1); for (size_t i = 0; i < arraysize(kSniffableTypes); ++i) { diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 9afae4c..27621e6 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -34,7 +34,6 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/i18n/file_util_icu.h" #include "base/i18n/icu_string_conversions.h" #include "base/i18n/time_formatting.h" @@ -42,6 +41,7 @@ #include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/singleton.h" #include "base/stl_util-inl.h" diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc index 5f2207d..685d8df 100644 --- a/net/base/run_all_unittests.cc +++ b/net/base/run_all_unittests.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "build/build_config.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/nss_util.h" #include "net/base/net_test_suite.h" #include "net/http/http_stream_factory.h" @@ -13,7 +13,7 @@ int main(int argc, char** argv) { // Record histograms, so we can get histograms data in tests. - StatisticsRecorder recorder; + base::StatisticsRecorder recorder; NetTestSuite test_suite(argc, argv); #if defined(OS_WIN) diff --git a/net/base/sdch_filter.cc b/net/base/sdch_filter.cc index a2b13d4..cc9a1d6 100644 --- a/net/base/sdch_filter.cc +++ b/net/base/sdch_filter.cc @@ -7,8 +7,8 @@ #include <algorithm> #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "net/base/sdch_filter.h" #include "net/base/sdch_manager.h" diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc index 21cbe07..15850d6 100644 --- a/net/base/sdch_manager.cc +++ b/net/base/sdch_manager.cc @@ -5,9 +5,8 @@ #include "net/base/sdch_manager.h" #include "base/base64.h" -#include "base/field_trial.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/sha2.h" #include "base/string_number_conversions.h" #include "base/string_util.h" diff --git a/net/base/x509_certificate.cc b/net/base/x509_certificate.cc index 6395b97..e21a3bc 100644 --- a/net/base/x509_certificate.cc +++ b/net/base/x509_certificate.cc @@ -6,8 +6,8 @@ #include <map> -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/singleton.h" #include "base/string_piece.h" #include "base/time.h" diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 5086e2b..2ad91e0 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -4,11 +4,11 @@ #include "net/disk_cache/backend_impl.h" -#include "base/field_trial.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/string_util.h" #include "base/stringprintf.h" @@ -192,11 +192,12 @@ bool SetFieldTrialInfo(int size_group) { // Field trials involve static objects so we have to do this only once. first = false; - scoped_refptr<FieldTrial> trial1 = new FieldTrial("CacheSize", 10); + scoped_refptr<base::FieldTrial> trial1 = + new base::FieldTrial("CacheSize", 10); std::string group1 = base::StringPrintf("CacheSizeGroup_%d", size_group); - trial1->AppendGroup(group1, FieldTrial::kAllRemainingProbability); + trial1->AppendGroup(group1, base::FieldTrial::kAllRemainingProbability); - scoped_refptr<FieldTrial> trial2 = new FieldTrial("CacheThrottle", 100); + scoped_refptr<base::FieldTrial> trial2 = new base::FieldTrial("CacheThrottle", 100); int group2a = trial2->AppendGroup("CacheThrottle_On", 10); // 10 % in. trial2->AppendGroup("CacheThrottle_Off", 10); // 10 % control. @@ -1235,9 +1236,9 @@ void BackendImpl::OnOperationCompleted(base::TimeDelta elapsed_time) { if (cache_type() != net::DISK_CACHE) return; - UMA_HISTOGRAM_TIMES( - FieldTrial::MakeName("DiskCache.TotalIOTime", "CacheThrottle").data(), - elapsed_time); + UMA_HISTOGRAM_TIMES(base::FieldTrial::MakeName("DiskCache.TotalIOTime", + "CacheThrottle").data(), + elapsed_time); if (!throttle_requests_) return; diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc index 2b849fc..9d5de62 100644 --- a/net/disk_cache/block_files.cc +++ b/net/disk_cache/block_files.cc @@ -5,7 +5,7 @@ #include "net/disk_cache/block_files.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/thread_checker.h" diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 24796ea..7fabbe5 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -4,8 +4,8 @@ #include "net/disk_cache/entry_impl.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" diff --git a/net/disk_cache/histogram_macros.h b/net/disk_cache/histogram_macros.h index 2505a8a..044302c 100644 --- a/net/disk_cache/histogram_macros.h +++ b/net/disk_cache/histogram_macros.h @@ -20,10 +20,11 @@ #define CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ do { \ - static scoped_refptr<Histogram> counter; \ + static scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ - counter = Histogram::FactoryGet(name, min, max, bucket_count, \ - Histogram::kUmaTargetedHistogramFlag); \ + counter = base::Histogram::FactoryGet( \ + name, min, max, bucket_count, \ + base::Histogram::kUmaTargetedHistogramFlag); \ counter->Add(sample); \ } while (0) @@ -38,10 +39,11 @@ #define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ do { \ - static scoped_refptr<Histogram> counter; \ + static scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ - counter = Histogram::FactoryTimeGet(name, min, max, bucket_count, \ - Histogram::kUmaTargetedHistogramFlag); \ + counter = base::Histogram::FactoryTimeGet( \ + name, min, max, bucket_count, \ + base::Histogram::kUmaTargetedHistogramFlag); \ counter->AddTime(sample); \ } while (0) @@ -50,11 +52,11 @@ base::TimeDelta::FromSeconds(10), 50) #define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ - static scoped_refptr<Histogram> counter; \ + static scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ - counter = LinearHistogram::FactoryGet( \ + counter = base::LinearHistogram::FactoryGet( \ name, 1, boundary_value, boundary_value + 1, \ - Histogram::kUmaTargetedHistogramFlag); \ + base::Histogram::kUmaTargetedHistogramFlag); \ counter->Add(sample); \ } while (0) @@ -70,12 +72,13 @@ // HISTOGRAM_AGE will collect time elapsed since |initial_time|, with a // granularity of hours and normal values of a few months. #define CACHE_HISTOGRAM_AGE(name, initial_time) \ - CACHE_HISTOGRAM_COUNTS_10000(name, (Time::Now() - initial_time).InHours()) + CACHE_HISTOGRAM_COUNTS_10000(name, \ + (base::Time::Now() - initial_time).InHours()) // HISTOGRAM_AGE_MS will collect time elapsed since |initial_time|, with the // normal resolution of the UMA_HISTOGRAM_TIMES. #define CACHE_HISTOGRAM_AGE_MS(name, initial_time)\ - CACHE_HISTOGRAM_TIMES(name, TimeTicks::Now() - initial_time) + CACHE_HISTOGRAM_TIMES(name, base::TimeTicks::Now() - initial_time) #define CACHE_HISTOGRAM_CACHE_ERROR(name, sample) \ CACHE_HISTOGRAM_ENUMERATION(name, sample, 50) diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc index 5c0313b..1e9e06b 100644 --- a/net/disk_cache/rankings.cc +++ b/net/disk_cache/rankings.cc @@ -4,7 +4,7 @@ #include "net/disk_cache/rankings.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "net/disk_cache/backend_impl.h" #include "net/disk_cache/entry_impl.h" #include "net/disk_cache/errors.h" diff --git a/net/disk_cache/stats_histogram.cc b/net/disk_cache/stats_histogram.cc index e6eaf90..06ed1b3 100644 --- a/net/disk_cache/stats_histogram.cc +++ b/net/disk_cache/stats_histogram.cc @@ -9,6 +9,9 @@ namespace disk_cache { +using base::Histogram; +using base::StatisticsRecorder; + // Static. const Stats* StatsHistogram::stats_ = NULL; diff --git a/net/disk_cache/stats_histogram.h b/net/disk_cache/stats_histogram.h index 1c2e15a..cbd8f03 100644 --- a/net/disk_cache/stats_histogram.h +++ b/net/disk_cache/stats_histogram.h @@ -8,7 +8,7 @@ #include <string> -#include "base/histogram.h" +#include "base/metrics/histogram.h" namespace disk_cache { @@ -21,7 +21,7 @@ class Stats; // Class derivation of Histogram "deprecated," and should not be copied, and // may eventually go away. // -class StatsHistogram : public Histogram { +class StatsHistogram : public base::Histogram { public: class StatsSamples : public SampleSet { public: @@ -46,8 +46,6 @@ class StatsHistogram : public Histogram { virtual void SnapshotSample(SampleSet* sample) const; private: - friend class Histogram; - bool init_; static const Stats* stats_; DISALLOW_COPY_AND_ASSIGN(StatsHistogram); diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 8812843..7197ae9b 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -5,7 +5,7 @@ #include "net/ftp/ftp_network_transaction.h" #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" diff --git a/net/ftp/ftp_server_type_histograms.cc b/net/ftp/ftp_server_type_histograms.cc index de90d72..591545b 100644 --- a/net/ftp/ftp_server_type_histograms.cc +++ b/net/ftp/ftp_server_type_histograms.cc @@ -4,7 +4,7 @@ #include "net/ftp/ftp_server_type_histograms.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" namespace net { diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc index 736ffa9..545ae2a 100644 --- a/net/http/http_auth_controller.cc +++ b/net/http/http_auth_controller.cc @@ -4,7 +4,7 @@ #include "net/http/http_auth_controller.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "net/base/auth.h" diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc index ccb8766..d6e6a62 100644 --- a/net/http/http_auth_handler.cc +++ b/net/http/http_auth_handler.cc @@ -4,8 +4,8 @@ #include "net/http/http_auth_handler.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "net/base/net_errors.h" @@ -52,11 +52,11 @@ bool HttpAuthHandler::InitFromChallenge( DCHECK(!ok || properties_ != -1); if (ok) - histogram_ = Histogram::FactoryTimeGet( + histogram_ = base::Histogram::FactoryTimeGet( GenerateHistogramNameFromScheme(scheme()), base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(10), 50, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); return ok; } diff --git a/net/http/http_auth_handler.h b/net/http/http_auth_handler.h index 4c03a01..908b065 100644 --- a/net/http/http_auth_handler.h +++ b/net/http/http_auth_handler.h @@ -14,7 +14,9 @@ #include "net/base/net_log.h" #include "net/http/http_auth.h" +namespace base { class Histogram; +} namespace net { @@ -187,7 +189,7 @@ class HttpAuthHandler { CompletionCallbackImpl<HttpAuthHandler> wrapper_callback_; // When GenerateAuthToken was called. base::TimeTicks generate_auth_token_start_; - scoped_refptr<Histogram> histogram_; + scoped_refptr<base::Histogram> histogram_; }; } // namespace net diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 138cd13..5d05616 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -13,8 +13,8 @@ #include <string> #include "base/compiler_specific.h" -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/ref_counted.h" #include "base/string_util.h" #include "base/time.h" @@ -856,11 +856,11 @@ int HttpCache::Transaction::DoAddToEntryComplete(int result) { base::TimeTicks::Now() - entry_lock_waiting_since_; UMA_HISTOGRAM_TIMES("HttpCache.EntryLockWait", entry_lock_wait); static const bool prefetching_fieldtrial = - FieldTrialList::Find("Prefetch") && - !FieldTrialList::Find("Prefetch")->group_name().empty(); + base::FieldTrialList::Find("Prefetch") && + !base::FieldTrialList::Find("Prefetch")->group_name().empty(); if (prefetching_fieldtrial) { UMA_HISTOGRAM_TIMES( - FieldTrial::MakeName("HttpCache.EntryLockWait", "Prefetch"), + base::FieldTrial::MakeName("HttpCache.EntryLockWait", "Prefetch"), entry_lock_wait); } diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc index cf93500..38f95ef 100644 --- a/net/http/http_network_layer.cc +++ b/net/http/http_network_layer.cc @@ -4,7 +4,6 @@ #include "net/http/http_network_layer.h" -#include "base/field_trial.h" #include "base/logging.h" #include "base/string_split.h" #include "base/string_util.h" diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 8ef9aca..bf1c0e9 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -8,11 +8,11 @@ #include <vector> #include "base/compiler_specific.h" -#include "base/field_trial.h" #include "base/format_macros.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" +#include "base/metrics/stats_counters.h" #include "base/scoped_ptr.h" -#include "base/stats_counters.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -976,11 +976,11 @@ void HttpNetworkTransaction::LogTransactionConnectedMetrics() { 100); static bool use_conn_impact_histogram( - FieldTrialList::Find("ConnCountImpact") && - !FieldTrialList::Find("ConnCountImpact")->group_name().empty()); + base::FieldTrialList::Find("ConnCountImpact") && + !base::FieldTrialList::Find("ConnCountImpact")->group_name().empty()); if (use_conn_impact_histogram) { UMA_HISTOGRAM_CLIPPED_TIMES( - FieldTrial::MakeName("Net.Transaction_Connected_New", + base::FieldTrial::MakeName("Net.Transaction_Connected_New", "ConnCountImpact"), total_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), @@ -988,17 +988,19 @@ void HttpNetworkTransaction::LogTransactionConnectedMetrics() { } } - static bool use_spdy_histogram(FieldTrialList::Find("SpdyImpact") && - !FieldTrialList::Find("SpdyImpact")->group_name().empty()); + static bool use_spdy_histogram(base::FieldTrialList::Find("SpdyImpact") && + !base::FieldTrialList::Find("SpdyImpact")->group_name().empty()); if (use_spdy_histogram && response_.was_npn_negotiated) { UMA_HISTOGRAM_CLIPPED_TIMES( - FieldTrial::MakeName("Net.Transaction_Connected_Under_10", "SpdyImpact"), + base::FieldTrial::MakeName("Net.Transaction_Connected_Under_10", + "SpdyImpact"), total_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); if (!reused_socket) { UMA_HISTOGRAM_CLIPPED_TIMES( - FieldTrial::MakeName("Net.Transaction_Connected_New", "SpdyImpact"), + base::FieldTrial::MakeName("Net.Transaction_Connected_New", + "SpdyImpact"), total_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); } diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 512f509..0e7610c 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -5,7 +5,7 @@ #include "net/http/http_stream_parser.h" #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "net/base/auth.h" #include "net/base/io_buffer.h" #include "net/base/ssl_cert_request_info.h" diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc index 3faeb54..fbb734f 100644 --- a/net/ocsp/nss_ocsp.cc +++ b/net/ocsp/nss_ocsp.cc @@ -17,11 +17,11 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/condition_variable.h" -#include "base/histogram.h" #include "base/lazy_instance.h" #include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/thread.h" diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc index 4307b5e..962271f 100644 --- a/net/proxy/proxy_resolver_winhttp.cc +++ b/net/proxy/proxy_resolver_winhttp.cc @@ -7,7 +7,7 @@ #include <windows.h> #include <winhttp.h> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 2884d27..632e63b 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -9,7 +9,6 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/values.h" -#include "base/histogram.h" #include "base/message_loop.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" diff --git a/net/socket/client_socket.cc b/net/socket/client_socket.cc index 0edee70..8be3ae1 100644 --- a/net/socket/client_socket.cc +++ b/net/socket/client_socket.cc @@ -4,8 +4,8 @@ #include "net/socket/client_socket.h" -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" namespace net { @@ -46,12 +46,12 @@ void ClientSocket::UseHistory::EmitPreconnectionHistograms() const { UMA_HISTOGRAM_ENUMERATION("Net.PreconnectUtilization2", result, 9); static const bool connect_backup_jobs_fieldtrial = - FieldTrialList::Find("ConnnectBackupJobs") && - !FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty(); + base::FieldTrialList::Find("ConnnectBackupJobs") && + !base::FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty(); if (connect_backup_jobs_fieldtrial) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("Net.PreconnectUtilization2", - "ConnnectBackupJobs"), + base::FieldTrial::MakeName("Net.PreconnectUtilization2", + "ConnnectBackupJobs"), result, 9); } } diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc index f9ab8985..6184905 100644 --- a/net/socket/client_socket_handle.cc +++ b/net/socket/client_socket_handle.cc @@ -5,7 +5,7 @@ #include "net/socket/client_socket_handle.h" #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "net/base/net_errors.h" #include "net/socket/client_socket_pool.h" diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 13d8b68..75abae6d 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "base/format_macros.h" #include "base/message_loop.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" diff --git a/net/socket/client_socket_pool_histograms.cc b/net/socket/client_socket_pool_histograms.cc index 873bd5b..202112b 100644 --- a/net/socket/client_socket_pool_histograms.cc +++ b/net/socket/client_socket_pool_histograms.cc @@ -6,12 +6,15 @@ #include <string> -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "net/socket/client_socket_handle.h" namespace net { +using base::Histogram; +using base::LinearHistogram; + ClientSocketPoolHistograms::ClientSocketPoolHistograms( const std::string& pool_name) : is_http_proxy_connection_(false), @@ -56,11 +59,12 @@ void ClientSocketPoolHistograms::AddRequestTime(base::TimeDelta time) const { request_time_->AddTime(time); static bool proxy_connection_impact_trial_exists( - FieldTrialList::Find("ProxyConnectionImpact") && - !FieldTrialList::Find("ProxyConnectionImpact")->group_name().empty()); + base::FieldTrialList::Find("ProxyConnectionImpact") && + !base::FieldTrialList::Find("ProxyConnectionImpact")-> + group_name().empty()); if (proxy_connection_impact_trial_exists && is_http_proxy_connection_) { UMA_HISTOGRAM_CUSTOM_TIMES( - FieldTrial::MakeName("Net.HttpProxySocketRequestTime", + base::FieldTrial::MakeName("Net.HttpProxySocketRequestTime", "ProxyConnectionImpact"), time, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), @@ -68,7 +72,7 @@ void ClientSocketPoolHistograms::AddRequestTime(base::TimeDelta time) const { } if (proxy_connection_impact_trial_exists && is_socks_connection_) { UMA_HISTOGRAM_CUSTOM_TIMES( - FieldTrial::MakeName("Net.SocksSocketRequestTime", + base::FieldTrial::MakeName("Net.SocksSocketRequestTime", "ProxyConnectionImpact"), time, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), diff --git a/net/socket/client_socket_pool_histograms.h b/net/socket/client_socket_pool_histograms.h index 41aad57..ace8a0d 100644 --- a/net/socket/client_socket_pool_histograms.h +++ b/net/socket/client_socket_pool_histograms.h @@ -11,7 +11,9 @@ #include "base/time.h" #include "base/ref_counted.h" +namespace base { class Histogram; +} namespace net { @@ -26,10 +28,10 @@ class ClientSocketPoolHistograms { void AddReusedIdleTime(base::TimeDelta time) const; private: - scoped_refptr<Histogram> socket_type_; - scoped_refptr<Histogram> request_time_; - scoped_refptr<Histogram> unused_idle_time_; - scoped_refptr<Histogram> reused_idle_time_; + scoped_refptr<base::Histogram> socket_type_; + scoped_refptr<base::Histogram> request_time_; + scoped_refptr<base::Histogram> unused_idle_time_; + scoped_refptr<base::Histogram> reused_idle_time_; bool is_http_proxy_connection_; bool is_socks_connection_; diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index ba135e1..aa8c7fc 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -64,7 +64,7 @@ #include <limits> #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/nss_util.h" #include "base/singleton.h" diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index 4ff1b48..64852f2 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -11,7 +11,7 @@ #include <openssl/err.h> #include "net/base/cert_verifier.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "net/base/net_errors.h" #include "net/base/openssl_util.h" #include "net/base/ssl_connection_status_flags.h" diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 22d921a..a338a7f 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -4,7 +4,7 @@ #include "net/socket/ssl_client_socket_pool.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/values.h" #include "net/base/net_errors.h" #include "net/base/ssl_cert_request_info.h" @@ -316,18 +316,19 @@ int SSLConnectJob::DoSSLConnectComplete(int result) { DCHECK(ssl_connect_start_time_ != base::TimeTicks()); base::TimeDelta connect_duration = base::TimeTicks::Now() - ssl_connect_start_time_; - if (using_spdy) + if (using_spdy) { UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency", connect_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); - else + } else { UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency", connect_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); + } } if (result == OK || IsCertificateError(result)) { diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index 889bfc0..86d6afe9 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -16,7 +16,7 @@ #include "base/eintr_wrapper.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "net/base/address_list_net_log_param.h" #include "net/base/io_buffer.h" @@ -139,7 +139,7 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) { if (socket_ != kInvalidSocket) return OK; - static StatsCounter connects("tcp.connect"); + static base::StatsCounter connects("tcp.connect"); connects.Increment(); DCHECK(!waiting_connect()); @@ -328,7 +328,7 @@ int TCPClientSocketLibevent::Read(IOBuffer* buf, int nread = HANDLE_EINTR(read(socket_, buf->data(), buf_len)); if (nread >= 0) { - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(nread); if (nread > 0) use_history_.set_was_used_to_convey_data(); @@ -367,7 +367,7 @@ int TCPClientSocketLibevent::Write(IOBuffer* buf, int nwrite = HANDLE_EINTR(write(socket_, buf->data(), buf_len)); if (nwrite >= 0) { - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(nwrite); if (nwrite > 0) use_history_.set_was_used_to_convey_data(); @@ -487,7 +487,7 @@ void TCPClientSocketLibevent::DidCompleteRead() { int result; if (bytes_transferred >= 0) { result = bytes_transferred; - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(bytes_transferred); if (bytes_transferred > 0) use_history_.set_was_used_to_convey_data(); @@ -514,7 +514,7 @@ void TCPClientSocketLibevent::DidCompleteWrite() { int result; if (bytes_transferred >= 0) { result = bytes_transferred; - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(bytes_transferred); if (bytes_transferred > 0) use_history_.set_was_used_to_convey_data(); diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc index f11ae25..820f58e 100644 --- a/net/socket/tcp_client_socket_pool.cc +++ b/net/socket/tcp_client_socket_pool.cc @@ -5,9 +5,9 @@ #include "net/socket/tcp_client_socket_pool.h" #include "base/compiler_specific.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/time.h" #include "net/base/net_log.h" diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index 0275f18..9bbb034 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory_debug.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "base/sys_info.h" #include "net/base/address_list_net_log_param.h" @@ -311,7 +311,7 @@ int TCPClientSocketWin::Connect(CompletionCallback* callback) { if (socket_ != INVALID_SOCKET) return OK; - static StatsCounter connects("tcp.connect"); + static base::StatsCounter connects("tcp.connect"); connects.Increment(); net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT, @@ -564,7 +564,7 @@ int TCPClientSocketWin::Read(IOBuffer* buf, // false error reports. // See bug 5297. base::MemoryDebug::MarkAsInitialized(core_->read_buffer_.buf, num); - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(num); if (num > 0) use_history_.set_was_used_to_convey_data(); @@ -594,7 +594,7 @@ int TCPClientSocketWin::Write(IOBuffer* buf, DCHECK_GT(buf_len, 0); DCHECK(!core_->write_iobuffer_); - static StatsCounter writes("tcp.writes"); + static base::StatsCounter writes("tcp.writes"); writes.Increment(); core_->write_buffer_.len = buf_len; @@ -616,7 +616,7 @@ int TCPClientSocketWin::Write(IOBuffer* buf, << " bytes, but " << rv << " bytes reported."; return ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES; } - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(rv); if (rv > 0) use_history_.set_was_used_to_convey_data(); @@ -777,7 +777,7 @@ void TCPClientSocketWin::DidCompleteRead() { waiting_read_ = false; core_->read_iobuffer_ = NULL; if (ok) { - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(num_bytes); if (num_bytes > 0) use_history_.set_was_used_to_convey_data(); @@ -808,7 +808,7 @@ void TCPClientSocketWin::DidCompleteWrite() { << " bytes reported."; rv = ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES; } else { - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(num_bytes); if (num_bytes > 0) use_history_.set_was_used_to_convey_data(); diff --git a/net/socket_stream/socket_stream_metrics.cc b/net/socket_stream/socket_stream_metrics.cc index 71239af..108e829 100644 --- a/net/socket_stream/socket_stream_metrics.cc +++ b/net/socket_stream/socket_stream_metrics.cc @@ -6,7 +6,7 @@ #include <string.h> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "googleurl/src/gurl.h" diff --git a/net/socket_stream/socket_stream_metrics_unittest.cc b/net/socket_stream/socket_stream_metrics_unittest.cc index 7d44f79..64718e3 100644 --- a/net/socket_stream/socket_stream_metrics_unittest.cc +++ b/net/socket_stream/socket_stream_metrics_unittest.cc @@ -3,12 +3,15 @@ // found in the LICENSE file. #include "base/basictypes.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "googleurl/src/gurl.h" #include "net/socket_stream/socket_stream_metrics.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +using base::Histogram; +using base::StatisticsRecorder; + namespace net { TEST(SocketStreamMetricsTest, Initialize) { diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index b10eee8..af8e305 100644 --- a/net/spdy/spdy_framer.cc +++ b/net/spdy/spdy_framer.cc @@ -4,9 +4,8 @@ #include "net/spdy/spdy_framer.h" +#include "base/metrics/stats_counters.h" #include "base/scoped_ptr.h" -#include "base/stats_counters.h" - #include "net/spdy/spdy_frame_builder.h" #include "net/spdy/spdy_bitmasks.h" @@ -915,9 +914,9 @@ SpdyFrame* SpdyFramer::CompressFrameWithZStream(const SpdyFrame& frame, int header_length; const char* payload; - static StatsCounter compressed_frames("spdy.CompressedFrames"); - static StatsCounter pre_compress_bytes("spdy.PreCompressSize"); - static StatsCounter post_compress_bytes("spdy.PostCompressSize"); + static base::StatsCounter compressed_frames("spdy.CompressedFrames"); + static base::StatsCounter pre_compress_bytes("spdy.PreCompressSize"); + static base::StatsCounter post_compress_bytes("spdy.PostCompressSize"); if (!enable_compression_) return DuplicateFrame(frame); @@ -968,9 +967,9 @@ SpdyFrame* SpdyFramer::DecompressFrameWithZStream(const SpdyFrame& frame, int header_length; const char* payload; - static StatsCounter decompressed_frames("spdy.DecompressedFrames"); - static StatsCounter pre_decompress_bytes("spdy.PreDeCompressSize"); - static StatsCounter post_decompress_bytes("spdy.PostDeCompressSize"); + static base::StatsCounter decompressed_frames("spdy.DecompressedFrames"); + static base::StatsCounter pre_decompress_bytes("spdy.PreDeCompressSize"); + static base::StatsCounter post_decompress_bytes("spdy.PostDeCompressSize"); if (!enable_compression_) return DuplicateFrame(frame); diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index d0ebff9..3967a81 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -8,7 +8,7 @@ #include "base/linked_ptr.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -284,7 +284,7 @@ net::Error SpdySession::InitializeWithSocket( ClientSocketHandle* connection, bool is_secure, int certificate_error_code) { - static StatsCounter spdy_sessions("spdy.sessions"); + static base::StatsCounter spdy_sessions("spdy.sessions"); spdy_sessions.Increment(); AdjustSocketBufferSizes(connection->socket()); @@ -452,7 +452,7 @@ int SpdySession::WriteSynStream( flags, false, headers.get())); QueueFrame(syn_frame.get(), priority, stream); - static StatsCounter spdy_requests("spdy.requests"); + static base::StatsCounter spdy_requests("spdy.requests"); spdy_requests.Increment(); streams_initiated_count_++; @@ -766,8 +766,9 @@ void SpdySession::WriteSocket() { } void SpdySession::CloseAllStreams(net::Error status) { - static StatsCounter abandoned_streams("spdy.abandoned_streams"); - static StatsCounter abandoned_push_streams("spdy.abandoned_push_streams"); + static base::StatsCounter abandoned_streams("spdy.abandoned_streams"); + static base::StatsCounter abandoned_push_streams( + "spdy.abandoned_push_streams"); if (!active_streams_.empty()) abandoned_streams.Add(active_streams_.size()); @@ -914,7 +915,7 @@ void SpdySession::RemoveFromPool() { scoped_refptr<SpdyStream> SpdySession::GetActivePushStream( const std::string& path) { - static StatsCounter used_push_streams("spdy.claimed_push_streams"); + static base::StatsCounter used_push_streams("spdy.claimed_push_streams"); PushedStreamMap::iterator it = unclaimed_pushed_streams_.find(path); if (it != unclaimed_pushed_streams_.end()) { @@ -1063,7 +1064,7 @@ void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame, if (!Respond(*headers, stream)) return; - static StatsCounter push_requests("spdy.pushed_streams"); + static base::StatsCounter push_requests("spdy.pushed_streams"); push_requests.Increment(); } diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc index 14f7afb..b976ce2 100644 --- a/net/tools/fetch/fetch_client.cc +++ b/net/tools/fetch/fetch_client.cc @@ -7,8 +7,8 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/completion_callback.h" @@ -86,7 +86,7 @@ class Client { } // Deal with received data here. - static StatsCounter bytes_read("FetchClient.bytes_read"); + static base::StatsCounter bytes_read("FetchClient.bytes_read"); bytes_read.Add(result); // Issue a read for more data. @@ -99,7 +99,7 @@ class Client { } void OnRequestComplete(int result) { - static StatsCounter requests("FetchClient.requests"); + static base::StatsCounter requests("FetchClient.requests"); requests.Increment(); driver_->ClientStopped(); printf("."); @@ -117,7 +117,7 @@ class Client { int main(int argc, char**argv) { base::AtExitManager exit; - StatsTable table("fetchclient", 50, 1000); + base::StatsTable table("fetchclient", 50, 1000); table.set_current(&table); CommandLine::Init(argc, argv); @@ -163,8 +163,8 @@ int main(int argc, char**argv) { } { - StatsCounterTimer driver_time("FetchClient.total_time"); - StatsScope<StatsCounterTimer> scope(driver_time); + base::StatsCounterTimer driver_time("FetchClient.total_time"); + base::StatsScope<base::StatsCounterTimer> scope(driver_time); Client** clients = new Client*[client_limit]; for (int i = 0; i < client_limit; i++) diff --git a/net/tools/fetch/fetch_server.cc b/net/tools/fetch/fetch_server.cc index 085bd46..ca058f1 100644 --- a/net/tools/fetch/fetch_server.cc +++ b/net/tools/fetch/fetch_server.cc @@ -1,12 +1,12 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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/at_exit.h" #include "base/command_line.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "net/base/completion_callback.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -24,7 +24,7 @@ void usage(const char* program_name) { int main(int argc, char**argv) { base::AtExitManager exit; - StatsTable table("fetchserver", 50, 1000); + base::StatsTable table("fetchserver", 50, 1000); table.set_current(&table); #if defined(OS_WIN) diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index b4f9d51..ee52e0a 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -6,8 +6,8 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 5ed3097..2a4d036 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -4,8 +4,8 @@ #include "net/url_request/url_request_job.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/auth.h" diff --git a/printing/emf_win.cc b/printing/emf_win.cc index b7c6198..1a7c8dd 100644 --- a/printing/emf_win.cc +++ b/printing/emf_win.cc @@ -5,8 +5,8 @@ #include "printing/emf_win.h" #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/scoped_ptr.h" #include "base/time.h" #include "gfx/codec/jpeg_codec.h" diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc index 10998d5..67236aa 100644 --- a/skia/ext/image_operations.cc +++ b/skia/ext/image_operations.cc @@ -9,8 +9,8 @@ #include "skia/ext/image_operations.h" // TODO(pkasting): skia/ext should not depend on base/! -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/stack_container.h" #include "base/time.h" #include "build/build_config.h" diff --git a/tools/memory_watcher/memory_watcher.cc b/tools/memory_watcher/memory_watcher.cc index 6e67793..fd835cb 100644 --- a/tools/memory_watcher/memory_watcher.cc +++ b/tools/memory_watcher/memory_watcher.cc @@ -10,16 +10,16 @@ #include "base/file_util.h" #include "base/lock.h" #include "base/logging.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "tools/memory_watcher/call_stack.h" #include "tools/memory_watcher/preamble_patcher.h" -static StatsCounter mem_in_use("MemoryInUse.Bytes"); -static StatsCounter mem_in_use_blocks("MemoryInUse.Blocks"); -static StatsCounter mem_in_use_allocs("MemoryInUse.Allocs"); -static StatsCounter mem_in_use_frees("MemoryInUse.Frees"); +static base::StatsCounter mem_in_use("MemoryInUse.Bytes"); +static base::StatsCounter mem_in_use_blocks("MemoryInUse.Blocks"); +static base::StatsCounter mem_in_use_allocs("MemoryInUse.Allocs"); +static base::StatsCounter mem_in_use_frees("MemoryInUse.Frees"); // --------------------------------------------------------------------- diff --git a/webkit/appcache/appcache_histograms.cc b/webkit/appcache/appcache_histograms.cc index 9907047..dc8e419 100644 --- a/webkit/appcache/appcache_histograms.cc +++ b/webkit/appcache/appcache_histograms.cc @@ -4,7 +4,7 @@ #include "webkit/appcache/appcache_histograms.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" namespace appcache { diff --git a/webkit/extensions/v8/benchmarking_extension.cc b/webkit/extensions/v8/benchmarking_extension.cc index 1a30968..b7abc57 100644 --- a/webkit/extensions/v8/benchmarking_extension.cc +++ b/webkit/extensions/v8/benchmarking_extension.cc @@ -1,13 +1,14 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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 "webkit/extensions/v8/benchmarking_extension.h" + #include "base/command_line.h" -#include "base/stats_table.h" +#include "base/metrics/stats_table.h" #include "base/time.h" #include "net/http/http_network_layer.h" #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" -#include "webkit/extensions/v8/benchmarking_extension.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebCache; @@ -107,7 +108,7 @@ class BenchmarkingWrapper : public v8::Extension { } static v8::Handle<v8::Value> GetCounter(const v8::Arguments& args) { - if (!args.Length() || !args[0]->IsString() || !StatsTable::current()) + if (!args.Length() || !args[0]->IsString() || !base::StatsTable::current()) return v8::Undefined(); // Extract the name argument @@ -116,7 +117,7 @@ class BenchmarkingWrapper : public v8::Extension { name[1] = ':'; args[0]->ToString()->WriteAscii(&name[2], 0, sizeof(name) - 3); - int counter = StatsTable::current()->GetCounterValue(name); + int counter = base::StatsTable::current()->GetCounterValue(name); return v8::Integer::New(counter); } diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc index c051fff..30c4fb3 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.cc +++ b/webkit/glue/plugins/pepper_plugin_instance.cc @@ -5,7 +5,7 @@ #include "webkit/glue/plugins/pepper_plugin_instance.h" #include "base/logging.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #if defined(OS_MACOSX) #include "base/mac_util.h" #include "base/scoped_cftyperef.h" diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc index 9a0770e..6c95274 100644 --- a/webkit/glue/plugins/plugin_lib.cc +++ b/webkit/glue/plugins/plugin_lib.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "base/message_loop.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/plugins/plugin_instance.h" @@ -72,7 +72,7 @@ PluginLib::PluginLib(const WebPluginInfo& info, saved_data_(0), instance_count_(0), skip_unload_(false) { - StatsCounter(kPluginLibrariesLoadedCounter).Increment(); + base::StatsCounter(kPluginLibrariesLoadedCounter).Increment(); memset(static_cast<void*>(&plugin_funcs_), 0, sizeof(plugin_funcs_)); g_loaded_libs->push_back(this); @@ -87,7 +87,7 @@ PluginLib::PluginLib(const WebPluginInfo& info, } PluginLib::~PluginLib() { - StatsCounter(kPluginLibrariesLoadedCounter).Decrement(); + base::StatsCounter(kPluginLibrariesLoadedCounter).Decrement(); if (saved_data_ != 0) { // TODO - delete the savedData object here } @@ -143,13 +143,13 @@ void PluginLib::PreventLibraryUnload() { PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) { PluginInstance* new_instance = new PluginInstance(this, mime_type); instance_count_++; - StatsCounter(kPluginInstancesActiveCounter).Increment(); + base::StatsCounter(kPluginInstancesActiveCounter).Increment(); DCHECK_NE(static_cast<PluginInstance*>(NULL), new_instance); return new_instance; } void PluginLib::CloseInstance() { - StatsCounter(kPluginInstancesActiveCounter).Decrement(); + base::StatsCounter(kPluginInstancesActiveCounter).Decrement(); instance_count_--; // If a plugin is running in its own process it will get unloaded on process // shutdown. diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 53745466..c54bbc8 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -11,7 +11,6 @@ #include "base/message_loop.h" #include "base/process_util.h" #include "base/scoped_ptr.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/plugins/plugin_constants_win.h" diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index 3d112fa..bceda0e 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -14,7 +14,7 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "base/process_util.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "gfx/blit.h" #include "skia/ext/platform_canvas.h" @@ -443,8 +443,8 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context, } // Tell the plugin to paint into the pixmap. - static StatsRate plugin_paint("Plugin.Paint"); - StatsScope<StatsRate> scope(plugin_paint); + static base::StatsRate plugin_paint("Plugin.Paint"); + base::StatsScope<base::StatsRate> scope(plugin_paint); NPError err = instance()->NPP_HandleEvent(&np_event); DCHECK_EQ(err, NPERR_NO_ERROR); @@ -474,8 +474,8 @@ void WebPluginDelegateImpl::WindowlessPaint(cairo_t* context, event.drawable = GDK_PIXMAP_XID(pixmap_); // Tell the plugin to paint into the pixmap. - static StatsRate plugin_paint("Plugin.Paint"); - StatsScope<StatsRate> scope(plugin_paint); + static base::StatsRate plugin_paint("Plugin.Paint"); + base::StatsScope<base::StatsRate> scope(plugin_paint); NPError err = instance()->NPP_HandleEvent(&np_event); DCHECK_EQ(err, NPERR_NO_ERROR); diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 11d244c..b7e7702 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -13,8 +13,8 @@ #include "base/file_util.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/scoped_ptr.h" -#include "base/stats_counters.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" @@ -650,8 +650,8 @@ void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context, return; DCHECK(buffer_context_ == context); - static StatsRate plugin_paint("Plugin.Paint"); - StatsScope<StatsRate> scope(plugin_paint); + static base::StatsRate plugin_paint("Plugin.Paint"); + base::StatsScope<base::StatsRate> scope(plugin_paint); // Plugin invalidates trigger asynchronous paints with the original // invalidation rect; the plugin may be resized before the paint is handled, diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc index 2a10775..c9500d1 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc @@ -12,9 +12,9 @@ #include "base/iat_patch.h" #include "base/lazy_instance.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/registry.h" #include "base/scoped_ptr.h" -#include "base/stats_counters.h" #include "base/string_number_conversions.h" #include "base/string_split.h" #include "base/string_util.h" @@ -1029,8 +1029,8 @@ void WebPluginDelegateImpl::WindowlessPaint(HDC hdc, // NOTE: NPAPI is not 64bit safe. It puts pointers into 32bit values. paint_event.wParam = PtrToUlong(hdc); paint_event.lParam = PtrToUlong(&damage_rect_win); - static StatsRate plugin_paint("Plugin.Paint"); - StatsScope<StatsRate> scope(plugin_paint); + static base::StatsRate plugin_paint("Plugin.Paint"); + base::StatsScope<base::StatsRate> scope(plugin_paint); instance()->NPP_HandleEvent(&paint_event); window_.window = old_dc; } diff --git a/webkit/glue/plugins/webview_plugin.cc b/webkit/glue/plugins/webview_plugin.cc index 9287028..feb5720 100644 --- a/webkit/glue/plugins/webview_plugin.cc +++ b/webkit/glue/plugins/webview_plugin.cc @@ -4,8 +4,8 @@ #include "webkit/glue/plugins/webview_plugin.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" diff --git a/webkit/glue/site_isolation_metrics.cc b/webkit/glue/site_isolation_metrics.cc index 912263f..58d8717 100644 --- a/webkit/glue/site_isolation_metrics.cc +++ b/webkit/glue/site_isolation_metrics.cc @@ -7,7 +7,7 @@ #include <set> #include "base/hash_tables.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "net/base/mime_sniffer.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index e9b05f1..648f3bd5 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -14,10 +14,10 @@ #include "base/lock.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/process_util.h" #include "base/platform_file.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" @@ -217,11 +217,11 @@ void WebKitClientImpl::getPluginList(bool refresh, } void WebKitClientImpl::decrementStatsCounter(const char* name) { - StatsCounter(name).Decrement(); + base::StatsCounter(name).Decrement(); } void WebKitClientImpl::incrementStatsCounter(const char* name) { - StatsCounter(name).Increment(); + base::StatsCounter(name).Increment(); } void WebKitClientImpl::traceEventBegin(const char* name, void* id, diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc index 2bc1494..3bceef0 100644 --- a/webkit/support/test_webkit_client.cc +++ b/webkit/support/test_webkit_client.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "webkit/support/test_webkit_client.h" + #include "base/file_util.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "net/base/cookie_monster.h" @@ -37,7 +39,6 @@ #include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkitclient_impl.h" -#include "webkit/support/test_webkit_client.h" #include "webkit/support/weburl_loader_mock_factory.h" #include "webkit/tools/test_shell/mock_webclipboard_impl.h" #include "webkit/tools/test_shell/simple_appcache_system.h" @@ -62,7 +63,7 @@ using WebKit::WebScriptController; TestWebKitClient::TestWebKitClient(bool unit_test_mode) : unit_test_mode_(unit_test_mode) { - v8::V8::SetCounterFunction(StatsTable::FindLocation); + v8::V8::SetCounterFunction(base::StatsTable::FindLocation); WebKit::initialize(this); WebKit::setLayoutTestMode(true); diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 9213f6b..64af309 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -16,8 +16,8 @@ #endif #include "base/md5.h" #include "base/message_loop.h" +#include "base/metrics/stats_table.h" #include "base/path_service.h" -#include "base/stats_table.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "build/build_config.h" @@ -178,7 +178,7 @@ TestShell::~TestShell() { PlatformCleanUp(); - StatsTable *table = StatsTable::current(); + base::StatsTable *table = base::StatsTable::current(); if (dump_stats_table_on_exit_) { // Dump the stats table. printf("<stats>\n"); diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index ca49b66..f34dd21 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -19,7 +19,6 @@ #include "base/memory_debug.h" #include "base/message_loop.h" #include "base/path_service.h" -#include "base/stats_table.h" #include "base/string16.h" #include "base/string_piece.h" #include "base/utf_string_conversions.h" diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 12b3b1c..a41ce74 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -14,10 +14,10 @@ #include "base/i18n/icu_util.h" #include "base/memory_debug.h" #include "base/message_loop.h" +#include "base/metrics/stats_table.h" #include "base/path_service.h" #include "base/process_util.h" #include "base/rand_util.h" -#include "base/stats_table.h" #include "base/string_number_conversions.h" #include "base/sys_info.h" #include "base/trace_event.h" @@ -273,10 +273,10 @@ int main(int argc, char* argv[]) { std::string stats_filename = kStatsFilePrefix + base::Uint64ToString(base::RandUint64() & 0xFFFFFFFFL); RemoveSharedMemoryFile(stats_filename); - StatsTable *table = new StatsTable(stats_filename, + base::StatsTable *table = new base::StatsTable(stats_filename, kStatsFileThreads, kStatsFileCounters); - StatsTable::set_current(table); + base::StatsTable::set_current(table); TestShell* shell; if (TestShell::CreateNewWindow(starting_url, &shell)) { @@ -398,7 +398,7 @@ int main(int argc, char* argv[]) { TestShell::CleanupLogging(); // Tear down shared StatsTable; prevents unit_tests from leaking it. - StatsTable::set_current(NULL); + base::StatsTable::set_current(NULL); delete table; RemoveSharedMemoryFile(stats_filename); diff --git a/webkit/tools/test_shell/test_shell_webkit_init.cc b/webkit/tools/test_shell/test_shell_webkit_init.cc index 812d815..afae8f2 100644 --- a/webkit/tools/test_shell/test_shell_webkit_init.cc +++ b/webkit/tools/test_shell/test_shell_webkit_init.cc @@ -4,8 +4,8 @@ #include "webkit/tools/test_shell/test_shell_webkit_init.h" +#include "base/metrics/stats_counters.h" #include "base/path_service.h" -#include "base/stats_counters.h" #include "media/base/media.h" #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" @@ -20,7 +20,7 @@ #endif TestShellWebKitInit::TestShellWebKitInit(bool layout_test_mode) { - v8::V8::SetCounterFunction(StatsTable::FindLocation); + v8::V8::SetCounterFunction(base::StatsTable::FindLocation); WebKit::initialize(this); WebKit::setLayoutTestMode(layout_test_mode); |