| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
| 8 #include "base/pending_task.h" | 8 #include "base/pending_task.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 12 #include "base/trace_event/trace_event_argument.h" | 12 #include "base/trace_event/trace_event_argument.h" |
| 13 #include "perf_test_helpers.h" | 13 #include "perf_test_helpers.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "tracing_interface_simulator.h" |
| 15 | 16 |
| 16 namespace tracing { | 17 namespace tracing { |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 using base::Bind; | 20 using base::Bind; |
| 20 using base::Closure; | 21 using base::Closure; |
| 21 using base::RunLoop; | 22 using base::RunLoop; |
| 22 using base::Thread; | 23 using base::Thread; |
| 23 using base::Unretained; | 24 using base::Unretained; |
| 24 using base::WaitableEvent; | 25 using base::WaitableEvent; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 task_sw.NextLap(); | 181 task_sw.NextLap(); |
| 181 } | 182 } |
| 182 EndTraceAndFlush(); | 183 EndTraceAndFlush(); |
| 183 } | 184 } |
| 184 | 185 |
| 185 TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT0_with_tracing_disabled) { | 186 TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT0_with_tracing_disabled) { |
| 186 ScopedStopwatch stopwatch("events"); | 187 ScopedStopwatch stopwatch("events"); |
| 187 SubmitTraceEvents(10000); | 188 SubmitTraceEvents(10000); |
| 188 } | 189 } |
| 189 | 190 |
| 191 TEST_F(TraceEventPerfTest, Submit_50000_TRACE_EVENT_TEST_via_virtual_calls) { |
| 192 BeginTrace(); |
| 193 InitTracingInterface(); |
| 194 IterableStopwatch stopwatch("events"); |
| 195 for (int lap = 0; lap < kNumRuns; lap++) { |
| 196 for (int i = 0; i < 50000; i++) { |
| 197 TRACE_EVENT_VIRTUAL_TEST("test_category", "test call"); |
| 198 } |
| 199 stopwatch.NextLap(); |
| 200 } |
| 201 EndTraceAndFlush(); |
| 202 } |
| 203 |
| 204 TEST_F(TraceEventPerfTest, Submit_50000_TRACE_EVENT_TEST_via_direct_calls) { |
| 205 BeginTrace(); |
| 206 IterableStopwatch stopwatch("events"); |
| 207 for (int lap = 0; lap < kNumRuns; lap++) { |
| 208 for (int i = 0; i < 50000; i++) { |
| 209 TRACE_EVENT_DIRECT_TEST("test_category", "test call"); |
| 210 } |
| 211 stopwatch.NextLap(); |
| 212 } |
| 213 EndTraceAndFlush(); |
| 214 } |
| 215 |
| 190 } // namespace | 216 } // namespace |
| 191 } // namespace tracing | 217 } // namespace tracing |
| OLD | NEW |