OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/trace_event/trace_log.h" | 5 #include "base/trace_event/trace_log.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 event_callback( | 1312 event_callback( |
1313 offset_event_timestamp, | 1313 offset_event_timestamp, |
1314 phase == TRACE_EVENT_PHASE_COMPLETE ? TRACE_EVENT_PHASE_BEGIN : phase, | 1314 phase == TRACE_EVENT_PHASE_COMPLETE ? TRACE_EVENT_PHASE_BEGIN : phase, |
1315 category_group_enabled, name, scope, id, num_args, arg_names, | 1315 category_group_enabled, name, scope, id, num_args, arg_names, |
1316 arg_types, arg_values, flags); | 1316 arg_types, arg_values, flags); |
1317 } | 1317 } |
1318 } | 1318 } |
1319 | 1319 |
1320 // TODO(primiano): Add support for events with copied name crbug.com/581078 | 1320 // TODO(primiano): Add support for events with copied name crbug.com/581078 |
1321 if (!(flags & TRACE_EVENT_FLAG_COPY)) { | 1321 if (!(flags & TRACE_EVENT_FLAG_COPY)) { |
1322 if (AllocationContextTracker::capture_mode() == | 1322 if (AllocationContextTracker::capture_enabled()) { |
1323 AllocationContextTracker::CaptureMode::PSEUDO_STACK) { | |
1324 if (phase == TRACE_EVENT_PHASE_BEGIN || | 1323 if (phase == TRACE_EVENT_PHASE_BEGIN || |
1325 phase == TRACE_EVENT_PHASE_COMPLETE) { | 1324 phase == TRACE_EVENT_PHASE_COMPLETE) { |
1326 AllocationContextTracker::GetInstanceForCurrentThread() | 1325 AllocationContextTracker::GetInstanceForCurrentThread() |
1327 ->PushPseudoStackFrame(name); | 1326 ->PushPseudoStackFrame(name); |
1328 } else if (phase == TRACE_EVENT_PHASE_END) | 1327 } else if (phase == TRACE_EVENT_PHASE_END) |
1329 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events | 1328 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events |
1330 // is in |TraceLog::UpdateTraceEventDuration|. | 1329 // is in |TraceLog::UpdateTraceEventDuration|. |
1331 AllocationContextTracker::GetInstanceForCurrentThread() | 1330 AllocationContextTracker::GetInstanceForCurrentThread() |
1332 ->PopPseudoStackFrame(name); | 1331 ->PopPseudoStackFrame(name); |
1333 } | 1332 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 #if defined(OS_ANDROID) | 1445 #if defined(OS_ANDROID) |
1447 trace_event->SendToATrace(); | 1446 trace_event->SendToATrace(); |
1448 #endif | 1447 #endif |
1449 } | 1448 } |
1450 | 1449 |
1451 if (trace_options() & kInternalEchoToConsole) { | 1450 if (trace_options() & kInternalEchoToConsole) { |
1452 console_message = | 1451 console_message = |
1453 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event); | 1452 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event); |
1454 } | 1453 } |
1455 | 1454 |
1456 if (AllocationContextTracker::capture_mode() == | 1455 if (base::trace_event::AllocationContextTracker::capture_enabled()) { |
1457 AllocationContextTracker::CaptureMode::PSEUDO_STACK) { | |
1458 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|. | 1456 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|. |
1459 AllocationContextTracker::GetInstanceForCurrentThread() | 1457 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() |
1460 ->PopPseudoStackFrame(name); | 1458 ->PopPseudoStackFrame(name); |
1461 } | 1459 } |
1462 } | 1460 } |
1463 | 1461 |
1464 if (console_message.size()) | 1462 if (console_message.size()) |
1465 LOG(ERROR) << console_message; | 1463 LOG(ERROR) << console_message; |
1466 | 1464 |
1467 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) { | 1465 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) { |
1468 EventCallback event_callback = reinterpret_cast<EventCallback>( | 1466 EventCallback event_callback = reinterpret_cast<EventCallback>( |
1469 subtle::NoBarrier_Load(&event_callback_)); | 1467 subtle::NoBarrier_Load(&event_callback_)); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 } | 1742 } |
1745 | 1743 |
1746 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1744 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
1747 if (*category_group_enabled_) { | 1745 if (*category_group_enabled_) { |
1748 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1746 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
1749 event_handle_); | 1747 event_handle_); |
1750 } | 1748 } |
1751 } | 1749 } |
1752 | 1750 |
1753 } // namespace trace_event_internal | 1751 } // namespace trace_event_internal |
OLD | NEW |