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

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

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

Powered by Google App Engine
This is Rietveld 408576698