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

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

Issue 10004001: Add virtual and OVERRIDE to base/ implementation files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/message_pump_libevent_unittest.cc ('k') | base/observer_list_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/metrics/stats_counters.h" 5 #include "base/metrics/stats_counters.h"
6 #include "base/metrics/stats_table.h" 6 #include "base/metrics/stats_table.h"
7 #include "base/shared_memory.h" 7 #include "base/shared_memory.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/string_piece.h" 9 #include "base/string_piece.h"
10 #include "base/test/multiprocess_test.h" 10 #include "base/test/multiprocess_test.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // decremented by even threads. 70 // decremented by even threads.
71 const std::string kCounterMixed = "CounterMixed"; 71 const std::string kCounterMixed = "CounterMixed";
72 // The number of thread loops that we will do. 72 // The number of thread loops that we will do.
73 const int kThreadLoops = 100; 73 const int kThreadLoops = 100;
74 74
75 class StatsTableThread : public SimpleThread { 75 class StatsTableThread : public SimpleThread {
76 public: 76 public:
77 StatsTableThread(std::string name, int id) 77 StatsTableThread(std::string name, int id)
78 : SimpleThread(name), 78 : SimpleThread(name),
79 id_(id) {} 79 id_(id) {}
80 virtual void Run(); 80 virtual ~StatsTableThread() {}
Nico 2012/04/05 17:52:34 Why is this needed?
Ryan Sleevi 2012/04/05 19:12:07 D'oh! It isn't. This crept in when I was using an
81
82 virtual void Run() OVERRIDE;
83
81 private: 84 private:
82 int id_; 85 int id_;
83 }; 86 };
84 87
85 void StatsTableThread::Run() { 88 void StatsTableThread::Run() {
86 // Each thread will open the shared memory and set counters 89 // Each thread will open the shared memory and set counters
87 // concurrently in a loop. We'll use some pauses to 90 // concurrently in a loop. We'll use some pauses to
88 // mixup the thread scheduling. 91 // mixup the thread scheduling.
89 92
90 StatsCounter zero_counter(kCounterZero); 93 StatsCounter zero_counter(kCounterZero);
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 PlatformThread::Sleep(kDuration); 410 PlatformThread::Sleep(kDuration);
408 } 411 }
409 EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:foo")); 412 EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:foo"));
410 EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:bar")); 413 EXPECT_LE(kDuration.InMilliseconds() * 2, table.GetCounterValue("t:bar"));
411 EXPECT_EQ(2, table.GetCounterValue("c:bar")); 414 EXPECT_EQ(2, table.GetCounterValue("c:bar"));
412 415
413 DeleteShmem(kTableName); 416 DeleteShmem(kTableName);
414 } 417 }
415 418
416 } // namespace base 419 } // namespace base
OLDNEW
« no previous file with comments | « base/message_pump_libevent_unittest.cc ('k') | base/observer_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698