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

Side by Side Diff: base/threading/thread_perftest.cc

Issue 864943002: Replaces instances of the deprecated TimeTicks::HighResNow() with TimeTicks::Now(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More changes based on review comments. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/test/trace_event_analyzer_unittest.cc ('k') | base/time/tick_clock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/base_switches.h" 5 #include "base/base_switches.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/synchronization/condition_variable.h" 10 #include "base/synchronization/condition_variable.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 std::vector<base::TimeTicks> thread_starts; 69 std::vector<base::TimeTicks> thread_starts;
70 while (threads_.size() < num_threads) { 70 while (threads_.size() < num_threads) {
71 threads_.push_back(new base::Thread("PingPonger")); 71 threads_.push_back(new base::Thread("PingPonger"));
72 threads_.back()->Start(); 72 threads_.back()->Start();
73 if (base::TimeTicks::IsThreadNowSupported()) 73 if (base::TimeTicks::IsThreadNowSupported())
74 thread_starts.push_back(ThreadNow(threads_.back())); 74 thread_starts.push_back(ThreadNow(threads_.back()));
75 } 75 }
76 76
77 Init(); 77 Init();
78 78
79 base::TimeTicks start = base::TimeTicks::HighResNow(); 79 base::TimeTicks start = base::TimeTicks::Now();
80 PingPong(kNumRuns); 80 PingPong(kNumRuns);
81 done_.Wait(); 81 done_.Wait();
82 base::TimeTicks end = base::TimeTicks::HighResNow(); 82 base::TimeTicks end = base::TimeTicks::Now();
83 83
84 // Gather the cpu-time spent on each thread. This does one extra tasks, 84 // Gather the cpu-time spent on each thread. This does one extra tasks,
85 // but that should be in the noise given enough runs. 85 // but that should be in the noise given enough runs.
86 base::TimeDelta thread_time; 86 base::TimeDelta thread_time;
87 while (threads_.size()) { 87 while (threads_.size()) {
88 if (base::TimeTicks::IsThreadNowSupported()) { 88 if (base::TimeTicks::IsThreadNowSupported()) {
89 thread_time += ThreadNow(threads_.back()) - thread_starts.back(); 89 thread_time += ThreadNow(threads_.back()) - thread_starts.back();
90 thread_starts.pop_back(); 90 thread_starts.pop_back();
91 } 91 }
92 threads_.pop_back(); 92 threads_.pop_back();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 typedef EventPerfTest<PthreadEvent> PthreadEventPerfTest; 303 typedef EventPerfTest<PthreadEvent> PthreadEventPerfTest;
304 TEST_F(PthreadEventPerfTest, EventPingPong) { 304 TEST_F(PthreadEventPerfTest, EventPingPong) {
305 RunPingPongTest("4_PthreadCondVar_Threads", 4); 305 RunPingPongTest("4_PthreadCondVar_Threads", 4);
306 } 306 }
307 307
308 #endif 308 #endif
309 309
310 } // namespace 310 } // namespace
311 311
312 } // namespace base 312 } // namespace base
OLDNEW
« no previous file with comments | « base/test/trace_event_analyzer_unittest.cc ('k') | base/time/tick_clock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698