| 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/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
| 12 #include "perf_test_helpers.h" | 12 #include "perf_test_helpers.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "tracing_interface_simulator.h" |
| 14 | 15 |
| 15 namespace tracing { | 16 namespace tracing { |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 using base::Bind; | 19 using base::Bind; |
| 19 using base::Thread; | 20 using base::Thread; |
| 20 using base::Unretained; | 21 using base::Unretained; |
| 21 using base::WaitableEvent; | 22 using base::WaitableEvent; |
| 22 using base::trace_event::TraceConfig; | 23 using base::trace_event::TraceConfig; |
| 23 using base::trace_event::TraceLog; | 24 using base::trace_event::TraceLog; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 complete_events[i]->Wait(); | 159 complete_events[i]->Wait(); |
| 159 } | 160 } |
| 160 } | 161 } |
| 161 | 162 |
| 162 EndTraceAndFlush(); | 163 EndTraceAndFlush(); |
| 163 for (int i = 0; i < kNumThreads; i++) { | 164 for (int i = 0; i < kNumThreads; i++) { |
| 164 threads[i]->Stop(); | 165 threads[i]->Stop(); |
| 165 } | 166 } |
| 166 } | 167 } |
| 167 | 168 |
| 169 TEST_F(TraceEventPerfTest, Submit_50000_TRACE_EVENT_TEST_via_virtual_calls) { |
| 170 BeginTrace(); |
| 171 InitTracingInterface(); |
| 172 IterableStopwatch stopwatch("events"); |
| 173 for (int lap = 0; lap < kNumRuns; lap++) { |
| 174 for (int i = 0; i < 50000; i++) { |
| 175 TRACE_EVENT_VIRTUAL_TEST("test_category", "test call"); |
| 176 } |
| 177 stopwatch.NextLap(); |
| 178 } |
| 179 EndTraceAndFlush(); |
| 180 } |
| 181 |
| 182 TEST_F(TraceEventPerfTest, Submit_50000_TRACE_EVENT_TEST_via_direct_calls) { |
| 183 BeginTrace(); |
| 184 IterableStopwatch stopwatch("events"); |
| 185 for (int lap = 0; lap < kNumRuns; lap++) { |
| 186 for (int i = 0; i < 50000; i++) { |
| 187 TRACE_EVENT_DIRECT_TEST("test_category", "test call"); |
| 188 } |
| 189 stopwatch.NextLap(); |
| 190 } |
| 191 EndTraceAndFlush(); |
| 192 } |
| 193 |
| 168 } // namespace | 194 } // namespace |
| 169 } // namespace tracing | 195 } // namespace tracing |
| OLD | NEW |