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 <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_enabled()) { |
1320 if (phase == TRACE_EVENT_PHASE_BEGIN || | 1320 if (phase == TRACE_EVENT_PHASE_BEGIN || |
1321 phase == TRACE_EVENT_PHASE_COMPLETE) { | 1321 phase == TRACE_EVENT_PHASE_COMPLETE) |
1322 AllocationContextTracker::GetInstanceForCurrentThread() | 1322 AllocationContextTracker::PushPseudoStackFrame(name); |
1323 ->PushPseudoStackFrame(name); | 1323 else if (phase == TRACE_EVENT_PHASE_END) |
1324 } else if (phase == TRACE_EVENT_PHASE_END) | |
1325 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events | 1324 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events |
1326 // is in |TraceLog::UpdateTraceEventDuration|. | 1325 // is in |TraceLog::UpdateTraceEventDuration|. |
1327 AllocationContextTracker::GetInstanceForCurrentThread() | 1326 AllocationContextTracker::PopPseudoStackFrame(name); |
1328 ->PopPseudoStackFrame(name); | |
1329 } | 1327 } |
1330 } | 1328 } |
1331 | 1329 |
1332 return handle; | 1330 return handle; |
1333 } | 1331 } |
1334 | 1332 |
1335 void TraceLog::AddMetadataEvent( | 1333 void TraceLog::AddMetadataEvent( |
1336 const unsigned char* category_group_enabled, | 1334 const unsigned char* category_group_enabled, |
1337 const char* name, | 1335 const char* name, |
1338 int num_args, | 1336 int num_args, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 #endif | 1440 #endif |
1443 } | 1441 } |
1444 | 1442 |
1445 if (trace_options() & kInternalEchoToConsole) { | 1443 if (trace_options() & kInternalEchoToConsole) { |
1446 console_message = | 1444 console_message = |
1447 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event); | 1445 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event); |
1448 } | 1446 } |
1449 | 1447 |
1450 if (base::trace_event::AllocationContextTracker::capture_enabled()) { | 1448 if (base::trace_event::AllocationContextTracker::capture_enabled()) { |
1451 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|. | 1449 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|. |
1452 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() | 1450 base::trace_event::AllocationContextTracker::PopPseudoStackFrame(name); |
1453 ->PopPseudoStackFrame(name); | |
1454 } | 1451 } |
1455 } | 1452 } |
1456 | 1453 |
1457 if (console_message.size()) | 1454 if (console_message.size()) |
1458 LOG(ERROR) << console_message; | 1455 LOG(ERROR) << console_message; |
1459 | 1456 |
1460 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) { | 1457 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) { |
1461 EventCallback event_callback = reinterpret_cast<EventCallback>( | 1458 EventCallback event_callback = reinterpret_cast<EventCallback>( |
1462 subtle::NoBarrier_Load(&event_callback_)); | 1459 subtle::NoBarrier_Load(&event_callback_)); |
1463 if (event_callback) { | 1460 if (event_callback) { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 } | 1733 } |
1737 | 1734 |
1738 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1735 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
1739 if (*category_group_enabled_) { | 1736 if (*category_group_enabled_) { |
1740 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1737 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
1741 event_handle_); | 1738 event_handle_); |
1742 } | 1739 } |
1743 } | 1740 } |
1744 | 1741 |
1745 } // namespace trace_event_internal | 1742 } // namespace trace_event_internal |
OLD | NEW |