OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/time/time.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "testing/perf/perf_test.h" |
| 8 |
| 9 namespace { |
| 10 base::TimeDelta EmptyActivity() { |
| 11 base::Time regular_start = base::Time::Now(); |
| 12 base::ThreadTicks thread_start; |
| 13 if (base::ThreadTicks::IsSupported()) |
| 14 thread_start = base::ThreadTicks::Now(); |
| 15 |
| 16 LOG(INFO) << "Activly do nothing"; |
| 17 |
| 18 if (base::ThreadTicks::IsSupported()) |
| 19 return base::ThreadTicks::Now() - thread_start; |
| 20 |
| 21 return base::Time::Now() - regular_start; |
| 22 } |
| 23 |
| 24 } // namespace |
| 25 |
| 26 TEST(BlankPerfTest, BlankActivity) { |
| 27 auto test_info = ::testing::UnitTest::GetInstance()->current_test_info(); |
| 28 |
| 29 const std::size_t kRepeatCount = 10; |
| 30 |
| 31 std::string durations; |
| 32 for (std::size_t i = 0; i < kRepeatCount; ++i) |
| 33 durations += std::to_string(EmptyActivity().InMicroseconds()) + ','; |
| 34 |
| 35 perf_test::PrintResultList(test_info->test_case_name(), test_info->name(), |
| 36 "trace", durations, "ms", true); |
| 37 } |
OLD | NEW |