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 <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 thread_local_event_buffer = new ThreadLocalEventBuffer(this); | 391 thread_local_event_buffer = new ThreadLocalEventBuffer(this); |
392 thread_local_event_buffer_.Set(thread_local_event_buffer); | 392 thread_local_event_buffer_.Set(thread_local_event_buffer); |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 bool TraceLog::OnMemoryDump(const MemoryDumpArgs& args, | 396 bool TraceLog::OnMemoryDump(const MemoryDumpArgs& args, |
397 ProcessMemoryDump* pmd) { | 397 ProcessMemoryDump* pmd) { |
398 // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested | 398 // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested |
399 // (crbug.com/499731). | 399 // (crbug.com/499731). |
400 TraceEventMemoryOverhead overhead; | 400 TraceEventMemoryOverhead overhead; |
401 overhead.Add("TraceLog", sizeof(*this)); | 401 overhead.Add(TraceEventMemoryOverhead::kOther, sizeof(*this)); |
402 { | 402 { |
403 AutoLock lock(lock_); | 403 AutoLock lock(lock_); |
404 if (logged_events_) | 404 if (logged_events_) |
405 logged_events_->EstimateTraceMemoryOverhead(&overhead); | 405 logged_events_->EstimateTraceMemoryOverhead(&overhead); |
406 | 406 |
407 for (auto& metadata_event : metadata_events_) | 407 for (auto& metadata_event : metadata_events_) |
408 metadata_event->EstimateTraceMemoryOverhead(&overhead); | 408 metadata_event->EstimateTraceMemoryOverhead(&overhead); |
409 } | 409 } |
410 overhead.AddSelf(); | 410 overhead.AddSelf(); |
411 overhead.DumpInto("tracing/main_trace_log", pmd); | 411 overhead.DumpInto("tracing/main_trace_log", pmd); |
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 category.set_state_flag(TraceCategory::ENABLED_FOR_ETW_EXPORT); | 1671 category.set_state_flag(TraceCategory::ENABLED_FOR_ETW_EXPORT); |
1672 } else { | 1672 } else { |
1673 category.clear_state_flag(TraceCategory::ENABLED_FOR_ETW_EXPORT); | 1673 category.clear_state_flag(TraceCategory::ENABLED_FOR_ETW_EXPORT); |
1674 } | 1674 } |
1675 } | 1675 } |
1676 } | 1676 } |
1677 #endif // defined(OS_WIN) | 1677 #endif // defined(OS_WIN) |
1678 | 1678 |
1679 void ConvertableToTraceFormat::EstimateTraceMemoryOverhead( | 1679 void ConvertableToTraceFormat::EstimateTraceMemoryOverhead( |
1680 TraceEventMemoryOverhead* overhead) { | 1680 TraceEventMemoryOverhead* overhead) { |
1681 overhead->Add("ConvertableToTraceFormat(Unknown)", sizeof(*this)); | 1681 overhead->Add(TraceEventMemoryOverhead::kConvertableToTraceFormat, |
| 1682 sizeof(*this)); |
1682 } | 1683 } |
1683 | 1684 |
1684 void TraceLog::AddAsyncEnabledStateObserver( | 1685 void TraceLog::AddAsyncEnabledStateObserver( |
1685 WeakPtr<AsyncEnabledStateObserver> listener) { | 1686 WeakPtr<AsyncEnabledStateObserver> listener) { |
1686 AutoLock lock(lock_); | 1687 AutoLock lock(lock_); |
1687 async_observers_.insert( | 1688 async_observers_.insert( |
1688 std::make_pair(listener.get(), RegisteredAsyncObserver(listener))); | 1689 std::make_pair(listener.get(), RegisteredAsyncObserver(listener))); |
1689 } | 1690 } |
1690 | 1691 |
1691 void TraceLog::RemoveAsyncEnabledStateObserver( | 1692 void TraceLog::RemoveAsyncEnabledStateObserver( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 } | 1735 } |
1735 | 1736 |
1736 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1737 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
1737 if (*category_group_enabled_) { | 1738 if (*category_group_enabled_) { |
1738 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1739 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
1739 event_handle_); | 1740 event_handle_); |
1740 } | 1741 } |
1741 } | 1742 } |
1742 | 1743 |
1743 } // namespace trace_event_internal | 1744 } // namespace trace_event_internal |
OLD | NEW |