| 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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 event_callback( | 1309 event_callback( |
| 1310 offset_event_timestamp, | 1310 offset_event_timestamp, |
| 1311 phase == TRACE_EVENT_PHASE_COMPLETE ? TRACE_EVENT_PHASE_BEGIN : phase, | 1311 phase == TRACE_EVENT_PHASE_COMPLETE ? TRACE_EVENT_PHASE_BEGIN : phase, |
| 1312 category_group_enabled, name, scope, id, num_args, arg_names, | 1312 category_group_enabled, name, scope, id, num_args, arg_names, |
| 1313 arg_types, arg_values, flags); | 1313 arg_types, arg_values, flags); |
| 1314 } | 1314 } |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 // TODO(primiano): Add support for events with copied name crbug.com/581078 | 1317 // TODO(primiano): Add support for events with copied name crbug.com/581078 |
| 1318 if (!(flags & TRACE_EVENT_FLAG_COPY)) { | 1318 if (!(flags & TRACE_EVENT_FLAG_COPY)) { |
| 1319 if (AllocationContextTracker::capture_enabled()) { | 1319 if (AllocationContextTracker::capture_mode() == |
| 1320 AllocationContextTracker::CaptureMode::PSEUDO_STACK) { |
| 1320 if (phase == TRACE_EVENT_PHASE_BEGIN || | 1321 if (phase == TRACE_EVENT_PHASE_BEGIN || |
| 1321 phase == TRACE_EVENT_PHASE_COMPLETE) { | 1322 phase == TRACE_EVENT_PHASE_COMPLETE) { |
| 1322 AllocationContextTracker::GetInstanceForCurrentThread() | 1323 AllocationContextTracker::GetInstanceForCurrentThread() |
| 1323 ->PushPseudoStackFrame(name); | 1324 ->PushPseudoStackFrame(name); |
| 1324 } else if (phase == TRACE_EVENT_PHASE_END) | 1325 } else if (phase == TRACE_EVENT_PHASE_END) |
| 1325 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events | 1326 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events |
| 1326 // is in |TraceLog::UpdateTraceEventDuration|. | 1327 // is in |TraceLog::UpdateTraceEventDuration|. |
| 1327 AllocationContextTracker::GetInstanceForCurrentThread() | 1328 AllocationContextTracker::GetInstanceForCurrentThread() |
| 1328 ->PopPseudoStackFrame(name); | 1329 ->PopPseudoStackFrame(name); |
| 1329 } | 1330 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 #if defined(OS_ANDROID) | 1441 #if defined(OS_ANDROID) |
| 1441 trace_event->SendToATrace(); | 1442 trace_event->SendToATrace(); |
| 1442 #endif | 1443 #endif |
| 1443 } | 1444 } |
| 1444 | 1445 |
| 1445 if (trace_options() & kInternalEchoToConsole) { | 1446 if (trace_options() & kInternalEchoToConsole) { |
| 1446 console_message = | 1447 console_message = |
| 1447 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event); | 1448 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event); |
| 1448 } | 1449 } |
| 1449 | 1450 |
| 1450 if (base::trace_event::AllocationContextTracker::capture_enabled()) { | 1451 if (AllocationContextTracker::capture_mode() == |
| 1452 AllocationContextTracker::CaptureMode::PSEUDO_STACK) { |
| 1451 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|. | 1453 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|. |
| 1452 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() | 1454 AllocationContextTracker::GetInstanceForCurrentThread() |
| 1453 ->PopPseudoStackFrame(name); | 1455 ->PopPseudoStackFrame(name); |
| 1454 } | 1456 } |
| 1455 } | 1457 } |
| 1456 | 1458 |
| 1457 if (console_message.size()) | 1459 if (console_message.size()) |
| 1458 LOG(ERROR) << console_message; | 1460 LOG(ERROR) << console_message; |
| 1459 | 1461 |
| 1460 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) { | 1462 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) { |
| 1461 EventCallback event_callback = reinterpret_cast<EventCallback>( | 1463 EventCallback event_callback = reinterpret_cast<EventCallback>( |
| 1462 subtle::NoBarrier_Load(&event_callback_)); | 1464 subtle::NoBarrier_Load(&event_callback_)); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 } | 1738 } |
| 1737 | 1739 |
| 1738 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1740 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 1739 if (*category_group_enabled_) { | 1741 if (*category_group_enabled_) { |
| 1740 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1742 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
| 1741 event_handle_); | 1743 event_handle_); |
| 1742 } | 1744 } |
| 1743 } | 1745 } |
| 1744 | 1746 |
| 1745 } // namespace trace_event_internal | 1747 } // namespace trace_event_internal |
| OLD | NEW |