| 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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 uint64 TraceLog::MangleEventId(uint64 id) { | 1525 uint64 TraceLog::MangleEventId(uint64 id) { |
| 1526 return id ^ process_id_hash_; | 1526 return id ^ process_id_hash_; |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 void TraceLog::AddMetadataEventsWhileLocked() { | 1529 void TraceLog::AddMetadataEventsWhileLocked() { |
| 1530 lock_.AssertAcquired(); | 1530 lock_.AssertAcquired(); |
| 1531 | 1531 |
| 1532 // Copy metadata added by |AddMetadataEvent| into the trace log. | 1532 // Copy metadata added by |AddMetadataEvent| into the trace log. |
| 1533 for (TraceEvent* event : metadata_events_) | 1533 for (const scoped_ptr<TraceEvent>& event : metadata_events_) |
| 1534 AddEventToThreadSharedChunkWhileLocked(nullptr, false)->CopyFrom(*event); | 1534 AddEventToThreadSharedChunkWhileLocked(nullptr, false)->CopyFrom(*event); |
| 1535 | 1535 |
| 1536 #if !defined(OS_NACL) // NaCl shouldn't expose the process id. | 1536 #if !defined(OS_NACL) // NaCl shouldn't expose the process id. |
| 1537 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), | 1537 InitializeMetadataEvent(AddEventToThreadSharedChunkWhileLocked(NULL, false), |
| 1538 0, "num_cpus", "number", | 1538 0, "num_cpus", "number", |
| 1539 base::SysInfo::NumberOfProcessors()); | 1539 base::SysInfo::NumberOfProcessors()); |
| 1540 #endif | 1540 #endif |
| 1541 | 1541 |
| 1542 int current_thread_id = static_cast<int>(base::PlatformThread::CurrentId()); | 1542 int current_thread_id = static_cast<int>(base::PlatformThread::CurrentId()); |
| 1543 if (process_sort_index_ != 0) { | 1543 if (process_sort_index_ != 0) { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 } | 1770 } |
| 1771 | 1771 |
| 1772 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1772 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 1773 if (*category_group_enabled_) { | 1773 if (*category_group_enabled_) { |
| 1774 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1774 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
| 1775 event_handle_); | 1775 event_handle_); |
| 1776 } | 1776 } |
| 1777 } | 1777 } |
| 1778 | 1778 |
| 1779 } // namespace trace_event_internal | 1779 } // namespace trace_event_internal |
| OLD | NEW |