summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/BUILD.gn6
-rw-r--r--base/base.gyp3
-rw-r--r--base/base.gypi4
-rw-r--r--base/metrics/stats_counters.cc125
-rw-r--r--base/metrics/stats_counters.h197
-rw-r--r--base/metrics/stats_table.cc617
-rw-r--r--base/metrics/stats_table.h220
-rw-r--r--base/metrics/stats_table_unittest.cc402
-rw-r--r--chrome/app/chrome_main_delegate.cc7
-rw-r--r--chrome/app/chrome_main_delegate.h8
-rw-r--r--chrome/browser/browser_resources.grd2
-rw-r--r--chrome/browser/resources/about_stats.html135
-rw-r--r--chrome/browser/resources/about_stats.js200
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database.cc5
-rw-r--r--chrome/browser/ui/views/task_manager_view.cc33
-rw-r--r--chrome/browser/ui/webui/about_ui.cc170
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc3
-rw-r--r--chrome/common/url_constants.cc2
-rw-r--r--chrome/common/url_constants.h1
-rw-r--r--chrome/renderer/benchmarking_extension.cc52
-rw-r--r--chrome/renderer/net_benchmarking_extension.h4
-rw-r--r--components/network_hints/renderer/dns_prefetch_queue.cc7
-rw-r--r--content/app/content_main_runner.cc40
-rw-r--r--content/browser/child_process_launcher.cc8
-rw-r--r--content/browser/download/download_resource_handler.cc1
-rw-r--r--content/browser/web_contents/web_contents_impl.cc3
-rw-r--r--content/child/blink_platform_impl.cc3
-rw-r--r--content/child/npapi/plugin_lib.cc8
-rw-r--r--content/child/npapi/webplugin_delegate_impl_mac.mm4
-rw-r--r--content/child/npapi/webplugin_delegate_impl_win.cc3
-rw-r--r--content/renderer/render_thread_impl.cc3
-rw-r--r--content/renderer/renderer_main.cc9
-rw-r--r--content/test/test_blink_web_unit_test_support.cc11
-rw-r--r--content/test/test_blink_web_unit_test_support.h1
-rw-r--r--mojo/services/html_viewer/ax_provider_impl_unittest.cc1
-rw-r--r--net/disk_cache/blockfile/backend_impl.cc3
-rw-r--r--net/disk_cache/blockfile/backend_impl_v3.cc1
-rw-r--r--net/http/http_network_transaction.cc3
-rw-r--r--net/socket/client_socket_pool_base.cc2
-rw-r--r--net/socket/tcp_socket_libevent.cc12
-rw-r--r--net/socket/tcp_socket_win.cc14
-rw-r--r--net/spdy/spdy_framer.cc11
-rw-r--r--net/spdy/spdy_session.cc27
-rw-r--r--net/udp/udp_socket_libevent.cc5
-rw-r--r--net/udp/udp_socket_win.cc5
-rw-r--r--net/url_request/url_request.cc3
46 files changed, 11 insertions, 2373 deletions
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 44e656c..d88b8a2 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -402,10 +402,6 @@ component("base") {
"metrics/sparse_histogram.h",
"metrics/statistics_recorder.cc",
"metrics/statistics_recorder.h",
- "metrics/stats_counters.cc",
- "metrics/stats_counters.h",
- "metrics/stats_table.cc",
- "metrics/stats_table.h",
"metrics/user_metrics.cc",
"metrics/user_metrics.h",
"metrics/user_metrics_action.h",
@@ -1242,7 +1238,6 @@ test("base_unittests") {
"metrics/histogram_snapshot_manager_unittest.cc",
"metrics/histogram_unittest.cc",
"metrics/sparse_histogram_unittest.cc",
- "metrics/stats_table_unittest.cc",
"metrics/statistics_recorder_unittest.cc",
"observer_list_unittest.cc",
"os_compat_android_unittest.cc",
@@ -1386,7 +1381,6 @@ test("base_unittests") {
if (is_ios) {
sources -= [
- "metrics/stats_table_uinittest.cc", # Requires spawning a process.
"process/memory_unittest.cc",
"process/memory_unittest_mac.h",
"process/memory_unittest_mac.mm",
diff --git a/base/base.gyp b/base/base.gyp
index 00244aa..41d43c8 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -554,7 +554,6 @@
'metrics/histogram_snapshot_manager_unittest.cc',
'metrics/histogram_unittest.cc',
'metrics/sparse_histogram_unittest.cc',
- 'metrics/stats_table_unittest.cc',
'metrics/statistics_recorder_unittest.cc',
'observer_list_unittest.cc',
'os_compat_android_unittest.cc',
@@ -708,8 +707,6 @@
['exclude', '^process/process_unittest\\.cc$'],
['exclude', '^process/process_util_unittest\\.cc$'],
['include', '^process/process_util_unittest_ios\\.cc$'],
- # Requires spawning processes.
- ['exclude', '^metrics/stats_table_unittest\\.cc$'],
# iOS does not use message_pump_libevent.
['exclude', '^message_loop/message_pump_libevent_unittest\\.cc$'],
],
diff --git a/base/base.gypi b/base/base.gypi
index 6dd6fcf..060b360 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -399,10 +399,6 @@
'metrics/sparse_histogram.h',
'metrics/statistics_recorder.cc',
'metrics/statistics_recorder.h',
- 'metrics/stats_counters.cc',
- 'metrics/stats_counters.h',
- 'metrics/stats_table.cc',
- 'metrics/stats_table.h',
'metrics/user_metrics.cc',
'metrics/user_metrics.h',
'metrics/user_metrics_action.h',
diff --git a/base/metrics/stats_counters.cc b/base/metrics/stats_counters.cc
deleted file mode 100644
index 12416d9..0000000
--- a/base/metrics/stats_counters.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// 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/metrics/stats_counters.h"
-
-namespace base {
-
-StatsCounter::StatsCounter(const std::string& name)
- : counter_id_(-1) {
- // We prepend the name with 'c:' to indicate that it is a counter.
- if (StatsTable::current()) {
- // TODO(mbelshe): name_ construction is racy and it may corrupt memory for
- // static.
- name_ = "c:";
- name_.append(name);
- }
-}
-
-StatsCounter::~StatsCounter() {
-}
-
-void StatsCounter::Set(int value) {
- int* loc = GetPtr();
- if (loc)
- *loc = value;
-}
-
-void StatsCounter::Add(int value) {
- int* loc = GetPtr();
- if (loc)
- (*loc) += value;
-}
-
-StatsCounter::StatsCounter()
- : counter_id_(-1) {
-}
-
-int* StatsCounter::GetPtr() {
- StatsTable* table = StatsTable::current();
- if (!table)
- return NULL;
-
- // If counter_id_ is -1, then we haven't looked it up yet.
- if (counter_id_ == -1) {
- counter_id_ = table->FindCounter(name_);
- if (table->GetSlot() == 0) {
- if (!table->RegisterThread(std::string())) {
- // There is no room for this thread. This thread
- // cannot use counters.
- counter_id_ = 0;
- return NULL;
- }
- }
- }
-
- // If counter_id_ is > 0, then we have a valid counter.
- if (counter_id_ > 0)
- return table->GetLocation(counter_id_, table->GetSlot());
-
- // counter_id_ was zero, which means the table is full.
- return NULL;
-}
-
-
-StatsCounterTimer::StatsCounterTimer(const std::string& name) {
- // we prepend the name with 't:' to indicate that it is a timer.
- if (StatsTable::current()) {
- // TODO(mbelshe): name_ construction is racy and it may corrupt memory for
- // static.
- name_ = "t:";
- name_.append(name);
- }
-}
-
-StatsCounterTimer::~StatsCounterTimer() {
-}
-
-void StatsCounterTimer::Start() {
- if (!Enabled())
- return;
- start_time_ = TimeTicks::Now();
- stop_time_ = TimeTicks();
-}
-
-// Stop the timer and record the results.
-void StatsCounterTimer::Stop() {
- if (!Enabled() || !Running())
- return;
- stop_time_ = TimeTicks::Now();
- Record();
-}
-
-// Returns true if the timer is running.
-bool StatsCounterTimer::Running() {
- return Enabled() && !start_time_.is_null() && stop_time_.is_null();
-}
-
-// Accept a TimeDelta to increment.
-void StatsCounterTimer::AddTime(TimeDelta time) {
- Add(static_cast<int>(time.InMilliseconds()));
-}
-
-void StatsCounterTimer::Record() {
- AddTime(stop_time_ - start_time_);
-}
-
-
-StatsRate::StatsRate(const std::string& name)
- : StatsCounterTimer(name),
- counter_(name),
- largest_add_(std::string(" ").append(name).append("MAX")) {
-}
-
-StatsRate::~StatsRate() {
-}
-
-void StatsRate::Add(int value) {
- counter_.Increment();
- StatsCounterTimer::Add(value);
- if (value > largest_add_.value())
- largest_add_.Set(value);
-}
-
-} // namespace base
diff --git a/base/metrics/stats_counters.h b/base/metrics/stats_counters.h
deleted file mode 100644
index 0f8354f..0000000
--- a/base/metrics/stats_counters.h
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright (c) 2011 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_METRICS_STATS_COUNTERS_H_
-#define BASE_METRICS_STATS_COUNTERS_H_
-
-#include <string>
-
-#include "base/base_export.h"
-#include "base/compiler_specific.h"
-#include "base/metrics/stats_table.h"
-#include "base/time/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.
-//
-// Since StatsCounters can be created dynamically by name, there is
-// a hash table lookup to find the counter in the table. A StatsCounter
-// object can be created once and used across multiple threads safely.
-//
-// Example usage:
-// {
-// StatsCounter request_count("RequestCount");
-// request_count.Increment();
-// }
-//
-// Note that creating counters on the stack does work, however creating
-// the counter object requires a hash table lookup. For inner loops, it
-// may be better to create the counter either as a member of another object
-// (or otherwise outside of the loop) for maximum performance.
-//
-// Internally, a counter represents a value in a row of a StatsTable.
-// The row has a 32bit value for each process/thread in the table and also
-// a name (stored in the table metadata).
-//
-// NOTE: In order to make stats_counters usable in lots of different code,
-// avoid any dependencies inside this header file.
-//
-
-//------------------------------------------------------------------------------
-// Define macros for ease of use. They also allow us to change definitions
-// as the implementation varies, or depending on compile options.
-//------------------------------------------------------------------------------
-// First provide generic macros, which exist in production as well as debug.
-#define STATS_COUNTER(name, delta) do { \
- base::StatsCounter counter(name); \
- counter.Add(delta); \
-} while (0)
-
-#define SIMPLE_STATS_COUNTER(name) STATS_COUNTER(name, 1)
-
-#define RATE_COUNTER(name, duration) do { \
- base::StatsRate hit_count(name); \
- hit_count.AddTime(duration); \
-} while (0)
-
-// Define Debug vs non-debug flavors of macros.
-#ifndef NDEBUG
-
-#define DSTATS_COUNTER(name, delta) STATS_COUNTER(name, delta)
-#define DSIMPLE_STATS_COUNTER(name) SIMPLE_STATS_COUNTER(name)
-#define DRATE_COUNTER(name, duration) RATE_COUNTER(name, duration)
-
-#else // NDEBUG
-
-#define DSTATS_COUNTER(name, delta) do {} while (0)
-#define DSIMPLE_STATS_COUNTER(name) do {} while (0)
-#define DRATE_COUNTER(name, duration) do {} while (0)
-
-#endif // NDEBUG
-
-//------------------------------------------------------------------------------
-// StatsCounter represents a counter in the StatsTable class.
-class BASE_EXPORT StatsCounter {
- public:
- // Create a StatsCounter object.
- explicit StatsCounter(const std::string& name);
- virtual ~StatsCounter();
-
- // Sets the counter to a specific value.
- void Set(int value);
-
- // Increments the counter.
- void Increment() {
- Add(1);
- }
-
- virtual void Add(int value);
-
- // Decrements the counter.
- void Decrement() {
- Add(-1);
- }
-
- void Subtract(int value) {
- Add(-value);
- }
-
- // Is this counter enabled?
- // Returns false if table is full.
- bool Enabled() {
- return GetPtr() != NULL;
- }
-
- int value() {
- int* loc = GetPtr();
- if (loc) return *loc;
- return 0;
- }
-
- protected:
- StatsCounter();
-
- // Returns the cached address of this counter location.
- int* GetPtr();
-
- std::string name_;
- // The counter id in the table. We initialize to -1 (an invalid value)
- // and then cache it once it has been looked up. The counter_id is
- // valid across all threads and processes.
- int32 counter_id_;
-};
-
-
-// A StatsCounterTimer is a StatsCounter which keeps a timer during
-// the scope of the StatsCounterTimer. On destruction, it will record
-// its time measurement.
-class BASE_EXPORT StatsCounterTimer : protected StatsCounter {
- public:
- // Constructs and starts the timer.
- explicit StatsCounterTimer(const std::string& name);
- ~StatsCounterTimer() override;
-
- // Start the timer.
- void Start();
-
- // Stop the timer and record the results.
- void Stop();
-
- // Returns true if the timer is running.
- bool Running();
-
- // Accept a TimeDelta to increment.
- virtual void AddTime(TimeDelta time);
-
- protected:
- // Compute the delta between start and stop, in milliseconds.
- void Record();
-
- TimeTicks start_time_;
- TimeTicks stop_time_;
-};
-
-// A StatsRate is a timer that keeps a count of the number of intervals added so
-// that several statistics can be produced:
-// min, max, avg, count, total
-class BASE_EXPORT StatsRate : public StatsCounterTimer {
- public:
- // Constructs and starts the timer.
- explicit StatsRate(const std::string& name);
- ~StatsRate() override;
-
- void Add(int value) override;
-
- private:
- StatsCounter counter_;
- StatsCounter largest_add_;
-};
-
-
-// Helper class for scoping a timer or rate.
-template<class T> class StatsScope {
- public:
- explicit StatsScope<T>(T& timer)
- : timer_(timer) {
- timer_.Start();
- }
-
- ~StatsScope() {
- timer_.Stop();
- }
-
- void Stop() {
- timer_.Stop();
- }
-
- private:
- T& timer_;
-};
-
-} // namespace base
-
-#endif // BASE_METRICS_STATS_COUNTERS_H_
diff --git a/base/metrics/stats_table.cc b/base/metrics/stats_table.cc
deleted file mode 100644
index 0986395..0000000
--- a/base/metrics/stats_table.cc
+++ /dev/null
@@ -1,617 +0,0 @@
-// Copyright (c) 2011 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/metrics/stats_table.h"
-
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/shared_memory.h"
-#include "base/process/process_handle.h"
-#include "base/strings/string_piece.h"
-#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/threading/platform_thread.h"
-#include "base/threading/thread_local_storage.h"
-
-namespace base {
-
-// The StatsTable uses a shared memory segment that is laid out as follows
-//
-// +-------------------------------------------+
-// | Version | Size | MaxCounters | MaxThreads |
-// +-------------------------------------------+
-// | Thread names table |
-// +-------------------------------------------+
-// | Thread TID table |
-// +-------------------------------------------+
-// | Thread PID table |
-// +-------------------------------------------+
-// | Counter names table |
-// +-------------------------------------------+
-// | Data |
-// +-------------------------------------------+
-//
-// The data layout is a grid, where the columns are the thread_ids and the
-// rows are the counter_ids.
-//
-// If the first character of the thread_name is '\0', then that column is
-// empty.
-// If the first character of the counter_name is '\0', then that row is
-// empty.
-//
-// About Locking:
-// This class is designed to be both multi-thread and multi-process safe.
-// Aside from initialization, this is done by partitioning the data which
-// each thread uses so that no locking is required. However, to allocate
-// the rows and columns of the table to particular threads, locking is
-// required.
-//
-// At the shared-memory level, we have a lock. This lock protects the
-// shared-memory table only, and is used when we create new counters (e.g.
-// use rows) or when we register new threads (e.g. use columns). Reading
-// data from the table does not require any locking at the shared memory
-// level.
-//
-// Each process which accesses the table will create a StatsTable object.
-// The StatsTable maintains a hash table of the existing counters in the
-// table for faster lookup. Since the hash table is process specific,
-// each process maintains its own cache. We avoid complexity here by never
-// de-allocating from the hash table. (Counters are dynamically added,
-// but not dynamically removed).
-
-// In order for external viewers to be able to read our shared memory,
-// we all need to use the same size ints.
-COMPILE_ASSERT(sizeof(int)==4, expect_4_byte_ints);
-
-namespace {
-
-// An internal version in case we ever change the format of this
-// file, and so that we can identify our table.
-const int kTableVersion = 0x13131313;
-
-// The name for un-named counters and threads in the table.
-const char kUnknownName[] = "<unknown>";
-
-// Calculates delta to align an offset to the size of an int
-inline int AlignOffset(int offset) {
- return (sizeof(int) - (offset % sizeof(int))) % sizeof(int);
-}
-
-inline int AlignedSize(int size) {
- return size + AlignOffset(size);
-}
-
-} // namespace
-
-// The StatsTable::Internal maintains convenience pointers into the
-// shared memory segment. Use this class to keep the data structure
-// clean and accessible.
-class StatsTable::Internal {
- public:
- // Various header information contained in the memory mapped segment.
- struct TableHeader {
- int version;
- int size;
- int max_counters;
- int max_threads;
- };
-
- // Construct a new Internal based on expected size parameters, or
- // return NULL on failure.
- static Internal* New(const StatsTable::TableIdentifier& table,
- int size,
- int max_threads,
- int max_counters);
-
- SharedMemory* shared_memory() { return shared_memory_.get(); }
-
- // Accessors for our header pointers
- TableHeader* table_header() const { return table_header_; }
- int version() const { return table_header_->version; }
- int size() const { return table_header_->size; }
- int max_counters() const { return table_header_->max_counters; }
- int max_threads() const { return table_header_->max_threads; }
-
- // Accessors for our tables
- char* thread_name(int slot_id) const {
- return &thread_names_table_[
- (slot_id-1) * (StatsTable::kMaxThreadNameLength)];
- }
- PlatformThreadId* thread_tid(int slot_id) const {
- return &(thread_tid_table_[slot_id-1]);
- }
- int* thread_pid(int slot_id) const {
- return &(thread_pid_table_[slot_id-1]);
- }
- char* counter_name(int counter_id) const {
- return &counter_names_table_[
- (counter_id-1) * (StatsTable::kMaxCounterNameLength)];
- }
- int* row(int counter_id) const {
- return &data_table_[(counter_id-1) * max_threads()];
- }
-
- private:
- // Constructor is private because you should use New() instead.
- explicit Internal(SharedMemory* shared_memory)
- : shared_memory_(shared_memory),
- table_header_(NULL),
- thread_names_table_(NULL),
- thread_tid_table_(NULL),
- thread_pid_table_(NULL),
- counter_names_table_(NULL),
- data_table_(NULL) {
- }
-
- // Create or open the SharedMemory used by the stats table.
- static SharedMemory* CreateSharedMemory(
- const StatsTable::TableIdentifier& table,
- int size);
-
- // Initializes the table on first access. Sets header values
- // appropriately and zeroes all counters.
- void InitializeTable(void* memory, int size, int max_counters,
- int max_threads);
-
- // Initializes our in-memory pointers into a pre-created StatsTable.
- void ComputeMappedPointers(void* memory);
-
- scoped_ptr<SharedMemory> shared_memory_;
- TableHeader* table_header_;
- char* thread_names_table_;
- PlatformThreadId* thread_tid_table_;
- int* thread_pid_table_;
- char* counter_names_table_;
- int* data_table_;
-
- DISALLOW_COPY_AND_ASSIGN(Internal);
-};
-
-// static
-StatsTable::Internal* StatsTable::Internal::New(
- const StatsTable::TableIdentifier& table,
- int size,
- int max_threads,
- int max_counters) {
- scoped_ptr<SharedMemory> shared_memory(CreateSharedMemory(table, size));
- if (!shared_memory.get())
- return NULL;
- if (!shared_memory->Map(size))
- return NULL;
- void* memory = shared_memory->memory();
-
- scoped_ptr<Internal> internal(new Internal(shared_memory.release()));
- TableHeader* header = static_cast<TableHeader*>(memory);
-
- // If the version does not match, then assume the table needs
- // to be initialized.
- if (header->version != kTableVersion)
- internal->InitializeTable(memory, size, max_counters, max_threads);
-
- // We have a valid table, so compute our pointers.
- internal->ComputeMappedPointers(memory);
-
- return internal.release();
-}
-
-// static
-SharedMemory* StatsTable::Internal::CreateSharedMemory(
- const StatsTable::TableIdentifier& table,
- int size) {
-#if defined(OS_POSIX)
- // Check for existing table.
- if (table.fd != -1)
- return new SharedMemory(table, false);
-
- // Otherwise we need to create it.
- scoped_ptr<SharedMemory> shared_memory(new SharedMemory());
- if (!shared_memory->CreateAnonymous(size))
- return NULL;
- return shared_memory.release();
-#elif defined(OS_WIN)
- scoped_ptr<SharedMemory> shared_memory(new SharedMemory());
- if (table.empty()) {
- // Create an anonymous table.
- if (!shared_memory->CreateAnonymous(size))
- return NULL;
- } else {
- // Create a named table for sharing between processes.
- if (!shared_memory->CreateNamedDeprecated(table, true, size))
- return NULL;
- }
- return shared_memory.release();
-#endif
-}
-
-void StatsTable::Internal::InitializeTable(void* memory, int size,
- int max_counters,
- int max_threads) {
- // Zero everything.
- memset(memory, 0, size);
-
- // Initialize the header.
- TableHeader* header = static_cast<TableHeader*>(memory);
- header->version = kTableVersion;
- header->size = size;
- header->max_counters = max_counters;
- header->max_threads = max_threads;
-}
-
-void StatsTable::Internal::ComputeMappedPointers(void* memory) {
- char* data = static_cast<char*>(memory);
- int offset = 0;
-
- table_header_ = reinterpret_cast<TableHeader*>(data);
- offset += sizeof(*table_header_);
- offset += AlignOffset(offset);
-
- // Verify we're looking at a valid StatsTable.
- DCHECK_EQ(table_header_->version, kTableVersion);
-
- thread_names_table_ = reinterpret_cast<char*>(data + offset);
- offset += sizeof(char) *
- max_threads() * StatsTable::kMaxThreadNameLength;
- offset += AlignOffset(offset);
-
- thread_tid_table_ = reinterpret_cast<PlatformThreadId*>(data + offset);
- offset += sizeof(int) * max_threads();
- offset += AlignOffset(offset);
-
- thread_pid_table_ = reinterpret_cast<int*>(data + offset);
- offset += sizeof(int) * max_threads();
- offset += AlignOffset(offset);
-
- counter_names_table_ = reinterpret_cast<char*>(data + offset);
- offset += sizeof(char) *
- max_counters() * StatsTable::kMaxCounterNameLength;
- offset += AlignOffset(offset);
-
- data_table_ = reinterpret_cast<int*>(data + offset);
- offset += sizeof(int) * max_threads() * max_counters();
-
- 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* global_table = NULL;
-
-StatsTable::StatsTable(const TableIdentifier& table,
- int max_threads,
- int max_counters)
- : internal_(NULL),
- tls_index_(SlotReturnFunction) {
- int table_size =
- AlignedSize(sizeof(Internal::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)));
-
- internal_ = Internal::New(table, table_size, max_threads, max_counters);
-
- if (!internal_)
- DPLOG(ERROR) << "StatsTable did not initialize";
-}
-
-StatsTable::~StatsTable() {
- // Before we tear down our copy of the table, be sure to
- // unregister our thread.
- UnregisterThread();
-
- // Return ThreadLocalStorage. At this point, if any registered threads
- // still exist, they cannot Unregister.
- tls_index_.Free();
-
- // Cleanup our shared memory.
- delete internal_;
-
- // If we are the global table, unregister ourselves.
- if (global_table == this)
- global_table = NULL;
-}
-
-StatsTable* StatsTable::current() {
- return global_table;
-}
-
-void StatsTable::set_current(StatsTable* value) {
- global_table = value;
-}
-
-int StatsTable::GetSlot() const {
- TLSData* data = GetTLSData();
- if (!data)
- return 0;
- return data->slot;
-}
-
-int StatsTable::RegisterThread(const std::string& name) {
- int slot = 0;
- if (!internal_)
- return 0;
-
- // Registering a thread requires that we lock the shared memory
- // so that two threads don't grab the same slot. Fortunately,
- // thread creation shouldn't happen in inner loops.
- // TODO(viettrungluu): crbug.com/345734: Use a different locking mechanism.
- {
- SharedMemoryAutoLockDeprecated lock(internal_->shared_memory());
- slot = FindEmptyThread();
- if (!slot) {
- return 0;
- }
-
- // We have space, so consume a column in the table.
- std::string thread_name = name;
- if (name.empty())
- thread_name = kUnknownName;
- strlcpy(internal_->thread_name(slot), thread_name.c_str(),
- kMaxThreadNameLength);
- *(internal_->thread_tid(slot)) = PlatformThread::CurrentId();
- *(internal_->thread_pid(slot)) = GetCurrentProcId();
- }
-
- // Set our thread local storage.
- TLSData* data = new TLSData;
- data->table = this;
- data->slot = slot;
- tls_index_.Set(data);
- return slot;
-}
-
-int StatsTable::CountThreadsRegistered() const {
- if (!internal_)
- return 0;
-
- // Loop through the shared memory and count the threads that are active.
- // We intentionally do not lock the table during the operation.
- int count = 0;
- for (int index = 1; index <= internal_->max_threads(); index++) {
- char* name = internal_->thread_name(index);
- if (*name != '\0')
- count++;
- }
- return count;
-}
-
-int StatsTable::FindCounter(const std::string& name) {
- // Note: the API returns counters numbered from 1..N, although
- // internally, the array is 0..N-1. This is so that we can return
- // zero as "not found".
- if (!internal_)
- return 0;
-
- // Create a scope for our auto-lock.
- {
- AutoLock scoped_lock(counters_lock_);
-
- // Attempt to find the counter.
- CountersMap::const_iterator iter;
- iter = counters_.find(name);
- if (iter != counters_.end())
- return iter->second;
- }
-
- // Counter does not exist, so add it.
- return AddCounter(name);
-}
-
-int* StatsTable::GetLocation(int counter_id, int slot_id) const {
- if (!internal_)
- return NULL;
- if (slot_id > internal_->max_threads())
- return NULL;
-
- int* row = internal_->row(counter_id);
- return &(row[slot_id-1]);
-}
-
-const char* StatsTable::GetRowName(int index) const {
- if (!internal_)
- return NULL;
-
- return internal_->counter_name(index);
-}
-
-int StatsTable::GetRowValue(int index) const {
- return GetRowValue(index, 0);
-}
-
-int StatsTable::GetRowValue(int index, int pid) const {
- if (!internal_)
- return 0;
-
- int rv = 0;
- int* row = internal_->row(index);
- for (int slot_id = 1; slot_id <= internal_->max_threads(); slot_id++) {
- if (pid == 0 || *internal_->thread_pid(slot_id) == pid)
- rv += row[slot_id-1];
- }
- return rv;
-}
-
-int StatsTable::GetCounterValue(const std::string& name) {
- return GetCounterValue(name, 0);
-}
-
-int StatsTable::GetCounterValue(const std::string& name, int pid) {
- if (!internal_)
- return 0;
-
- int row = FindCounter(name);
- if (!row)
- return 0;
- return GetRowValue(row, pid);
-}
-
-int StatsTable::GetMaxCounters() const {
- if (!internal_)
- return 0;
- return internal_->max_counters();
-}
-
-int StatsTable::GetMaxThreads() const {
- if (!internal_)
- return 0;
- return internal_->max_threads();
-}
-
-int* StatsTable::FindLocation(const char* name) {
- // Get the static StatsTable
- StatsTable *table = StatsTable::current();
- if (!table)
- return NULL;
-
- // Get the slot for this thread. Try to register
- // it if none exists.
- int slot = table->GetSlot();
- if (!slot)
- slot = table->RegisterThread(std::string());
- if (!slot)
- return NULL;
-
- // Find the counter id for the counter.
- std::string str_name(name);
- int counter = table->FindCounter(str_name);
-
- // Now we can find the location in the table.
- return table->GetLocation(counter, slot);
-}
-
-void StatsTable::UnregisterThread() {
- UnregisterThread(GetTLSData());
-}
-
-void StatsTable::UnregisterThread(TLSData* data) {
- if (!data)
- return;
- DCHECK(internal_);
-
- // Mark the slot free by zeroing out the thread name.
- char* name = internal_->thread_name(data->slot);
- *name = '\0';
-
- // Remove the calling thread's TLS so that it cannot use the slot.
- tls_index_.Set(NULL);
- delete data;
-}
-
-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.
- TLSData* tls_data = static_cast<TLSData*>(data);
- if (tls_data) {
- DCHECK(tls_data->table);
- tls_data->table->UnregisterThread(tls_data);
- }
-}
-
-int StatsTable::FindEmptyThread() const {
- // Note: the API returns slots numbered from 1..N, although
- // internally, the array is 0..N-1. This is so that we can return
- // zero as "not found".
- //
- // The reason for doing this is because the thread 'slot' is stored
- // in TLS, which is always initialized to zero, not -1. If 0 were
- // returned as a valid slot number, it would be confused with the
- // uninitialized state.
- if (!internal_)
- return 0;
-
- int index = 1;
- for (; index <= internal_->max_threads(); index++) {
- char* name = internal_->thread_name(index);
- if (!*name)
- break;
- }
- if (index > internal_->max_threads())
- return 0; // The table is full.
- return index;
-}
-
-int StatsTable::FindCounterOrEmptyRow(const std::string& name) const {
- // Note: the API returns slots numbered from 1..N, although
- // internally, the array is 0..N-1. This is so that we can return
- // zero as "not found".
- //
- // There isn't much reason for this other than to be consistent
- // with the way we track columns for thread slots. (See comments
- // in FindEmptyThread for why it is done this way).
- if (!internal_)
- return 0;
-
- int free_slot = 0;
- for (int index = 1; index <= internal_->max_counters(); index++) {
- char* row_name = internal_->counter_name(index);
- if (!*row_name && !free_slot)
- free_slot = index; // save that we found a free slot
- else if (!strncmp(row_name, name.c_str(), kMaxCounterNameLength))
- return index;
- }
- return free_slot;
-}
-
-int StatsTable::AddCounter(const std::string& name) {
- if (!internal_)
- return 0;
-
- int counter_id = 0;
- {
- // To add a counter to the shared memory, we need the
- // shared memory lock.
- SharedMemoryAutoLockDeprecated lock(internal_->shared_memory());
-
- // We have space, so create a new counter.
- counter_id = FindCounterOrEmptyRow(name);
- if (!counter_id)
- return 0;
-
- std::string counter_name = name;
- if (name.empty())
- counter_name = kUnknownName;
- strlcpy(internal_->counter_name(counter_id), counter_name.c_str(),
- kMaxCounterNameLength);
- }
-
- // now add to our in-memory cache
- {
- AutoLock lock(counters_lock_);
- counters_[name] = counter_id;
- }
- return counter_id;
-}
-
-StatsTable::TLSData* StatsTable::GetTLSData() const {
- TLSData* data =
- static_cast<TLSData*>(tls_index_.Get());
- if (!data)
- return NULL;
-
- DCHECK(data->slot);
- DCHECK_EQ(data->table, this);
- return data;
-}
-
-#if defined(OS_POSIX)
-SharedMemoryHandle StatsTable::GetSharedMemoryHandle() const {
- if (!internal_)
- return SharedMemory::NULLHandle();
- return internal_->shared_memory()->handle();
-}
-#endif
-
-} // namespace base
diff --git a/base/metrics/stats_table.h b/base/metrics/stats_table.h
deleted file mode 100644
index 719e630..0000000
--- a/base/metrics/stats_table.h
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright (c) 2011 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.
-//
-// A StatsTable is a table of statistics. It can be used across multiple
-// processes and threads, maintaining cheap statistics counters without
-// locking.
-//
-// The goal is to make it very cheap and easy for developers to add
-// counters to code, without having to build one-off utilities or mechanisms
-// to track the counters, and also to allow a single "view" to display
-// the contents of all counters.
-//
-// To achieve this, StatsTable creates a shared memory segment to store
-// the data for the counters. Upon creation, it has a specific size
-// which governs the maximum number of counters and concurrent
-// threads/processes which can use it.
-//
-
-#ifndef BASE_METRICS_STATS_TABLE_H_
-#define BASE_METRICS_STATS_TABLE_H_
-
-#include <string>
-
-#include "base/base_export.h"
-#include "base/basictypes.h"
-#include "base/containers/hash_tables.h"
-#include "base/memory/shared_memory.h"
-#include "base/synchronization/lock.h"
-#include "base/threading/thread_local_storage.h"
-#include "build/build_config.h"
-
-#if defined(OS_POSIX)
-#include "base/file_descriptor_posix.h"
-#endif
-
-namespace base {
-
-class BASE_EXPORT StatsTable {
- public:
- // Identifies a StatsTable. We often want to share these between processes.
- //
- // On Windows, we use a named shared memory segment so the table identifier
- // should be a relatively unique string identifying the table to use. An
- // empty string can be used to use an anonymous shared memory segment for
- // cases where the table does not need to be shared between processes.
- //
- // Posix does not support named memory so we explicitly share file
- // descriptors. On Posix, pass a default-constructed file descriptor if a
- // handle doesn't already exist, and a new one will be created.
- //
- // If a table doesn't already exist with the given identifier, a new one will
- // be created with zeroed counters.
-#if defined(OS_POSIX)
- typedef FileDescriptor TableIdentifier;
-#elif defined(OS_WIN)
- typedef std::string TableIdentifier;
-#endif
-
- // Create a new StatsTable.
- //
- // max_threads is the maximum number of threads the table will support.
- // If the StatsTable already exists, this number is ignored.
- //
- // max_counters is the maximum number of counters the table will support.
- // If the StatsTable already exists, this number is ignored.
- StatsTable(const TableIdentifier& table,
- int max_threads,
- int max_counters);
-
- // Destroys the StatsTable. When the last StatsTable is destroyed
- // (across all processes), the StatsTable is removed from disk.
- ~StatsTable();
-
- // For convenience, we create a static table. This is generally
- // used automatically by the counters.
- static StatsTable* current();
-
- // Set the global table for use in this process.
- static void set_current(StatsTable* value);
-
- // Get the slot id for the calling thread. Returns 0 if no
- // slot is assigned.
- int GetSlot() const;
-
- // All threads that contribute data to the table must register with the
- // table first. This function will set thread local storage for the
- // thread containing the location in the table where this thread will
- // write its counter data.
- //
- // name is just a debugging tag to label the thread, and it does not
- // need to be unique. It will be truncated to kMaxThreadNameLength-1
- // characters.
- //
- // On success, returns the slot id for this thread. On failure,
- // returns 0.
- int RegisterThread(const std::string& name);
-
- // Returns the number of threads currently registered. This is really not
- // useful except for diagnostics and debugging.
- int CountThreadsRegistered() const;
-
- // Find a counter in the StatsTable.
- //
- // Returns an id for the counter which can be used to call GetLocation().
- // If the counter does not exist, attempts to create a row for the new
- // counter. If there is no space in the table for the new counter,
- // returns 0.
- int FindCounter(const std::string& name);
-
- // TODO(mbelshe): implement RemoveCounter.
-
- // Gets the location of a particular value in the table based on
- // the counter id and slot id.
- int* GetLocation(int counter_id, int slot_id) const;
-
- // Gets the counter name at a particular row. If the row is empty,
- // returns NULL.
- const char* GetRowName(int index) const;
-
- // Gets the sum of the values for a particular row.
- int GetRowValue(int index) const;
-
- // Gets the sum of the values for a particular row for a given pid.
- int GetRowValue(int index, int pid) const;
-
- // Gets the sum of the values for a particular counter. If the counter
- // does not exist, creates the counter.
- int GetCounterValue(const std::string& name);
-
- // Gets the sum of the values for a particular counter for a given pid.
- // If the counter does not exist, creates the counter.
- int GetCounterValue(const std::string& name, int pid);
-
- // The maxinum number of counters/rows in the table.
- int GetMaxCounters() const;
-
- // The maxinum number of threads/columns in the table.
- int GetMaxThreads() const;
-
-#if defined(OS_POSIX)
- // Get the underlying shared memory handle for the table.
- base::SharedMemoryHandle GetSharedMemoryHandle() const;
-#endif
-
- // The maximum length (in characters) of a Thread's name including
- // null terminator, as stored in the shared memory.
- static const int kMaxThreadNameLength = 32;
-
- // The maximum length (in characters) of a Counter's name including
- // null terminator, as stored in the shared memory.
- static const int kMaxCounterNameLength = 64;
-
- // Convenience function to lookup a counter location for a
- // counter by name for the calling thread. Will register
- // the thread if it is not already registered.
- static int* FindLocation(const char *name);
-
- private:
- class Internal;
- struct TLSData;
- typedef hash_map<std::string, int> CountersMap;
-
- // 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.
- // Cannot be used inside a posix tls destructor.
- void UnregisterThread();
-
- // 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(TLSData* tls_data);
-
- // The SlotReturnFunction is called at thread exit for each thread
- // which used the StatsTable.
- static void SlotReturnFunction(void* data);
-
- // Locates a free slot in the table. Returns a number > 0 on success,
- // or 0 on failure. The caller must hold the shared_memory lock when
- // calling this function.
- int FindEmptyThread() const;
-
- // Locates a counter in the table or finds an empty row. Returns a
- // number > 0 on success, or 0 on failure. The caller must hold the
- // shared_memory_lock when calling this function.
- int FindCounterOrEmptyRow(const std::string& name) const;
-
- // Internal function to add a counter to the StatsTable. Assumes that
- // the counter does not already exist in the table.
- //
- // name is a unique identifier for this counter, and will be truncated
- // to kMaxCounterNameLength-1 characters.
- //
- // On success, returns the counter_id for the newly added counter.
- // On failure, returns 0.
- int AddCounter(const std::string& name);
-
- // Get the TLS data for the calling thread. Returns NULL if none is
- // initialized.
- TLSData* GetTLSData() const;
-
- Internal* internal_;
-
- // The counters_lock_ protects the counters_ hash table.
- base::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
- // we don't have a counter in our hash table, another process may
- // have created it.
- CountersMap counters_;
- ThreadLocalStorage::Slot tls_index_;
-
- DISALLOW_COPY_AND_ASSIGN(StatsTable);
-};
-
-} // namespace base
-
-#endif // BASE_METRICS_STATS_TABLE_H_
diff --git a/base/metrics/stats_table_unittest.cc b/base/metrics/stats_table_unittest.cc
deleted file mode 100644
index 38a21cc..0000000
--- a/base/metrics/stats_table_unittest.cc
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright (c) 2012 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/memory/shared_memory.h"
-#include "base/metrics/stats_counters.h"
-#include "base/metrics/stats_table.h"
-#include "base/process/kill.h"
-#include "base/strings/string_piece.h"
-#include "base/strings/stringprintf.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/test/multiprocess_test.h"
-#include "base/threading/platform_thread.h"
-#include "base/threading/simple_thread.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/multiprocess_func_list.h"
-
-namespace base {
-
-class StatsTableTest : public MultiProcessTest {
-};
-
-// Open a StatsTable and verify that we can write to each of the
-// locations in the table.
-TEST_F(StatsTableTest, VerifySlots) {
- const int kMaxThreads = 1;
- const int kMaxCounter = 5;
- StatsTable table(StatsTable::TableIdentifier(), kMaxThreads, kMaxCounter);
-
- // Register a single thread.
- std::string thread_name = "mainThread";
- int slot_id = table.RegisterThread(thread_name);
- EXPECT_NE(slot_id, 0);
-
- // Fill up the table with counters.
- std::string counter_base_name = "counter";
- for (int index = 0; index < kMaxCounter; index++) {
- std::string counter_name = counter_base_name;
- base::StringAppendF(&counter_name, "counter.ctr%d", index);
- int counter_id = table.FindCounter(counter_name);
- EXPECT_GT(counter_id, 0);
- }
-
- // Try to allocate an additional thread. Verify it fails.
- slot_id = table.RegisterThread("too many threads");
- EXPECT_EQ(slot_id, 0);
-
- // Try to allocate an additional counter. Verify it fails.
- int counter_id = table.FindCounter(counter_base_name);
- EXPECT_EQ(counter_id, 0);
-}
-
-// CounterZero will continually be set to 0.
-const std::string kCounterZero = "CounterZero";
-// Counter1313 will continually be set to 1313.
-const std::string kCounter1313 = "Counter1313";
-// CounterIncrement will be incremented each time.
-const std::string kCounterIncrement = "CounterIncrement";
-// CounterDecrement will be decremented each time.
-const std::string kCounterDecrement = "CounterDecrement";
-// CounterMixed will be incremented by odd numbered threads and
-// decremented by even threads.
-const std::string kCounterMixed = "CounterMixed";
-// The number of thread loops that we will do.
-const int kThreadLoops = 100;
-
-class StatsTableThread : public SimpleThread {
- public:
- StatsTableThread(std::string name, int id)
- : SimpleThread(name),
- id_(id) {}
-
- void Run() override;
-
- private:
- int id_;
-};
-
-void StatsTableThread::Run() {
- // Each thread will open the shared memory and set counters
- // concurrently in a loop. We'll use some pauses to
- // mixup the thread scheduling.
-
- StatsCounter zero_counter(kCounterZero);
- StatsCounter lucky13_counter(kCounter1313);
- StatsCounter increment_counter(kCounterIncrement);
- StatsCounter decrement_counter(kCounterDecrement);
- for (int index = 0; index < kThreadLoops; index++) {
- StatsCounter mixed_counter(kCounterMixed); // create this one in the loop
- zero_counter.Set(0);
- lucky13_counter.Set(1313);
- increment_counter.Increment();
- decrement_counter.Decrement();
- if (id_ % 2)
- mixed_counter.Decrement();
- else
- mixed_counter.Increment();
- PlatformThread::Sleep(TimeDelta::FromMilliseconds(index % 10));
- }
-}
-
-// Create a few threads and have them poke on their counters.
-// See http://crbug.com/10611 for more information.
-// It is disabled on Win x64 incremental linking pending resolution of
-// http://crbug.com/251251.
-#if defined(OS_MACOSX) || defined(THREAD_SANITIZER) || \
- (defined(OS_WIN) && defined(ARCH_CPU_X86_64) && \
- defined(INCREMENTAL_LINKING))
-#define MAYBE_MultipleThreads DISABLED_MultipleThreads
-#else
-#define MAYBE_MultipleThreads MultipleThreads
-#endif
-TEST_F(StatsTableTest, MAYBE_MultipleThreads) {
- // Create a stats table.
- const int kMaxThreads = 20;
- const int kMaxCounter = 5;
- StatsTable table(StatsTable::TableIdentifier(), kMaxThreads, kMaxCounter);
- StatsTable::set_current(&table);
-
- EXPECT_EQ(0, table.CountThreadsRegistered());
-
- // Spin up a set of threads to go bang on the various counters.
- // After we join the threads, we'll make sure the counters
- // contain the values we expected.
- StatsTableThread* threads[kMaxThreads];
-
- // Spawn the threads.
- for (int index = 0; index < kMaxThreads; index++) {
- threads[index] = new StatsTableThread("MultipleThreadsTest", index);
- threads[index]->Start();
- }
-
- // Wait for the threads to finish.
- for (int index = 0; index < kMaxThreads; index++) {
- threads[index]->Join();
- delete threads[index];
- }
-
- StatsCounter zero_counter(kCounterZero);
- StatsCounter lucky13_counter(kCounter1313);
- StatsCounter increment_counter(kCounterIncrement);
- StatsCounter decrement_counter(kCounterDecrement);
- StatsCounter mixed_counter(kCounterMixed);
-
- // Verify the various counters are correct.
- std::string name;
- name = "c:" + kCounterZero;
- EXPECT_EQ(0, table.GetCounterValue(name));
- name = "c:" + kCounter1313;
- EXPECT_EQ(1313 * kMaxThreads,
- table.GetCounterValue(name));
- name = "c:" + kCounterIncrement;
- EXPECT_EQ(kMaxThreads * kThreadLoops,
- table.GetCounterValue(name));
- name = "c:" + kCounterDecrement;
- EXPECT_EQ(-kMaxThreads * kThreadLoops,
- table.GetCounterValue(name));
- name = "c:" + kCounterMixed;
- EXPECT_EQ((kMaxThreads % 2) * kThreadLoops,
- table.GetCounterValue(name));
- EXPECT_EQ(0, table.CountThreadsRegistered());
-}
-
-// This multiprocess test only runs on Windows. On Posix, the shared memory
-// handle is not sent between the processes properly.
-#if defined(OS_WIN)
-const std::string kMPTableName = "MultipleProcessStatTable";
-
-MULTIPROCESS_TEST_MAIN(StatsTableMultipleProcessMain) {
- // Each process will open the shared memory and set counters
- // concurrently in a loop. We'll use some pauses to
- // mixup the scheduling.
-
- StatsTable table(kMPTableName, 0, 0);
- StatsTable::set_current(&table);
- StatsCounter zero_counter(kCounterZero);
- StatsCounter lucky13_counter(kCounter1313);
- StatsCounter increment_counter(kCounterIncrement);
- StatsCounter decrement_counter(kCounterDecrement);
- for (int index = 0; index < kThreadLoops; index++) {
- zero_counter.Set(0);
- lucky13_counter.Set(1313);
- increment_counter.Increment();
- decrement_counter.Decrement();
- PlatformThread::Sleep(TimeDelta::FromMilliseconds(index % 10));
- }
- return 0;
-}
-
-// Create a few processes and have them poke on their counters.
-// This test is slow and flaky http://crbug.com/10611
-TEST_F(StatsTableTest, DISABLED_MultipleProcesses) {
- // Create a stats table.
- const int kMaxProcs = 20;
- const int kMaxCounter = 5;
- StatsTable table(kMPTableName, kMaxProcs, kMaxCounter);
- StatsTable::set_current(&table);
- EXPECT_EQ(0, table.CountThreadsRegistered());
-
- // Spin up a set of processes to go bang on the various counters.
- // After we join the processes, we'll make sure the counters
- // contain the values we expected.
- Process procs[kMaxProcs];
-
- // Spawn the processes.
- for (int16 index = 0; index < kMaxProcs; index++) {
- procs[index] = SpawnChild("StatsTableMultipleProcessMain");
- EXPECT_TRUE(procs[index].IsValid());
- }
-
- // Wait for the processes to finish.
- for (int index = 0; index < kMaxProcs; index++) {
- EXPECT_TRUE(WaitForSingleProcess(procs[index].Handle(),
- base::TimeDelta::FromMinutes(1)));
- procs[index].Close();
- }
-
- StatsCounter zero_counter(kCounterZero);
- StatsCounter lucky13_counter(kCounter1313);
- StatsCounter increment_counter(kCounterIncrement);
- StatsCounter decrement_counter(kCounterDecrement);
-
- // Verify the various counters are correct.
- std::string name;
- name = "c:" + kCounterZero;
- EXPECT_EQ(0, table.GetCounterValue(name));
- name = "c:" + kCounter1313;
- EXPECT_EQ(1313 * kMaxProcs,
- table.GetCounterValue(name));
- name = "c:" + kCounterIncrement;
- EXPECT_EQ(kMaxProcs * kThreadLoops,
- table.GetCounterValue(name));
- name = "c:" + kCounterDecrement;
- EXPECT_EQ(-kMaxProcs * kThreadLoops,
- table.GetCounterValue(name));
- EXPECT_EQ(0, table.CountThreadsRegistered());
-}
-#endif
-
-class MockStatsCounter : public StatsCounter {
- public:
- explicit MockStatsCounter(const std::string& name)
- : StatsCounter(name) {}
- int* Pointer() { return GetPtr(); }
-};
-
-// Test some basic StatsCounter operations
-TEST_F(StatsTableTest, StatsCounter) {
- // Create a stats table.
- const int kMaxThreads = 20;
- const int kMaxCounter = 5;
- StatsTable table(StatsTable::TableIdentifier(), kMaxThreads, kMaxCounter);
- StatsTable::set_current(&table);
-
- MockStatsCounter foo("foo");
-
- // Test initial state.
- EXPECT_TRUE(foo.Enabled());
- ASSERT_NE(foo.Pointer(), static_cast<int*>(0));
- EXPECT_EQ(0, *(foo.Pointer()));
- EXPECT_EQ(0, table.GetCounterValue("c:foo"));
-
- // Test Increment.
- while (*(foo.Pointer()) < 123) foo.Increment();
- EXPECT_EQ(123, table.GetCounterValue("c:foo"));
- foo.Add(0);
- EXPECT_EQ(123, table.GetCounterValue("c:foo"));
- foo.Add(-1);
- EXPECT_EQ(122, table.GetCounterValue("c:foo"));
-
- // Test Set.
- foo.Set(0);
- EXPECT_EQ(0, table.GetCounterValue("c:foo"));
- foo.Set(100);
- EXPECT_EQ(100, table.GetCounterValue("c:foo"));
- foo.Set(-1);
- EXPECT_EQ(-1, table.GetCounterValue("c:foo"));
- foo.Set(0);
- EXPECT_EQ(0, table.GetCounterValue("c:foo"));
-
- // Test Decrement.
- foo.Subtract(1);
- EXPECT_EQ(-1, table.GetCounterValue("c:foo"));
- foo.Subtract(0);
- EXPECT_EQ(-1, table.GetCounterValue("c:foo"));
- foo.Subtract(-1);
- EXPECT_EQ(0, table.GetCounterValue("c:foo"));
-}
-
-class MockStatsCounterTimer : public StatsCounterTimer {
- public:
- explicit MockStatsCounterTimer(const std::string& name)
- : StatsCounterTimer(name) {}
-
- TimeTicks start_time() { return start_time_; }
- TimeTicks stop_time() { return stop_time_; }
-};
-
-// Test some basic StatsCounterTimer operations
-TEST_F(StatsTableTest, StatsCounterTimer) {
- // Create a stats table.
- const int kMaxThreads = 20;
- const int kMaxCounter = 5;
- StatsTable table(StatsTable::TableIdentifier(), kMaxThreads, kMaxCounter);
- StatsTable::set_current(&table);
-
- MockStatsCounterTimer bar("bar");
-
- // Test initial state.
- EXPECT_FALSE(bar.Running());
- EXPECT_TRUE(bar.start_time().is_null());
- EXPECT_TRUE(bar.stop_time().is_null());
-
- const TimeDelta kDuration = TimeDelta::FromMilliseconds(100);
-
- // Do some timing.
- bar.Start();
- PlatformThread::Sleep(kDuration);
- bar.Stop();
- EXPECT_GT(table.GetCounterValue("t:bar"), 0);
- EXPECT_LE(kDuration.InMilliseconds(), table.GetCounterValue("t:bar"));
-
- // Verify that timing again is additive.
- bar.Start();
- PlatformThread::Sleep(kDuration);
- bar.Stop();
- EXPECT_GT(table.GetCounterValue("t:bar"), 0);
- EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:bar"));
-}
-
-// Test some basic StatsRate operations
-TEST_F(StatsTableTest, StatsRate) {
- // Create a stats table.
- const int kMaxThreads = 20;
- const int kMaxCounter = 5;
- StatsTable table(StatsTable::TableIdentifier(), kMaxThreads, kMaxCounter);
- StatsTable::set_current(&table);
-
- StatsRate baz("baz");
-
- // Test initial state.
- EXPECT_FALSE(baz.Running());
- EXPECT_EQ(0, table.GetCounterValue("c:baz"));
- EXPECT_EQ(0, table.GetCounterValue("t:baz"));
-
- const TimeDelta kDuration = TimeDelta::FromMilliseconds(100);
-
- // Do some timing.
- baz.Start();
- PlatformThread::Sleep(kDuration);
- baz.Stop();
- EXPECT_EQ(1, table.GetCounterValue("c:baz"));
- EXPECT_LE(kDuration.InMilliseconds(), table.GetCounterValue("t:baz"));
-
- // Verify that timing again is additive.
- baz.Start();
- PlatformThread::Sleep(kDuration);
- baz.Stop();
- EXPECT_EQ(2, table.GetCounterValue("c:baz"));
- EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:baz"));
-}
-
-// Test some basic StatsScope operations
-TEST_F(StatsTableTest, StatsScope) {
- // Create a stats table.
- const int kMaxThreads = 20;
- const int kMaxCounter = 5;
- StatsTable table(StatsTable::TableIdentifier(), kMaxThreads, kMaxCounter);
- StatsTable::set_current(&table);
-
- StatsCounterTimer foo("foo");
- StatsRate bar("bar");
-
- // Test initial state.
- EXPECT_EQ(0, table.GetCounterValue("t:foo"));
- EXPECT_EQ(0, table.GetCounterValue("t:bar"));
- EXPECT_EQ(0, table.GetCounterValue("c:bar"));
-
- const TimeDelta kDuration = TimeDelta::FromMilliseconds(100);
-
- // Try a scope.
- {
- StatsScope<StatsCounterTimer> timer(foo);
- StatsScope<StatsRate> timer2(bar);
- PlatformThread::Sleep(kDuration);
- }
- EXPECT_LE(kDuration.InMilliseconds(), table.GetCounterValue("t:foo"));
- EXPECT_LE(kDuration.InMilliseconds(), table.GetCounterValue("t:bar"));
- EXPECT_EQ(1, table.GetCounterValue("c:bar"));
-
- // Try a second scope.
- {
- StatsScope<StatsCounterTimer> timer(foo);
- StatsScope<StatsRate> timer2(bar);
- PlatformThread::Sleep(kDuration);
- }
- EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:foo"));
- EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:bar"));
- EXPECT_EQ(2, table.GetCounterValue("c:bar"));
-}
-
-} // namespace base
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 7af7949..c1fabd5 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -12,7 +12,6 @@
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/statistics_recorder.h"
-#include "base/metrics/stats_counters.h"
#include "base/path_service.h"
#include "base/process/memory.h"
#include "base/process/process_handle.h"
@@ -689,10 +688,6 @@ void ChromeMainDelegate::PreSandboxStartup() {
// command line flags. Maybe move the chrome PathProvider down here also?
component_updater::RegisterPathProvider(chrome::DIR_USER_DATA);
- stats_counter_timer_.reset(new base::StatsCounterTimer("Chrome.Init"));
- startup_timer_.reset(new base::StatsScope<base::StatsCounterTimer>
- (*stats_counter_timer_));
-
// Enable Message Loop related state asap.
if (command_line.HasSwitch(switches::kMessageLoopHistogrammer))
base::MessageLoop::EnableHistogrammer(true);
@@ -807,8 +802,6 @@ void ChromeMainDelegate::PreSandboxStartup() {
}
void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) {
- startup_timer_->Stop(); // End of Startup Time Measurement.
-
// Note: If you are adding a new process type below, be sure to adjust the
// AdjustLinuxOOMScore function too.
#if defined(OS_LINUX)
diff --git a/chrome/app/chrome_main_delegate.h b/chrome/app/chrome_main_delegate.h
index d2df7c4..50acbaa 100644
--- a/chrome/app/chrome_main_delegate.h
+++ b/chrome/app/chrome_main_delegate.h
@@ -6,7 +6,6 @@
#define CHROME_APP_CHROME_MAIN_DELEGATE_H_
#include "base/memory/scoped_ptr.h"
-#include "base/metrics/stats_counters.h"
#include "chrome/common/chrome_content_client.h"
#include "content/public/app/content_main_delegate.h"
@@ -57,13 +56,6 @@ class ChromeMainDelegate : public content::ContentMainDelegate {
ChromeContentClient chrome_content_client_;
- // startup_timer_ will hold a reference to stats_counter_timer_. Therefore,
- // the declaration order of these variables matters. Changing this order will
- // cause startup_timer_ to be freed before stats_counter_timer_, leaving a
- // dangling reference.
- scoped_ptr<base::StatsCounterTimer> stats_counter_timer_;
- scoped_ptr<base::StatsScope<base::StatsCounterTimer> > startup_timer_;
-
DISALLOW_COPY_AND_ASSIGN(ChromeMainDelegate);
};
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 498e08a..63876f1 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -90,8 +90,6 @@
<include name="IDR_ABOUT_NACL_CSS" file="resources\about_nacl.css" flattenhtml="true" type="chrome_html" />
<include name="IDR_ABOUT_NACL_JS" file="resources\about_nacl.js" type="BINDATA" />
</if>
- <include name="IDR_ABOUT_STATS_HTML" file="resources\about_stats.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" />
- <include name="IDR_ABOUT_STATS_JS" file="resources\about_stats.js" type="BINDATA" />
<if expr="not is_android">
<include name="IDR_ABOUT_SYS_HTML" file="resources\about_sys\about_sys.html" flattenhtml="true" type="BINDATA" />
</if>
diff --git a/chrome/browser/resources/about_stats.html b/chrome/browser/resources/about_stats.html
deleted file mode 100644
index c87901e..0000000
--- a/chrome/browser/resources/about_stats.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<!doctype html>
-
-<html id="t">
-<head>
-<meta charset="utf-8">
-<title>About Stats</title>
-<link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
-<style>
-body {
- border-top: 10px solid #3B85E3;
- color: #333;
-}
-body, td {
- font-size: 11px;
-}
-a:link, a:visited {
- color: #2C3EBA;
- text-decoration: none;
-}
-a:hover {
- color: red;
- text-decoration: underline;
-}
-h1 {
- border-left: 10px solid #FFF;
- font-size: 16px;
- font-weight: bold;
- margin: 0;
- padding: 0.2em;
- color: #3B85E3;
-}
-h2 {
- border-left: 10px solid #FFF;
- font-size: 11px;
- font-weight: normal;
- margin: 0;
- padding: 0 6em 0.2em 0.2em;
-}
-.details {
- margin: 0.4em 1.9em 0 1.2em;
- padding: 0 0.4em 0.3em 0;
- white-space: nowrap;
-}
-.details .outer {
- padding-right: 0;
- vertical-align: top;
-}
-.details .top {
- border-top: 2px solid #333;
- font-weight: bold;
- margin-top: 0.4em;
-}
-.details .header2 {
- font-weight: bold;
- padding-left: 0.9em;
-}
-.details .key {
- padding-left: 1.1em;
- vertical-align: top;
-}
-.details .value {
- text-align: right;
- color: #333;
- font-weight: bold;
-}
-.details .zebra {
- background: #EEE;
-}
-.lower {
- text-transform: lowercase;
-}
-</style>
-<script src="chrome://resources/js/util.js"></script>
-<script src="chrome://stats/stats.js"></script>
-<script src="chrome://stats/strings.js"></script>
-</head>
-<body>
- <div style="float: right">
- <br>Filter: <input id="filter" type="text" value="">
- </div>
- <h1 class="lower">About Stats</h1>
- <h2>Shhh! This page is secret!</h2><br>
- <table class="details" cellspacing="0" cellpadding="0" border="0">
- <tbody>
- <tr>
- <td class="outer">
- <table cellspacing="0" cellpadding="0" border="0">
- <tbody>
- <tr>
- <td class="top" width="100">Counters</td>
- <td class="top value" colspan=2></td>
- </tr>
- <tr>
- <td class="header2 lower" name="string-sort" width="200">name</td>
- <td class="header2 lower" name="number-sort">value</td>
- <td class="header2 lower" name="number-sort">delta</td>
- </tr>
- <tr jsselect="counters" name="counter">
- <td class="key" width="200" jscontent="name"></td>
- <td class="value" jscontent="value"></td>
- <td class="value" jscontent="delta"></td>
- </tr>
- </tbody>
- </table>
- </td>
- <td width="15"></td>
- <td class="outer">
- <table cellspacing="0" cellpadding="0" border="0">
- <tbody>
- <tr>
- <td class="top" width="100">Timers</td>
- <td class="top value"></td>
- <td class="top value" colspan=3></td>
- </tr>
- <tr>
- <td class="header2 lower" name="string-sort" width="200">name</td>
- <td class="header2 lower" name="number-sort">count</td>
- <td class="header2 lower" name="number-sort">time (ms)</td>
- <td class="header2 lower" name="number-sort">avg time (ms)</td>
- </tr>
- <tr jsselect="timers" name="timer">
- <td class="key" width="200" jscontent="name"></td>
- <td class="value" jscontent="value"></td>
- <td class="value" jscontent="time"></td>
- <td class="value"></td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- </tbody>
- </table><br>
- <script src="chrome://resources/js/jstemplate_compiled.js"></script>
-</body>
-</html>
diff --git a/chrome/browser/resources/about_stats.js b/chrome/browser/resources/about_stats.js
deleted file mode 100644
index 380d65e..0000000
--- a/chrome/browser/resources/about_stats.js
+++ /dev/null
@@ -1,200 +0,0 @@
-// Copyright (c) 2012 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.
-
-/* Counter accessor for Name Node. */
-function getCounterNameFromCounterNode(node) {
- return node.childNodes[1];
-}
-
-/* Counter accessor for Value Node. */
-function getCounterValueFromCounterNode(node) {
- return node.childNodes[3];
-}
-
-/* Counter accessor for Delta Node. */
-function getCounterDeltaFromCounterNode(node) {
- return node.childNodes[5];
-}
-
-/* Timer accessor for Name Node. */
-function getTimerNameFromTimerNode(node) {
- return node.childNodes[1];
-}
-
-/* Timer accessor for Value Node. */
-function getTimerValueFromTimerNode(node) {
- return node.childNodes[3];
-}
-
-/* Timer accessor for Time Node. */
-function getTimerTimeFromTimerNode(node) {
- return node.childNodes[5];
-}
-
-/* Timer accessor for Average Time Node. */
-function getTimerAvgTimeFromTimerNode(node) {
- return node.childNodes[7];
-}
-
-/* Do the filter work. Hide all nodes matching node.*/
-function filterMatching(text, nodelist, functionToGetNameNode) {
- var showAll = text.length == 0;
- for (var i = 0, node; node = nodelist[i]; i++) {
- var name = functionToGetNameNode(node).innerHTML.toLowerCase();
- if (showAll || name.indexOf(text) >= 0)
- node.style.display = 'table-row';
- else
- node.style.display = 'none';
- }
-}
-
-/* Hides or shows counters based on the user's current filter selection. */
-function doFilter() {
- var filter = $('filter');
- var text = filter.value.toLowerCase();
- var nodes = document.getElementsByName('counter');
- filterMatching(text, nodes, getCounterNameFromCounterNode);
- var nodes = document.getElementsByName('timer');
- filterMatching(text, nodes, getTimerNameFromTimerNode);
-}
-
-/* Colors the counters based on increasing or decreasing value. */
-function doColor() {
- var nodes = document.getElementsByName('counter');
- for (var i = 0, node; node = nodes[i]; i++) {
- var child = getCounterDeltaFromCounterNode(node);
- var delta = child.innerHTML;
- if (delta > 0)
- child.style.color = 'Green';
- else if (delta == 0)
- child.style.color = 'Black';
- else
- child.style.color = 'Red';
- }
-}
-
-/* Counters with no values are null. Remove them. */
-function removeNullValues() {
- var nodes = document.getElementsByName('counter');
- for (var i = nodes.length - 1; i >= 0; i--) {
- var node = nodes[i];
- var value = getCounterValueFromCounterNode(node).innerHTML;
- if (value == 'null')
- node.parentNode.removeChild(node);
- }
- var nodes = document.getElementsByName('timer');
- for (var i = 0, node; node = nodes[i]; i++) {
- var valueNode = getTimerValueFromTimerNode(node);
- if (valueNode.innerHTML == 'null')
- valueNode.innerHTML = '';
- }
-}
-
-/* Compute the average time for timers */
-function computeTimes() {
- var nodes = document.getElementsByName('timer');
- for (var i = 0, node; node = nodes[i]; i++) {
- var count = getTimerValueFromTimerNode(node).innerHTML;
- if (count.length > 0) {
- var time = getTimerTimeFromTimerNode(node).innerHTML;
- var avg = getTimerAvgTimeFromTimerNode(node);
- avg.innerHTML = Math.round(time / count * 100) / 100;
- }
- }
-}
-
-/* All the work we do onload. */
-function onLoadWork() {
- // This is the javascript code that processes the template:
- var input = new JsEvalContext(templateData);
- var output = $('t');
- jstProcess(input, output);
-
- // Add handlers to dynamically created HTML elements.
- var elements = document.getElementsByName('string-sort');
- for (var i = 0; i < elements.length; ++i)
- elements[i].onclick = function() { sortTable('string'); };
-
- elements = document.getElementsByName('number-sort');
- for (i = 0; i < elements.length; ++i)
- elements[i].onclick = function() { sortTable('number'); };
-
- doColor();
- removeNullValues();
- computeTimes();
-
- var filter = $('filter');
- filter.onkeyup = doFilter;
- filter.focus();
-}
-
-// The function should only be used as the event handler
-// on a table cell element. To use it, put it in a <td> element:
-// <td onclick="sort('string')" ...>
-//
-// The function sorts rows after the row with onclick event handler.
-//
-// type: the data type, 'string', 'number'
-function sortTable(type) {
- var cell = event.target;
- var cnum = cell.cellIndex;
-
- var row = cell.parentNode;
- var startIndex = row.rowIndex + 1;
-
- var tbody = row.parentNode;
- var table = tbody.parentNode;
-
- var rows = new Array();
-
- var indexes = new Array();
- // skip the first row
- for (var i = startIndex; i < table.rows.length; i++)
- rows.push(table.rows[i]);
-
- // a, b are strings
- function compareStrings(a, b) {
- if (a == b) return 0;
- if (a < b) return -1;
- return 1;
- }
-
- // a, b are numbers
- function compareNumbers(a, b) {
- var x = isNaN(a) ? 0 : a;
- var y = isNaN(b) ? 0 : b;
- return x - y;
- }
-
- var sortFunc;
- if (type === 'string') {
- sortFunc = function(a, b) {
- var x = a.cells[cnum].innerText;
- var y = b.cells[cnum].innerText;
- return compareStrings(x, y);
- };
-
- } else if (type === 'number') {
- sortFunc = function(a, b) {
- var x = parseFloat(a.cells[cnum].innerText);
- var y = parseFloat(b.cells[cnum].innerText);
- return compareNumbers(x, y);
- };
- }
-
- rows.sort(sortFunc);
-
- // change tables
- if (cell._reverse) {
- for (var i = rows.length - 1; i >= 0; i--)
- tbody.appendChild(rows[i]);
- cell._reverse = false;
- } else {
- for (var i = 0; i < rows.length; i++)
- tbody.appendChild(rows[i]);
- cell._reverse = true;
- }
-}
-
-document.addEventListener('DOMContentLoaded', onLoadWork);
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 0ada4bc..c28a9aa 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"
#include "base/sha1.h"
@@ -1089,13 +1088,11 @@ void SafeBrowsingDatabaseNew::InsertAddChunk(
if (chunk_data.IsPrefix()) {
const size_t c = chunk_data.PrefixCount();
for (size_t i = 0; i < c; ++i) {
- STATS_COUNTER("SB.PrefixAdd", 1);
store->WriteAddPrefix(encoded_chunk_id, chunk_data.PrefixAt(i));
}
} else {
const size_t c = chunk_data.FullHashCount();
for (size_t i = 0; i < c; ++i) {
- STATS_COUNTER("SB.PrefixAddFull", 1);
store->WriteAddHash(encoded_chunk_id, chunk_data.FullHashAt(i));
}
}
@@ -1120,7 +1117,6 @@ void SafeBrowsingDatabaseNew::InsertSubChunk(
if (chunk_data.IsPrefix()) {
const size_t c = chunk_data.PrefixCount();
for (size_t i = 0; i < c; ++i) {
- STATS_COUNTER("SB.PrefixSub", 1);
const int add_chunk_id = chunk_data.AddChunkNumberAt(i);
const int encoded_add_chunk_id = EncodeChunkId(add_chunk_id, list_id);
store->WriteSubPrefix(encoded_chunk_id, encoded_add_chunk_id,
@@ -1129,7 +1125,6 @@ void SafeBrowsingDatabaseNew::InsertSubChunk(
} else {
const size_t c = chunk_data.FullHashCount();
for (size_t i = 0; i < c; ++i) {
- STATS_COUNTER("SB.PrefixSubFull", 1);
const int add_chunk_id = chunk_data.AddChunkNumberAt(i);
const int encoded_add_chunk_id = EncodeChunkId(add_chunk_id, list_id);
store->WriteSubHash(encoded_chunk_id, encoded_add_chunk_id,
diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc
index 33b07b8..bdfe4f8 100644
--- a/chrome/browser/ui/views/task_manager_view.cc
+++ b/chrome/browser/ui/views/task_manager_view.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/task_manager/task_manager.h"
#include "base/compiler_specific.h"
-#include "base/metrics/stats_table.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/strings/utf_string_conversions.h"
@@ -187,10 +186,6 @@ class TaskManagerView : public views::ButtonListener,
// views::LinkListener:
void LinkClicked(views::Link* source, int event_flags) override;
- // Called by the column picker to pick up any new stat counters that
- // may have appeared since last time.
- void UpdateStatsCounters();
-
// views::ContextMenuController:
void ShowContextMenuForView(views::View* source,
const gfx::Point& point,
@@ -363,7 +358,6 @@ void TaskManagerView::Init() {
tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_USER_HANDLES_COLUMN, false);
tab_table_->SetColumnVisibility(IDS_TASK_MANAGER_IDLE_WAKEUPS_COLUMN, false);
- UpdateStatsCounters();
tab_table_->SetObserver(this);
tab_table_->set_context_menu_controller(this);
set_context_menu_controller(this);
@@ -381,32 +375,6 @@ void TaskManagerView::Init() {
AddAccelerator(ctrl_w);
}
-void TaskManagerView::UpdateStatsCounters() {
- base::StatsTable* stats = base::StatsTable::current();
- if (stats != NULL) {
- int max = stats->GetMaxCounters();
- // skip the first row (it's header data)
- for (int i = 1; i < max; i++) {
- const char* row = stats->GetRowName(i);
- if (row != NULL && row[0] != '\0' && !tab_table_->HasColumn(i)) {
- // TODO(erikkay): Use l10n to get display names for stats. Right
- // now we're just displaying the internal counter name. Perhaps
- // stat names not in the string table would be filtered out.
- ui::TableColumn col;
- col.id = i;
- col.title = base::ASCIIToUTF16(row);
- col.alignment = ui::TableColumn::RIGHT;
- // TODO(erikkay): Width is hard-coded right now, so many column
- // names are clipped.
- col.width = 90;
- col.sortable = true;
- columns_.push_back(col);
- tab_table_->AddColumn(col);
- }
- }
- }
-}
-
void TaskManagerView::ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) {
views::DialogDelegateView::ViewHierarchyChanged(details);
@@ -601,7 +569,6 @@ void TaskManagerView::LinkClicked(views::Link* source, int event_flags) {
void TaskManagerView::ShowContextMenuForView(views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) {
- UpdateStatsCounters();
ui::SimpleMenuModel menu_model(this);
for (std::vector<ui::TableColumn>::iterator i(columns_.begin());
i != columns_.end(); ++i) {
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc
index b93254c..3d99831 100644
--- a/chrome/browser/ui/webui/about_ui.cc
+++ b/chrome/browser/ui/webui/about_ui.cc
@@ -18,7 +18,6 @@
#include "base/json/json_writer.h"
#include "base/memory/singleton.h"
#include "base/metrics/statistics_recorder.h"
-#include "base/metrics/stats_table.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -660,173 +659,6 @@ void FinishMemoryDataRequest(
}
}
-// Handler for filling in the "about:stats" page, as called by the browser's
-// About handler processing.
-// |query| is roughly the query string of the about:stats URL.
-// Returns a string containing the HTML to render for the about:stats page.
-// Conditional Output:
-// if |query| is "json", returns a JSON format of all counters.
-// if |query| is "raw", returns plain text of counter deltas.
-// otherwise, returns HTML with pretty JS/HTML to display the data.
-std::string AboutStats(const std::string& query) {
- // We keep the base::DictionaryValue tree live so that we can do delta
- // stats computations across runs.
- CR_DEFINE_STATIC_LOCAL(base::DictionaryValue, root, ());
- static base::TimeTicks last_sample_time = base::TimeTicks::Now();
-
- base::TimeTicks now = base::TimeTicks::Now();
- base::TimeDelta time_since_last_sample = now - last_sample_time;
- last_sample_time = now;
-
- base::StatsTable* table = base::StatsTable::current();
- if (!table)
- return std::string();
-
- // We maintain two lists - one for counters and one for timers.
- // Timers actually get stored on both lists.
- base::ListValue* counters;
- if (!root.GetList("counters", &counters)) {
- counters = new base::ListValue();
- root.Set("counters", counters);
- }
-
- base::ListValue* timers;
- if (!root.GetList("timers", &timers)) {
- timers = new base::ListValue();
- root.Set("timers", timers);
- }
-
- // NOTE: Counters start at index 1.
- for (int index = 1; index <= table->GetMaxCounters(); index++) {
- // Get the counter's full name
- std::string full_name = table->GetRowName(index);
- if (full_name.length() == 0)
- break;
- DCHECK_EQ(':', full_name[1]);
- char counter_type = full_name[0];
- std::string name = full_name.substr(2);
-
- // JSON doesn't allow '.' in names.
- size_t pos;
- while ((pos = name.find(".")) != std::string::npos)
- name.replace(pos, 1, ":");
-
- // Try to see if this name already exists.
- base::DictionaryValue* counter = NULL;
- for (size_t scan_index = 0;
- scan_index < counters->GetSize(); scan_index++) {
- base::DictionaryValue* dictionary;
- if (counters->GetDictionary(scan_index, &dictionary)) {
- std::string scan_name;
- if (dictionary->GetString("name", &scan_name) && scan_name == name) {
- counter = dictionary;
- }
- } else {
- NOTREACHED(); // Should always be there
- }
- }
-
- if (counter == NULL) {
- counter = new base::DictionaryValue();
- counter->SetString("name", name);
- counters->Append(counter);
- }
-
- switch (counter_type) {
- case 'c':
- {
- int new_value = table->GetRowValue(index);
- int prior_value = 0;
- int delta = 0;
- if (counter->GetInteger("value", &prior_value)) {
- delta = new_value - prior_value;
- }
- counter->SetInteger("value", new_value);
- counter->SetInteger("delta", delta);
- }
- break;
- case 'm':
- {
- // TODO(mbelshe): implement me.
- }
- break;
- case 't':
- {
- int time = table->GetRowValue(index);
- counter->SetInteger("time", time);
-
- // Store this on the timers list as well.
- timers->Append(counter);
- }
- break;
- default:
- NOTREACHED();
- }
- }
-
- std::string data;
- if (query == "json" || query == kStringsJsPath) {
- base::JSONWriter::WriteWithOptions(
- &root,
- base::JSONWriter::OPTIONS_PRETTY_PRINT,
- &data);
- if (query == kStringsJsPath)
- data = "loadTimeData.data = " + data + ";";
- } else if (query == "raw") {
- // Dump the raw counters which have changed in text format.
- data = "<pre>";
- data.append(base::StringPrintf("Counter changes in the last %ldms\n",
- static_cast<long int>(time_since_last_sample.InMilliseconds())));
- for (size_t i = 0; i < counters->GetSize(); ++i) {
- base::Value* entry = NULL;
- bool rv = counters->Get(i, &entry);
- if (!rv)
- continue; // None of these should fail.
- base::DictionaryValue* counter =
- static_cast<base::DictionaryValue*>(entry);
- int delta;
- rv = counter->GetInteger("delta", &delta);
- if (!rv)
- continue;
- if (delta > 0) {
- std::string name;
- rv = counter->GetString("name", &name);
- if (!rv)
- continue;
- int value;
- rv = counter->GetInteger("value", &value);
- if (!rv)
- continue;
- data.append(name);
- data.append(":");
- data.append(base::IntToString(delta));
- data.append("\n");
- }
- }
- data.append("</pre>");
- } else {
- // Get about_stats.html/js from resource bundle.
- data = ResourceBundle::GetSharedInstance().GetRawDataResource(
- (query == kStatsJsPath ?
- IDR_ABOUT_STATS_JS : IDR_ABOUT_STATS_HTML)).as_string();
-
- if (query != kStatsJsPath) {
- // Clear the timer list since we stored the data in the timers list
- // as well.
- for (int index = static_cast<int>(timers->GetSize())-1; index >= 0;
- index--) {
- scoped_ptr<base::Value> value;
- timers->Remove(index, &value);
- // We don't care about the value pointer; it's still tracked
- // on the counters list.
- ignore_result(value.release());
- }
- }
- }
-
- return data;
-}
-
#if defined(OS_LINUX) || defined(OS_OPENBSD)
std::string AboutLinuxProxyConfig() {
std::string data;
@@ -1107,8 +939,6 @@ void AboutUIHTMLSource::StartDataRequest(
} else if (source_name_ == chrome::kChromeUISandboxHost) {
response = AboutSandbox();
#endif
- } else if (source_name_ == chrome::kChromeUIStatsHost) {
- response = AboutStats(path);
#if !defined(OS_ANDROID)
} else if (source_name_ == chrome::kChromeUITermsHost) {
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index d2a1273..35a9b45 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -245,8 +245,7 @@ bool IsAboutUI(const GURL& url) {
url.host() == chrome::kChromeUICreditsHost ||
url.host() == chrome::kChromeUIDNSHost ||
url.host() == chrome::kChromeUIMemoryHost ||
- url.host() == chrome::kChromeUIMemoryRedirectHost ||
- url.host() == chrome::kChromeUIStatsHost
+ url.host() == chrome::kChromeUIMemoryRedirectHost
#if !defined(OS_ANDROID)
|| url.host() == chrome::kChromeUITermsHost
#endif
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 5dc987a..de83b7e 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -230,7 +230,6 @@ const char kChromeUISettingsFrameHost[] = "settings-frame";
const char kChromeUIShorthangHost[] = "shorthang";
const char kChromeUISignInInternalsHost[] = "signin-internals";
const char kChromeUISSLClientCertificateSelectorHost[] = "select-cert";
-const char kChromeUIStatsHost[] = "stats";
const char kChromeUISuggestionsHost[] = "suggestions";
const char kChromeUISuggestionsInternalsHost[] = "suggestions-internals";
const char kChromeUISupervisedUserPassphrasePageHost[] =
@@ -594,7 +593,6 @@ const char* const kChromeHostURLs[] = {
kChromeUIPredictorsHost,
kChromeUIProfilerHost,
kChromeUISignInInternalsHost,
- kChromeUIStatsHost,
kChromeUISuggestionsHost,
kChromeUISyncInternalsHost,
kChromeUITermsHost,
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index adfbeb5..a70e70b 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -222,7 +222,6 @@ extern const char kChromeUISignInInternalsHost[];
extern const char kChromeUISuggestionsHost[];
extern const char kChromeUISuggestionsInternalsHost[];
extern const char kChromeUISSLClientCertificateSelectorHost[];
-extern const char kChromeUIStatsHost[];
extern const char kChromeUISupervisedUserPassphrasePageHost[];
extern const char kChromeUISyncHost[];
extern const char kChromeUISyncFileSystemInternalsHost[];
diff --git a/chrome/renderer/benchmarking_extension.cc b/chrome/renderer/benchmarking_extension.cc
index 1a47051..45bc31f 100644
--- a/chrome/renderer/benchmarking_extension.cc
+++ b/chrome/renderer/benchmarking_extension.cc
@@ -5,7 +5,6 @@
#include "chrome/renderer/benchmarking_extension.h"
#include "base/command_line.h"
-#include "base/metrics/stats_table.h"
#include "base/time/time.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_thread.h"
@@ -25,14 +24,6 @@ class BenchmarkingWrapper : public v8::Extension {
"if (typeof(chrome.benchmarking) == 'undefined') {"
" chrome.benchmarking = {};"
"};"
- "chrome.benchmarking.counter = function(name) {"
- " native function GetCounter();"
- " return GetCounter(name);"
- "};"
- "chrome.benchmarking.counterForRenderer = function(name) {"
- " native function GetCounterForRenderer();"
- " return GetCounterForRenderer(name);"
- "};"
"chrome.benchmarking.isSingleProcess = function() {"
" native function IsSingleProcess();"
" return IsSingleProcess();"
@@ -62,13 +53,7 @@ class BenchmarkingWrapper : public v8::Extension {
v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate,
v8::Handle<v8::String> name) override {
- if (name->Equals(v8::String::NewFromUtf8(isolate, "GetCounter"))) {
- return v8::FunctionTemplate::New(isolate, GetCounter);
- } else if (name->Equals(
- v8::String::NewFromUtf8(isolate, "GetCounterForRenderer"))) {
- return v8::FunctionTemplate::New(isolate, GetCounterForRenderer);
- } else if (name->Equals(
- v8::String::NewFromUtf8(isolate, "IsSingleProcess"))) {
+ if (name->Equals(v8::String::NewFromUtf8(isolate, "IsSingleProcess"))) {
return v8::FunctionTemplate::New(isolate, IsSingleProcess);
} else if (name->Equals(v8::String::NewFromUtf8(isolate, "HiResTime"))) {
return v8::FunctionTemplate::New(isolate, HiResTime);
@@ -77,41 +62,6 @@ class BenchmarkingWrapper : public v8::Extension {
return v8::Handle<v8::FunctionTemplate>();
}
- /*
- * Extract the counter name from arguments.
- */
- static void ExtractCounterName(
- const v8::FunctionCallbackInfo<v8::Value>& args,
- char* name,
- size_t capacity) {
- name[0] = 'c';
- name[1] = ':';
- args[0]->ToString(args.GetIsolate())->WriteUtf8(&name[2], capacity - 3);
- }
-
- static void GetCounter(const v8::FunctionCallbackInfo<v8::Value>& args) {
- if (!args.Length() || !args[0]->IsString() || !base::StatsTable::current())
- return;
-
- char name[256];
- ExtractCounterName(args, name, sizeof(name));
- int counter = base::StatsTable::current()->GetCounterValue(name);
- args.GetReturnValue().Set(static_cast<int32_t>(counter));
- }
-
- static void GetCounterForRenderer(
- const v8::FunctionCallbackInfo<v8::Value>& args) {
- if (!args.Length() || !args[0]->IsString() || !base::StatsTable::current())
- return;
-
- char name[256];
- ExtractCounterName(args, name, sizeof(name));
- int counter = base::StatsTable::current()->GetCounterValue(
- name,
- base::GetCurrentProcId());
- args.GetReturnValue().Set(static_cast<int32_t>(counter));
- }
-
static void IsSingleProcess(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess));
diff --git a/chrome/renderer/net_benchmarking_extension.h b/chrome/renderer/net_benchmarking_extension.h
index f3083d3..f1cc7ee 100644
--- a/chrome/renderer/net_benchmarking_extension.h
+++ b/chrome/renderer/net_benchmarking_extension.h
@@ -5,7 +5,9 @@
#ifndef CHROME_RENDERER_NET_BENCHMARKING_EXTENSION_H_
#define CHROME_RENDERER_NET_BENCHMARKING_EXTENSION_H_
-#include "chrome/renderer/benchmarking_extension.h"
+namespace v8 {
+class Extension;
+}
namespace extensions_v8 {
diff --git a/components/network_hints/renderer/dns_prefetch_queue.cc b/components/network_hints/renderer/dns_prefetch_queue.cc
index 8328df9..af34d8d 100644
--- a/components/network_hints/renderer/dns_prefetch_queue.cc
+++ b/components/network_hints/renderer/dns_prefetch_queue.cc
@@ -7,7 +7,6 @@
#include "components/network_hints/renderer/dns_prefetch_queue.h"
#include "base/logging.h"
-#include "base/metrics/stats_counters.h"
namespace network_hints {
@@ -46,8 +45,6 @@ DnsQueue::PushResult DnsQueue::Push(const char* source,
if (0 < size_ && readable_ + length < buffer_sentinel_ &&
0 == strncmp(source, &buffer_[readable_], unsigned_length) &&
'\0' == buffer_[readable_ + unsigned_length]) {
- SIMPLE_STATS_COUNTER("DNS.PrefetchDnsRedundantPush");
-
// We already wrote this name to the queue, so we'll skip this repeat.
return REDUNDANT_PUSH;
}
@@ -63,10 +60,8 @@ DnsQueue::PushResult DnsQueue::Push(const char* source,
available_space += buffer_size_;
}
- if (length + 1 >= available_space) {
- SIMPLE_STATS_COUNTER("DNS.PrefetchDnsQueueFull");
+ if (length + 1 >= available_space)
return OVERFLOW_PUSH; // Not enough space to push.
- }
BufferSize dest = writeable_;
BufferSize space_till_wrap = buffer_sentinel_ - dest;
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index a57f04a..3163a45 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
-#include "base/metrics/stats_table.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/memory.h"
@@ -211,38 +210,6 @@ static base::ProcessId GetBrowserPid(const base::CommandLine& command_line) {
}
#endif
-static void InitializeStatsTable(const base::CommandLine& command_line) {
- // Initialize the Stats Counters table. With this initialized,
- // the StatsViewer can be utilized to read counters outside of
- // Chrome. These lines can be commented out to effectively turn
- // counters 'off'. The table is created and exists for the life
- // of the process. It is not cleaned up.
- if (command_line.HasSwitch(switches::kEnableStatsTable)) {
- // NOTIMPLEMENTED: we probably need to shut this down correctly to avoid
- // leaking shared memory regions on posix platforms.
-#if defined(OS_POSIX)
- // Stats table is in the global file descriptors table on Posix.
- base::GlobalDescriptors* global_descriptors =
- base::GlobalDescriptors::GetInstance();
- base::FileDescriptor table_ident;
- if (global_descriptors->MaybeGet(kStatsTableSharedMemFd) != -1) {
- // Open the shared memory file descriptor passed by the browser process.
- table_ident = base::FileDescriptor(
- global_descriptors->Get(kStatsTableSharedMemFd), false);
- }
-#elif defined(OS_WIN)
- // Stats table is in a named segment on Windows. Use the PID to make this
- // unique on the system.
- std::string table_ident =
- base::StringPrintf("%s-%u", kStatsFilename,
- static_cast<unsigned int>(GetBrowserPid(command_line)));
-#endif
- base::StatsTable* stats_table =
- new base::StatsTable(table_ident, kStatsMaxThreads, kStatsMaxCounters);
- base::StatsTable::set_current(stats_table);
- }
-}
-
class ContentClientInitializer {
public:
static void Set(const std::string& process_type,
@@ -334,11 +301,6 @@ int RunZygote(const MainFunctionParams& main_function_params,
command_line.GetSwitchValueASCII(switches::kProcessType);
ContentClientInitializer::Set(process_type, delegate);
- // The StatsTable must be initialized in each process; we already
- // initialized for the browser process, now we need to initialize
- // within the new processes as well.
- InitializeStatsTable(command_line);
-
MainFunctionParams main_params(command_line);
main_params.zygote_child = true;
@@ -755,8 +717,6 @@ class ContentMainRunnerImpl : public ContentMainRunner {
#endif // V8_USE_EXTERNAL_STARTUP_DATA
#endif // OS_ANDROID
- InitializeStatsTable(command_line);
-
if (delegate_)
delegate_->PreSandboxStartup();
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index e6e5c32..e5c93ee 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -43,7 +43,6 @@
#endif
#if defined(OS_POSIX)
-#include "base/metrics/stats_table.h"
#include "base/posix/global_descriptors.h"
#include "content/browser/file_descriptor_info_impl.h"
#endif
@@ -344,13 +343,6 @@ void ChildProcessLauncher::Context::LaunchInternal(
#else
files_to_register->Transfer(kPrimaryIPCChannel, ipcfd.Pass());
#endif
- base::StatsTable* stats_table = base::StatsTable::current();
- if (stats_table &&
- base::SharedMemory::IsHandleValid(stats_table->GetSharedMemoryHandle())) {
- base::FileDescriptor fd = stats_table->GetSharedMemoryHandle();
- DCHECK(!fd.auto_close);
- files_to_register->Share(kStatsTableSharedMemFd, fd.fd);
- }
#endif
#if defined(OS_ANDROID)
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index d6789a7..c970d07 100644
--- a/content/browser/download/download_resource_handler.cc
+++ b/content/browser/download/download_resource_handler.cc
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/strings/stringprintf.h"
#include "content/browser/byte_stream.h"
#include "content/browser/download/download_create_info.h"
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index d2215b13..4f90143 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -10,7 +10,6 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/process/process.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
@@ -2742,8 +2741,6 @@ void WebContentsImpl::OnDidLoadResourceFromMemoryCache(
const std::string& http_method,
const std::string& mime_type,
ResourceType resource_type) {
- base::StatsCounter cache("WebKit.CacheHit");
- cache.Increment();
// Send out a notification that we loaded a resource from our memory cache.
int cert_id = 0;
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index c41f1f1..ffea5f9 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -16,7 +16,6 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/process/process_metrics.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
@@ -539,11 +538,9 @@ blink::WebWaitableEvent* BlinkPlatformImpl::waitMultipleEvents(
}
void BlinkPlatformImpl::decrementStatsCounter(const char* name) {
- base::StatsCounter(name).Decrement();
}
void BlinkPlatformImpl::incrementStatsCounter(const char* name) {
- base::StatsCounter(name).Increment();
}
void BlinkPlatformImpl::histogramCustomCounts(
diff --git a/content/child/npapi/plugin_lib.cc b/content/child/npapi/plugin_lib.cc
index 9df2f58..1d7ebe9 100644
--- a/content/child/npapi/plugin_lib.cc
+++ b/content/child/npapi/plugin_lib.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
-#include "base/metrics/stats_counters.h"
#include "base/strings/string_util.h"
#include "content/child/npapi/plugin_host.h"
#include "content/child/npapi/plugin_instance.h"
@@ -15,9 +14,6 @@
namespace content {
-const char kPluginLibrariesLoadedCounter[] = "PluginLibrariesLoaded";
-const char kPluginInstancesActiveCounter[] = "PluginInstancesActive";
-
// A list of all the instantiated plugins.
static std::vector<scoped_refptr<PluginLib> >* g_loaded_libs;
@@ -71,7 +67,6 @@ PluginLib::PluginLib(const WebPluginInfo& info)
instance_count_(0),
skip_unload_(false),
defer_unload_(false) {
- base::StatsCounter(kPluginLibrariesLoadedCounter).Increment();
memset(static_cast<void*>(&plugin_funcs_), 0, sizeof(plugin_funcs_));
g_loaded_libs->push_back(make_scoped_refptr(this));
@@ -79,7 +74,6 @@ PluginLib::PluginLib(const WebPluginInfo& info)
}
PluginLib::~PluginLib() {
- base::StatsCounter(kPluginLibrariesLoadedCounter).Decrement();
if (saved_data_ != 0) {
// TODO - delete the savedData object here
}
@@ -151,13 +145,11 @@ void PluginLib::PreventLibraryUnload() {
PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) {
PluginInstance* new_instance = new PluginInstance(this, mime_type);
instance_count_++;
- base::StatsCounter(kPluginInstancesActiveCounter).Increment();
DCHECK_NE(static_cast<PluginInstance*>(NULL), new_instance);
return new_instance;
}
void PluginLib::CloseInstance() {
- 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/content/child/npapi/webplugin_delegate_impl_mac.mm b/content/child/npapi/webplugin_delegate_impl_mac.mm
index d93b9c3..8dd549c 100644
--- a/content/child/npapi/webplugin_delegate_impl_mac.mm
+++ b/content/child/npapi/webplugin_delegate_impl_mac.mm
@@ -12,7 +12,6 @@
#include <string>
#include "base/memory/scoped_ptr.h"
-#include "base/metrics/stats_counters.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
@@ -436,9 +435,6 @@ void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context,
return;
DCHECK(!use_buffer_context_ || buffer_context_ == context);
- base::StatsRate plugin_paint("Plugin.Paint");
- base::StatsScope<base::StatsRate> scope(plugin_paint);
-
gfx::Rect paint_rect = damage_rect;
if (use_buffer_context_) {
// Plugin invalidates trigger asynchronous paints with the original
diff --git a/content/child/npapi/webplugin_delegate_impl_win.cc b/content/child/npapi/webplugin_delegate_impl_win.cc
index fe7bac7..fffbe2e 100644
--- a/content/child/npapi/webplugin_delegate_impl_win.cc
+++ b/content/child/npapi/webplugin_delegate_impl_win.cc
@@ -14,7 +14,6 @@
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
-#include "base/metrics/stats_counters.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
@@ -1053,8 +1052,6 @@ void WebPluginDelegateImpl::WindowlessPaint(HDC hdc,
paint_event.event = WM_PAINT;
paint_event.wParam = PtrToUlong(hdc);
paint_event.lParam = reinterpret_cast<uintptr_t>(&damage_rect_win);
- 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/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index a55b557..991d728f 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -19,7 +19,6 @@
#include "base/memory/shared_memory.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_table.h"
#include "base/path_service.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string16.h"
@@ -995,8 +994,6 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
blink::initialize(blink_platform_impl_.get());
v8::Isolate* isolate = blink::mainThreadIsolate();
-
- isolate->SetCounterFunction(base::StatsTable::FindLocation);
isolate->SetCreateHistogramFunction(CreateHistogram);
isolate->SetAddHistogramSampleFunction(AddHistogramSample);
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc
index efbbc63..5ad7947 100644
--- a/content/renderer/renderer_main.cc
+++ b/content/renderer/renderer_main.cc
@@ -12,7 +12,6 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/metrics/statistics_recorder.h"
-#include "base/metrics/stats_counters.h"
#include "base/pending_task.h"
#include "base/strings/string_util.h"
#include "base/sys_info.h"
@@ -132,11 +131,6 @@ int RendererMain(const MainFunctionParams& parameters) {
HandleRendererErrorTestParameters(parsed_command_line);
RendererMainPlatformDelegate platform(parameters);
-
-
- base::StatsCounterTimer stats_counter_timer("Content.RendererInit");
- base::StatsScope<base::StatsCounterTimer> startup_timer(stats_counter_timer);
-
RendererMessageLoopObserver task_observer;
#if defined(OS_MACOSX)
// As long as scrollbars on Mac are painted with Cocoa, the message pump
@@ -214,11 +208,8 @@ int RendererMain(const MainFunctionParams& parameters) {
RenderProcessImpl render_process;
new RenderThreadImpl(main_message_loop.Pass());
#endif
-
base::HighResolutionTimerManager hi_res_timer_manager;
- startup_timer.Stop(); // End of Startup Time Measurement.
-
if (run_loop) {
#if defined(OS_MACOSX)
if (pool)
diff --git a/content/test/test_blink_web_unit_test_support.cc b/content/test/test_blink_web_unit_test_support.cc
index 38ecbab..1bee8c0 100644
--- a/content/test/test_blink_web_unit_test_support.cc
+++ b/content/test/test_blink_web_unit_test_support.cc
@@ -8,7 +8,6 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/metrics/stats_counters.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/common/content_switches.h"
@@ -54,12 +53,6 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport() {
url_loader_factory_.reset(new WebURLLoaderMockFactory());
mock_clipboard_.reset(new MockWebClipboardImpl());
- // Create an anonymous stats table since we don't need to share between
- // processes.
- stats_table_.reset(
- new base::StatsTable(base::StatsTable::TableIdentifier(), 20, 200));
- base::StatsTable::set_current(stats_table_.get());
-
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
gin::IsolateHolder::LoadV8Snapshot();
#endif
@@ -70,8 +63,6 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport() {
}
blink::initialize(this);
- blink::mainThreadIsolate()->SetCounterFunction(
- base::StatsTable::FindLocation);
blink::setLayoutTestMode(true);
blink::WebSecurityPolicy::registerURLSchemeAsLocal(
blink::WebString::fromUTF8("test-shell-resource"));
@@ -125,8 +116,6 @@ TestBlinkWebUnitTestSupport::~TestBlinkWebUnitTestSupport() {
url_loader_factory_.reset();
mock_clipboard_.reset();
blink::shutdown();
- base::StatsTable::set_current(NULL);
- stats_table_.reset();
}
blink::WebBlobRegistry* TestBlinkWebUnitTestSupport::blobRegistry() {
diff --git a/content/test/test_blink_web_unit_test_support.h b/content/test/test_blink_web_unit_test_support.h
index efb5a29..cbea4c5 100644
--- a/content/test/test_blink_web_unit_test_support.h
+++ b/content/test/test_blink_web_unit_test_support.h
@@ -95,7 +95,6 @@ class TestBlinkWebUnitTestSupport : public blink::WebUnitTestSupport,
base::ScopedTempDir file_system_root_;
scoped_ptr<WebURLLoaderMockFactory> url_loader_factory_;
cc_blink::WebCompositorSupportImpl compositor_support_;
- scoped_ptr<base::StatsTable> stats_table_;
scoped_ptr<RendererScheduler> renderer_scheduler_;
scoped_ptr<WebSchedulerImpl> web_scheduler_;
diff --git a/mojo/services/html_viewer/ax_provider_impl_unittest.cc b/mojo/services/html_viewer/ax_provider_impl_unittest.cc
index 8bd81c6..7e7c5ec 100644
--- a/mojo/services/html_viewer/ax_provider_impl_unittest.cc
+++ b/mojo/services/html_viewer/ax_provider_impl_unittest.cc
@@ -6,7 +6,6 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
-#include "base/metrics/stats_counters.h"
#include "gin/public/isolate_holder.h"
#include "mojo/services/html_viewer/blink_platform_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/net/disk_cache/blockfile/backend_impl.cc b/net/disk_cache/blockfile/backend_impl.cc
index 980249b..b9077f1 100644
--- a/net/disk_cache/blockfile/backend_impl.cc
+++ b/net/disk_cache/blockfile/backend_impl.cc
@@ -13,7 +13,6 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/rand_util.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
@@ -505,7 +504,6 @@ EntryImpl* BackendImpl::OpenEntryImpl(const std::string& key) {
static_cast<base::HistogramBase::Sample>(use_hours));
stats_.OnEvent(Stats::OPEN_HIT);
web_fonts_histogram::RecordCacheHit(cache_entry);
- SIMPLE_STATS_COUNTER("disk_cache.hit");
return cache_entry;
}
@@ -601,7 +599,6 @@ EntryImpl* BackendImpl::CreateEntryImpl(const std::string& key) {
CACHE_UMA(AGE_MS, "CreateTime", 0, start);
stats_.OnEvent(Stats::CREATE_HIT);
- SIMPLE_STATS_COUNTER("disk_cache.miss");
Trace("create entry hit ");
FlushIndex();
cache_entry->AddRef();
diff --git a/net/disk_cache/blockfile/backend_impl_v3.cc b/net/disk_cache/blockfile/backend_impl_v3.cc
index 6d73d07..9615755 100644
--- a/net/disk_cache/blockfile/backend_impl_v3.cc
+++ b/net/disk_cache/blockfile/backend_impl_v3.cc
@@ -12,7 +12,6 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/rand_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 02f54a4..e16d7c6 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -14,7 +14,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/profiler/scoped_tracker.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
@@ -163,8 +162,6 @@ HttpNetworkTransaction::~HttpNetworkTransaction() {
int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info,
const CompletionCallback& callback,
const BoundNetLog& net_log) {
- SIMPLE_STATS_COUNTER("HttpNetworkTransaction.Count");
-
net_log_ = net_log;
request_ = request_info;
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 4052828..c3ecd0d 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -8,7 +8,6 @@
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
-#include "base/metrics/stats_counters.h"
#include "base/profiler/scoped_tracker.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
@@ -1244,7 +1243,6 @@ void ClientSocketPoolBaseHelper::Group::OnBackupJobTimerFired(
pool->connect_job_factory_->NewConnectJob(
group_name, *pending_requests_.FirstMax().value(), pool);
backup_job->net_log().AddEvent(NetLog::TYPE_BACKUP_CONNECT_JOB_CREATED);
- SIMPLE_STATS_COUNTER("socket.backup_created");
int rv = backup_job->Connect();
pool->connecting_socket_count_++;
ConnectJob* raw_backup_job = backup_job.get();
diff --git a/net/socket/tcp_socket_libevent.cc b/net/socket/tcp_socket_libevent.cc
index d7fa9fa..c5d30e1 100644
--- a/net/socket/tcp_socket_libevent.cc
+++ b/net/socket/tcp_socket_libevent.cc
@@ -9,9 +9,10 @@
#include <sys/socket.h>
#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/posix/eintr_wrapper.h"
#include "base/task_runner_util.h"
#include "base/threading/worker_pool.h"
@@ -538,9 +539,6 @@ int TCPSocketLibevent::HandleConnectCompleted(int rv) const {
}
void TCPSocketLibevent::LogConnectBegin(const AddressList& addresses) const {
- base::StatsCounter connects("tcp.connect");
- connects.Increment();
-
net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT,
addresses.CreateNetLogCallback());
}
@@ -597,9 +595,6 @@ int TCPSocketLibevent::HandleReadCompleted(IOBuffer* buf, int rv) {
CreateNetLogSocketErrorCallback(rv, errno));
return rv;
}
-
- base::StatsCounter read_bytes("tcp.read_bytes");
- read_bytes.Add(rv);
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, rv,
buf->data());
NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(rv);
@@ -631,9 +626,6 @@ int TCPSocketLibevent::HandleWriteCompleted(IOBuffer* buf, int rv) {
CreateNetLogSocketErrorCallback(rv, errno));
return rv;
}
-
- base::StatsCounter write_bytes("tcp.write_bytes");
- write_bytes.Add(rv);
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, rv,
buf->data());
NetworkActivityMonitor::GetInstance()->IncrementBytesSent(rv);
diff --git a/net/socket/tcp_socket_win.cc b/net/socket/tcp_socket_win.cc
index 538c8d7..d9ec0d5 100644
--- a/net/socket/tcp_socket_win.cc
+++ b/net/socket/tcp_socket_win.cc
@@ -9,7 +9,6 @@
#include "base/callback_helpers.h"
#include "base/logging.h"
-#include "base/metrics/stats_counters.h"
#include "base/profiler/scoped_tracker.h"
#include "base/win/windows_version.h"
#include "net/base/address_list.h"
@@ -524,9 +523,6 @@ int TCPSocketWin::Write(IOBuffer* buf,
DCHECK_GT(buf_len, 0);
DCHECK(!core_->write_iobuffer_.get());
- base::StatsCounter writes("tcp.writes");
- writes.Increment();
-
WSABUF write_buffer;
write_buffer.len = buf_len;
write_buffer.buf = buf->data();
@@ -546,8 +542,6 @@ int TCPSocketWin::Write(IOBuffer* buf,
<< " bytes, but " << rv << " bytes reported.";
return ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES;
}
- base::StatsCounter write_bytes("tcp.write_bytes");
- write_bytes.Add(rv);
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, rv,
buf->data());
NetworkActivityMonitor::GetInstance()->IncrementBytesSent(rv);
@@ -889,9 +883,6 @@ void TCPSocketWin::DoConnectComplete(int result) {
}
void TCPSocketWin::LogConnectBegin(const AddressList& addresses) {
- base::StatsCounter connects("tcp.connect");
- connects.Increment();
-
net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT,
addresses.CreateNetLogCallback());
}
@@ -942,9 +933,6 @@ int TCPSocketWin::DoRead(IOBuffer* buf, int buf_len,
return net_error;
}
} else {
- base::StatsCounter read_bytes("tcp.read_bytes");
- if (rv > 0)
- read_bytes.Add(rv);
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, rv,
buf->data());
NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(rv);
@@ -1030,8 +1018,6 @@ void TCPSocketWin::DidCompleteWrite() {
<< " bytes reported.";
rv = ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES;
} else {
- base::StatsCounter write_bytes("tcp.write_bytes");
- write_bytes.Add(num_bytes);
net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_SENT, num_bytes,
core_->write_iobuffer_->data());
NetworkActivityMonitor::GetInstance()->IncrementBytesSent(num_bytes);
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index a02cb2e..e7603ff 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -6,7 +6,6 @@
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
-#include "base/metrics/stats_counters.h"
#include "base/third_party/valgrind/memcheck.h"
#include "net/spdy/spdy_frame_builder.h"
#include "net/spdy/spdy_frame_reader.h"
@@ -3246,11 +3245,6 @@ void SpdyFramer::SerializeNameValueBlock(
LOG(DFATAL) << "Could not obtain compressor.";
return;
}
-
- base::StatsCounter compressed_frames("spdy.CompressedFrames");
- base::StatsCounter pre_compress_bytes("spdy.PreCompressSize");
- base::StatsCounter post_compress_bytes("spdy.PostCompressSize");
-
// Create an output frame.
// Since we'll be performing lots of flushes when compressing the data,
// zlib's lower bounds may be insufficient.
@@ -3287,11 +3281,6 @@ void SpdyFramer::SerializeNameValueBlock(
int compressed_size = compressed_max_size - compressor->avail_out;
builder->Seek(compressed_size);
builder->RewriteLength(*this);
-
- pre_compress_bytes.Add(uncompressed_len);
- post_compress_bytes.Add(compressed_size);
-
- compressed_frames.Increment();
}
} // namespace net
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index a3f8ff3..58e4af7 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -15,7 +15,6 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/profiler/scoped_tracker.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
@@ -718,9 +717,6 @@ void SpdySession::InitializeWithSocket(
// requires re-working CreateFakeSpdySession(), though.
DCHECK(connection->socket());
- base::StatsCounter spdy_sessions("spdy.sessions");
- spdy_sessions.Increment();
-
connection_ = connection.Pass();
is_secure_ = is_secure;
certificate_error_code_ = certificate_error_code;
@@ -1084,8 +1080,6 @@ scoped_ptr<SpdyFrame> SpdySession::CreateSynStream(
syn_frame.reset(buffered_spdy_framer_->SerializeFrame(headers));
}
- base::StatsCounter spdy_requests("spdy.requests");
- spdy_requests.Increment();
streams_initiated_count_++;
if (net_log().IsLogging()) {
@@ -1780,13 +1774,9 @@ void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it,
DCHECK_GT(it->first, 0u);
LogAbandonedStream(it->second.stream, status);
++streams_abandoned_count_;
- base::StatsCounter abandoned_streams("spdy.abandoned_streams");
- abandoned_streams.Increment();
if (it->second.stream->type() == SPDY_PUSH_STREAM &&
unclaimed_pushed_streams_.find(it->second.stream->url()) !=
unclaimed_pushed_streams_.end()) {
- base::StatsCounter abandoned_push_streams("spdy.abandoned_push_streams");
- abandoned_push_streams.Increment();
}
}
@@ -1974,8 +1964,6 @@ void SpdySession::DeleteStream(scoped_ptr<SpdyStream> stream, int status) {
}
base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) {
- base::StatsCounter used_push_streams("spdy.claimed_push_streams");
-
PushedStreamMap::iterator unclaimed_it = unclaimed_pushed_streams_.find(url);
if (unclaimed_it == unclaimed_pushed_streams_.end())
return base::WeakPtr<SpdyStream>();
@@ -1992,7 +1980,6 @@ base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) {
net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_ADOPTED_PUSH_STREAM,
base::Bind(&NetLogSpdyAdoptedPushStreamCallback,
active_it->second.stream->stream_id(), &url));
- used_push_streams.Increment();
return active_it->second.stream->GetWeakPtr();
}
@@ -2267,14 +2254,9 @@ void SpdySession::OnSynStream(SpdyStreamId stream_id,
return;
}
- if (OnInitialResponseHeadersReceived(response_headers,
- response_time,
- recv_first_byte_time,
- active_it->second.stream) != OK)
- return;
-
- base::StatsCounter push_requests("spdy.pushed_streams");
- push_requests.Increment();
+ OnInitialResponseHeadersReceived(response_headers, response_time,
+ recv_first_byte_time,
+ active_it->second.stream);
}
void SpdySession::DeleteExpiredPushedStreams() {
@@ -2770,9 +2752,6 @@ void SpdySession::OnPushPromise(SpdyStreamId stream_id,
// TODO(baranovich): pass parent stream id priority?
if (!TryCreatePushStream(promised_stream_id, stream_id, 0, headers))
return;
-
- base::StatsCounter push_requests("spdy.pushed_streams");
- push_requests.Increment();
}
void SpdySession::SendStreamWindowUpdate(SpdyStreamId stream_id,
diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc
index 8dd102a..a36c59b 100644
--- a/net/udp/udp_socket_libevent.cc
+++ b/net/udp/udp_socket_libevent.cc
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/sparse_histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/posix/eintr_wrapper.h"
#include "base/rand_util.h"
#include "net/base/io_buffer.h"
@@ -428,8 +427,6 @@ void UDPSocketLibevent::LogRead(int result,
is_address_valid ? &address : NULL));
}
- base::StatsCounter read_bytes("udp.read_bytes");
- read_bytes.Add(result);
NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(result);
}
@@ -460,8 +457,6 @@ void UDPSocketLibevent::LogWrite(int result,
CreateNetLogUDPDataTranferCallback(result, bytes, address));
}
- base::StatsCounter write_bytes("udp.write_bytes");
- write_bytes.Add(result);
NetworkActivityMonitor::GetInstance()->IncrementBytesSent(result);
}
diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc
index 90ce661..928de4a 100644
--- a/net/udp/udp_socket_win.cc
+++ b/net/udp/udp_socket_win.cc
@@ -13,7 +13,6 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
-#include "base/metrics/stats_counters.h"
#include "base/profiler/scoped_tracker.h"
#include "base/rand_util.h"
#include "net/base/io_buffer.h"
@@ -699,8 +698,6 @@ void UDPSocketWin::LogRead(int result,
CreateNetLogUDPDataTranferCallback(result, bytes, address));
}
- base::StatsCounter read_bytes("udp.read_bytes");
- read_bytes.Add(result);
NetworkActivityMonitor::GetInstance()->IncrementBytesReceived(result);
}
@@ -718,8 +715,6 @@ void UDPSocketWin::LogWrite(int result,
CreateNetLogUDPDataTranferCallback(result, bytes, address));
}
- base::StatsCounter write_bytes("udp.write_bytes");
- write_bytes.Add(result);
NetworkActivityMonitor::GetInstance()->IncrementBytesSent(result);
}
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index af06e35..8777c06 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -12,7 +12,6 @@
#include "base/lazy_instance.h"
#include "base/memory/singleton.h"
#include "base/message_loop/message_loop.h"
-#include "base/metrics/stats_counters.h"
#include "base/profiler/scoped_tracker.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -553,8 +552,6 @@ URLRequest::URLRequest(const GURL& url,
creation_time_(base::TimeTicks::Now()),
notified_before_network_start_(false),
cookie_store_(cookie_store ? cookie_store : context->cookie_store()) {
- SIMPLE_STATS_COUNTER("URLRequestCount");
-
// Sanity check out environment.
DCHECK(base::MessageLoop::current())
<< "The current base::MessageLoop must exist";