| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2016 The Chromium Authors. All rights reserved. | 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include "platform/Timer.h" | 6 #include "platform/Timer.h" |
| 7 | 7 |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| 11 #include "platform/wtf/PtrUtil.h" |
| 12 #include "platform/wtf/Vector.h" |
| 11 #include "public/platform/Platform.h" | 13 #include "public/platform/Platform.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "wtf/PtrUtil.h" | |
| 14 #include "wtf/Vector.h" | |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class TimerPerfTest : public ::testing::Test { | 18 class TimerPerfTest : public ::testing::Test { |
| 19 public: | 19 public: |
| 20 void nopTask(TimerBase*) {} | 20 void nopTask(TimerBase*) {} |
| 21 | 21 |
| 22 void recordStartRunTime(TimerBase*) { m_runStart = base::ThreadTicks::Now(); } | 22 void recordStartRunTime(TimerBase*) { m_runStart = base::ThreadTicks::Now(); } |
| 23 | 23 |
| 24 void recordEndRunTime(TimerBase*) { | 24 void recordEndRunTime(TimerBase*) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 double cancelTime = (cancelEnd - cancelStart).InMicroseconds(); | 96 double cancelTime = (cancelEnd - cancelStart).InMicroseconds(); |
| 97 double cancelTimeUsPerCall = cancelTime / static_cast<double>(numIterations); | 97 double cancelTimeUsPerCall = cancelTime / static_cast<double>(numIterations); |
| 98 LOG(INFO) << "TimerBase::stop cost (us/call) " << cancelTimeUsPerCall | 98 LOG(INFO) << "TimerBase::stop cost (us/call) " << cancelTimeUsPerCall |
| 99 << " (total " << cancelTime << " us)"; | 99 << " (total " << cancelTime << " us)"; |
| 100 LOG(INFO) << "Time to run " << numIterations << " canceled tasks (us) " | 100 LOG(INFO) << "Time to run " << numIterations << " canceled tasks (us) " |
| 101 << (m_runEnd - m_runStart).InMicroseconds(); | 101 << (m_runEnd - m_runStart).InMicroseconds(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |