Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: base/trace_event/trace_log.cc

Issue 1839503002: [tracing] Add native allocation tracing mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Increase Backtrace frames, request even more frames Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/trace_event/trace_event.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_enabled()) { 1322 if (AllocationContextTracker::capture_mode() ==
1323 AllocationContextTracker::CaptureMode::PSEUDO_STACK) {
1323 if (phase == TRACE_EVENT_PHASE_BEGIN || 1324 if (phase == TRACE_EVENT_PHASE_BEGIN ||
1324 phase == TRACE_EVENT_PHASE_COMPLETE) { 1325 phase == TRACE_EVENT_PHASE_COMPLETE) {
1325 AllocationContextTracker::GetInstanceForCurrentThread() 1326 AllocationContextTracker::GetInstanceForCurrentThread()
1326 ->PushPseudoStackFrame(name); 1327 ->PushPseudoStackFrame(name);
1327 } else if (phase == TRACE_EVENT_PHASE_END) 1328 } else if (phase == TRACE_EVENT_PHASE_END)
1328 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events 1329 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events
1329 // is in |TraceLog::UpdateTraceEventDuration|. 1330 // is in |TraceLog::UpdateTraceEventDuration|.
1330 AllocationContextTracker::GetInstanceForCurrentThread() 1331 AllocationContextTracker::GetInstanceForCurrentThread()
1331 ->PopPseudoStackFrame(name); 1332 ->PopPseudoStackFrame(name);
1332 } 1333 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 #if defined(OS_ANDROID) 1446 #if defined(OS_ANDROID)
1446 trace_event->SendToATrace(); 1447 trace_event->SendToATrace();
1447 #endif 1448 #endif
1448 } 1449 }
1449 1450
1450 if (trace_options() & kInternalEchoToConsole) { 1451 if (trace_options() & kInternalEchoToConsole) {
1451 console_message = 1452 console_message =
1452 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event); 1453 EventToConsoleMessage(TRACE_EVENT_PHASE_END, now, trace_event);
1453 } 1454 }
1454 1455
1455 if (base::trace_event::AllocationContextTracker::capture_enabled()) { 1456 if (AllocationContextTracker::capture_mode() ==
1457 AllocationContextTracker::CaptureMode::PSEUDO_STACK) {
1456 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|. 1458 // The corresponding push is in |AddTraceEventWithThreadIdAndTimestamp|.
1457 base::trace_event::AllocationContextTracker::GetInstanceForCurrentThread() 1459 AllocationContextTracker::GetInstanceForCurrentThread()
1458 ->PopPseudoStackFrame(name); 1460 ->PopPseudoStackFrame(name);
1459 } 1461 }
1460 } 1462 }
1461 1463
1462 if (console_message.size()) 1464 if (console_message.size())
1463 LOG(ERROR) << console_message; 1465 LOG(ERROR) << console_message;
1464 1466
1465 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) { 1467 if (category_group_enabled_local & ENABLED_FOR_EVENT_CALLBACK) {
1466 EventCallback event_callback = reinterpret_cast<EventCallback>( 1468 EventCallback event_callback = reinterpret_cast<EventCallback>(
1467 subtle::NoBarrier_Load(&event_callback_)); 1469 subtle::NoBarrier_Load(&event_callback_));
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 } 1744 }
1743 1745
1744 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 1746 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
1745 if (*category_group_enabled_) { 1747 if (*category_group_enabled_) {
1746 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, 1748 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_,
1747 event_handle_); 1749 event_handle_);
1748 } 1750 }
1749 } 1751 }
1750 1752
1751 } // namespace trace_event_internal 1753 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « base/trace_event/trace_event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698