Chromium Code Reviews| 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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 int num_args, | 1334 int num_args, |
| 1335 const char** arg_names, | 1335 const char** arg_names, |
| 1336 const unsigned char* arg_types, | 1336 const unsigned char* arg_types, |
| 1337 const unsigned long long* arg_values, | 1337 const unsigned long long* arg_values, |
| 1338 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | 1338 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, |
| 1339 unsigned int flags) { | 1339 unsigned int flags) { |
| 1340 scoped_ptr<TraceEvent> trace_event(new TraceEvent); | 1340 scoped_ptr<TraceEvent> trace_event(new TraceEvent); |
| 1341 AutoLock lock(lock_); | 1341 AutoLock lock(lock_); |
| 1342 trace_event->Initialize( | 1342 trace_event->Initialize( |
| 1343 0, // thread_id | 1343 0, // thread_id |
| 1344 TimeTicks(), ThreadTicks(), TRACE_EVENT_PHASE_METADATA, | 1344 TimeTicks(), ThreadTicks(), TRACE_EVENT_PHASE_METADATA, |
|
fmeawad
2016/02/16 21:47:37
I think you should call the other method here to r
alph
2016/02/16 23:19:28
They were quite distinct... But anyway one of them
| |
| 1345 &g_category_group_enabled[g_category_metadata], name, | 1345 &g_category_group_enabled[g_category_metadata], name, |
| 1346 trace_event_internal::kGlobalScope, // scope | 1346 trace_event_internal::kGlobalScope, // scope |
| 1347 trace_event_internal::kNoId, // id | 1347 trace_event_internal::kNoId, // id |
| 1348 trace_event_internal::kNoId, // bind_id | 1348 trace_event_internal::kNoId, // bind_id |
| 1349 num_args, arg_names, arg_types, arg_values, convertable_values, flags); | 1349 num_args, arg_names, arg_types, arg_values, convertable_values, flags); |
| 1350 metadata_events_.push_back(std::move(trace_event)); | 1350 metadata_events_.push_back(std::move(trace_event)); |
| 1351 } | 1351 } |
| 1352 | |
| 1353 void TraceLog::AddMetadataEvent( | |
| 1354 const unsigned char* category_group_enabled, | |
| 1355 const char* name, | |
| 1356 int num_args, | |
| 1357 const char** arg_names, | |
| 1358 const unsigned char* arg_types, | |
| 1359 const unsigned long long* arg_values, | |
| 1360 const scoped_refptr<ConvertableToTraceFormat>* convertable_values, | |
| 1361 unsigned int flags) { | |
| 1362 scoped_ptr<TraceEvent> trace_event(new TraceEvent); | |
| 1363 int thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | |
| 1364 ThreadTicks thread_now = ThreadNow(); | |
| 1365 TimeTicks now = OffsetNow(); | |
| 1366 AutoLock lock(lock_); | |
| 1367 trace_event->Initialize( | |
| 1368 thread_id, now, thread_now, TRACE_EVENT_PHASE_METADATA, | |
| 1369 category_group_enabled, name, | |
| 1370 trace_event_internal::kGlobalScope, // scope | |
| 1371 trace_event_internal::kNoId, // id | |
| 1372 trace_event_internal::kNoId, // bind_id | |
| 1373 num_args, arg_names, arg_types, arg_values, convertable_values, flags); | |
| 1374 metadata_events_.push_back(std::move(trace_event)); | |
| 1375 } | |
| 1352 | 1376 |
| 1353 // May be called when a COMPELETE event ends and the unfinished event has been | 1377 // 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). | 1378 // recycled (phase == TRACE_EVENT_PHASE_END and trace_event == NULL). |
| 1355 std::string TraceLog::EventToConsoleMessage(unsigned char phase, | 1379 std::string TraceLog::EventToConsoleMessage(unsigned char phase, |
| 1356 const TimeTicks& timestamp, | 1380 const TimeTicks& timestamp, |
| 1357 TraceEvent* trace_event) { | 1381 TraceEvent* trace_event) { |
| 1358 AutoLock thread_info_lock(thread_info_lock_); | 1382 AutoLock thread_info_lock(thread_info_lock_); |
| 1359 | 1383 |
| 1360 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to | 1384 // The caller should translate TRACE_EVENT_PHASE_COMPLETE to |
| 1361 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. | 1385 // TRACE_EVENT_PHASE_BEGIN or TRACE_EVENT_END. |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1726 } | 1750 } |
| 1727 | 1751 |
| 1728 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1752 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 1729 if (*category_group_enabled_) { | 1753 if (*category_group_enabled_) { |
| 1730 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1754 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
| 1731 event_handle_); | 1755 event_handle_); |
| 1732 } | 1756 } |
| 1733 } | 1757 } |
| 1734 | 1758 |
| 1735 } // namespace trace_event_internal | 1759 } // namespace trace_event_internal |
| OLD | NEW |