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

Unified Diff: base/threading/thread_perftest.cc

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Patch Set: REBASE after it passed CQ but did not commit to tree Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_loop/message_pump_perftest.cc ('k') | base/time/time.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_perftest.cc
diff --git a/base/threading/thread_perftest.cc b/base/threading/thread_perftest.cc
index 3bc9fb409ce7b3e4bbc42992f4cd5d0d732aceed..e865ffa90856490a5e3a837459e2c8fb6c24f3a8 100644
--- a/base/threading/thread_perftest.cc
+++ b/base/threading/thread_perftest.cc
@@ -48,14 +48,14 @@ class ThreadPerfTest : public testing::Test {
virtual void PingPong(int hops) = 0;
virtual void Reset() {}
- void TimeOnThread(base::TimeTicks* ticks, base::WaitableEvent* done) {
- *ticks = base::TimeTicks::ThreadNow();
+ void TimeOnThread(base::ThreadTicks* ticks, base::WaitableEvent* done) {
+ *ticks = base::ThreadTicks::Now();
done->Signal();
}
- base::TimeTicks ThreadNow(base::Thread* thread) {
+ base::ThreadTicks ThreadNow(base::Thread* thread) {
base::WaitableEvent done(false, false);
- base::TimeTicks ticks;
+ base::ThreadTicks ticks;
thread->task_runner()->PostTask(
FROM_HERE, base::Bind(&ThreadPerfTest::TimeOnThread,
base::Unretained(this), &ticks, &done));
@@ -65,11 +65,11 @@ class ThreadPerfTest : public testing::Test {
void RunPingPongTest(const std::string& name, unsigned num_threads) {
// Create threads and collect starting cpu-time for each thread.
- std::vector<base::TimeTicks> thread_starts;
+ std::vector<base::ThreadTicks> thread_starts;
while (threads_.size() < num_threads) {
threads_.push_back(new base::Thread("PingPonger"));
threads_.back()->Start();
- if (base::TimeTicks::IsThreadNowSupported())
+ if (base::ThreadTicks::IsSupported())
thread_starts.push_back(ThreadNow(threads_.back()));
}
@@ -84,7 +84,7 @@ class ThreadPerfTest : public testing::Test {
// but that should be in the noise given enough runs.
base::TimeDelta thread_time;
while (threads_.size()) {
- if (base::TimeTicks::IsThreadNowSupported()) {
+ if (base::ThreadTicks::IsSupported()) {
thread_time += ThreadNow(threads_.back()) - thread_starts.back();
thread_starts.pop_back();
}
@@ -102,7 +102,7 @@ class ThreadPerfTest : public testing::Test {
"task", "", name + "_time ", us_per_task_clock, "us/hop", true);
// Total utilization across threads if available (likely higher).
- if (base::TimeTicks::IsThreadNowSupported()) {
+ if (base::ThreadTicks::IsSupported()) {
perf_test::PrintResult(
"task", "", name + "_cpu ", us_per_task_cpu, "us/hop", true);
}
« no previous file with comments | « base/message_loop/message_pump_perftest.cc ('k') | base/time/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698