OLD | NEW |
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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/format_macros.h" | 6 #include "base/format_macros.h" |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/synchronization/condition_variable.h" | 9 #include "base/synchronization/condition_variable.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 base::TimeTicks start = base::TimeTicks::HighResNow(); | 32 base::TimeTicks start = base::TimeTicks::HighResNow(); |
33 base::TimeTicks thread_start; | 33 base::TimeTicks thread_start; |
34 if (TimeTicks::IsThreadNowSupported()) | 34 if (TimeTicks::IsThreadNowSupported()) |
35 thread_start = base::TimeTicks::ThreadNow(); | 35 thread_start = base::TimeTicks::ThreadNow(); |
36 base::TimeDelta minimum = base::TimeDelta::Max(); | 36 base::TimeDelta minimum = base::TimeDelta::Max(); |
37 base::TimeDelta maximum = base::TimeDelta(); | 37 base::TimeDelta maximum = base::TimeDelta(); |
38 base::TimeTicks now, lastnow = start; | 38 base::TimeTicks now, lastnow = start; |
39 uint64_t schedule_calls = 0u; | 39 uint64_t schedule_calls = 0u; |
40 do { | 40 do { |
41 for (size_t i = 0; i < kBatchSize; ++i) { | 41 for (size_t i = 0; i < kBatchSize; ++i) { |
42 target_message_loop()->ScheduleWork(true); | 42 target_message_loop()->ScheduleWork(); |
43 schedule_calls++; | 43 schedule_calls++; |
44 } | 44 } |
45 now = base::TimeTicks::HighResNow(); | 45 now = base::TimeTicks::HighResNow(); |
46 base::TimeDelta laptime = now - lastnow; | 46 base::TimeDelta laptime = now - lastnow; |
47 lastnow = now; | 47 lastnow = now; |
48 minimum = std::min(minimum, laptime); | 48 minimum = std::min(minimum, laptime); |
49 maximum = std::max(maximum, laptime); | 49 maximum = std::max(maximum, laptime); |
50 } while (now - start < base::TimeDelta::FromSeconds(kTargetTimeSec)); | 50 } while (now - start < base::TimeDelta::FromSeconds(kTargetTimeSec)); |
51 | 51 |
52 scheduling_times_[index] = now - start; | 52 scheduling_times_[index] = now - start; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 TEST_F(PostTaskTest, TenTasksPerReload) { | 284 TEST_F(PostTaskTest, TenTasksPerReload) { |
285 Run(10000, 10); | 285 Run(10000, 10); |
286 } | 286 } |
287 | 287 |
288 TEST_F(PostTaskTest, OneHundredTasksPerReload) { | 288 TEST_F(PostTaskTest, OneHundredTasksPerReload) { |
289 Run(1000, 100); | 289 Run(1000, 100); |
290 } | 290 } |
291 | 291 |
292 } // namespace | 292 } // namespace |
293 } // namespace base | 293 } // namespace base |
OLD | NEW |