| 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" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 TEST_F(TraceEventPerfTest, Create_10000_TracedValue) { | 114 TEST_F(TraceEventPerfTest, Create_10000_TracedValue) { |
| 115 std::unique_ptr<TracedValue> value; | 115 std::unique_ptr<TracedValue> value; |
| 116 { | 116 { |
| 117 ScopedStopwatch value_sw("create_traced_values"); | 117 ScopedStopwatch value_sw("create_traced_values"); |
| 118 for (int i = 0; i < 10000; i++) { | 118 for (int i = 0; i < 10000; i++) { |
| 119 value = MakeTracedValue(i); | 119 value = MakeTracedValue(i); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 TEST_F(TraceEventPerfTest, Create_10M_TracedValue) { |
| 125 std::unique_ptr<TracedValue> value; |
| 126 { |
| 127 ScopedStopwatch value_sw("create_traced_values"); |
| 128 for (int i = 0; i < 10000000; i++) { |
| 129 value = MakeTracedValue(i); |
| 130 } |
| 131 } |
| 132 } |
| 133 |
| 124 TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT_with_TracedValue) { | 134 TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT_with_TracedValue) { |
| 125 BeginTrace(); | 135 BeginTrace(); |
| 126 // Time reported by this timer includes TracedValue creation as well. | 136 // Time reported by this timer includes TracedValue creation as well. |
| 127 IterableStopwatch trace_sw("events_with_value"); | 137 IterableStopwatch trace_sw("events_with_value"); |
| 128 for (int lap = 0; lap < kNumRuns; lap++) { | 138 for (int lap = 0; lap < kNumRuns; lap++) { |
| 129 for (int i = 0; i < 10000; i++) { | 139 for (int i = 0; i < 10000; i++) { |
| 130 TRACE_EVENT_INSTANT1("test_category", "event_with_value", | 140 TRACE_EVENT_INSTANT1("test_category", "event_with_value", |
| 131 TRACE_EVENT_SCOPE_THREAD, "value", MakeTracedValue(i)); | 141 TRACE_EVENT_SCOPE_THREAD, "value", MakeTracedValue(i)); |
| 132 } | 142 } |
| 133 trace_sw.NextLap(); | 143 trace_sw.NextLap(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 EndTraceAndFlush(); | 192 EndTraceAndFlush(); |
| 183 } | 193 } |
| 184 | 194 |
| 185 TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT0_with_tracing_disabled) { | 195 TEST_F(TraceEventPerfTest, Submit_10000_TRACE_EVENT0_with_tracing_disabled) { |
| 186 ScopedStopwatch stopwatch("events"); | 196 ScopedStopwatch stopwatch("events"); |
| 187 SubmitTraceEvents(10000); | 197 SubmitTraceEvents(10000); |
| 188 } | 198 } |
| 189 | 199 |
| 190 } // namespace | 200 } // namespace |
| 191 } // namespace tracing | 201 } // namespace tracing |
| OLD | NEW |