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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events | 1323 // The pop for |TRACE_EVENT_PHASE_COMPLETE| events |
1324 // is in |TraceLog::UpdateTraceEventDuration|. | 1324 // is in |TraceLog::UpdateTraceEventDuration|. |
1325 AllocationContextTracker::PopPseudoStackFrame(name); | 1325 AllocationContextTracker::PopPseudoStackFrame(name); |
1326 } | 1326 } |
1327 } | 1327 } |
1328 | 1328 |
1329 return handle; | 1329 return handle; |
1330 } | 1330 } |
1331 | 1331 |
1332 void TraceLog::AddMetadataEvent( | 1332 void TraceLog::AddMetadataEvent( |
| 1333 const unsigned char* category_group_enabled, |
1333 const char* name, | 1334 const char* name, |
1334 int num_args, | 1335 int num_args, |
1335 const char** arg_names, | 1336 const char** arg_names, |
1336 const unsigned char* arg_types, | 1337 const unsigned char* arg_types, |
1337 const unsigned long long* arg_values, | 1338 const unsigned long long* arg_values, |
1338 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1339 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
1339 unsigned int flags) { | 1340 unsigned int flags) { |
1340 scoped_ptr<TraceEvent> trace_event(new TraceEvent); | 1341 scoped_ptr<TraceEvent> trace_event(new TraceEvent); |
| 1342 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1343 ThreadTicks thread_now = ThreadNow(); |
| 1344 TimeTicks now = OffsetNow(); |
1341 AutoLock lock(lock_); | 1345 AutoLock lock(lock_); |
1342 trace_event->Initialize( | 1346 trace_event->Initialize( |
1343 0, // thread_id | 1347 thread_id, now, thread_now, TRACE_EVENT_PHASE_METADATA, |
1344 TimeTicks(), ThreadTicks(), TRACE_EVENT_PHASE_METADATA, | 1348 category_group_enabled, name, |
1345 &g_category_group_enabled[g_category_metadata], name, | |
1346 trace_event_internal::kGlobalScope, // scope | 1349 trace_event_internal::kGlobalScope, // scope |
1347 trace_event_internal::kNoId, // id | 1350 trace_event_internal::kNoId, // id |
1348 trace_event_internal::kNoId, // bind_id | 1351 trace_event_internal::kNoId, // bind_id |
1349 num_args, arg_names, arg_types, arg_values, convertable_values, flags); | 1352 num_args, arg_names, arg_types, arg_values, convertable_values, flags); |
1350 metadata_events_.push_back(std::move(trace_event)); | 1353 metadata_events_.push_back(std::move(trace_event)); |
1351 } | 1354 } |
1352 | 1355 |
1353 // May be called when a COMPELETE event ends and the unfinished event has been | 1356 // May be called when a COMPELETE event ends and the unfinished event has been |
1354 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). | 1357 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). |
1355 std::string TraceLog::EventToConsoleMessage(unsigned char phase, | 1358 std::string TraceLog::EventToConsoleMessage(unsigned char phase, |
1356 const TimeTicks& timestamp, | 1359 const TimeTicks& timestamp, |
1357 TraceEvent* trace_event) { | 1360 TraceEvent* trace_event) { |
1358 AutoLock thread_info_lock(thread_info_lock_); | 1361 AutoLock thread_info_lock(thread_info_lock_); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 } | 1729 } |
1727 | 1730 |
1728 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1731 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
1729 if (*category_group_enabled_) { | 1732 if (*category_group_enabled_) { |
1730 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1733 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
1731 event_handle_); | 1734 event_handle_); |
1732 } | 1735 } |
1733 } | 1736 } |
1734 | 1737 |
1735 } // namespace trace_event_internal | 1738 } // namespace trace_event_internal |
OLD | NEW |