| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (trace_event && handle) | 301 if (trace_event && handle) |
| 302 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); | 302 MakeHandle(chunk_->seq(), chunk_index_, event_index, handle); |
| 303 | 303 |
| 304 return trace_event; | 304 return trace_event; |
| 305 } | 305 } |
| 306 | 306 |
| 307 void TraceLog::ThreadLocalEventBuffer::WillDestroyCurrentMessageLoop() { | 307 void TraceLog::ThreadLocalEventBuffer::WillDestroyCurrentMessageLoop() { |
| 308 delete this; | 308 delete this; |
| 309 } | 309 } |
| 310 | 310 |
| 311 bool TraceLog::ThreadLocalEventBuffer::OnMemoryDump(const MemoryDumpArgs& args, | 311 bool TraceLog::ThreadLocalEventBuffer::OnMemoryDump(const MemoryDumpArgs&, |
| 312 ProcessMemoryDump* pmd) { | 312 ProcessMemoryDump* pmd) { |
| 313 if (!chunk_) | 313 if (!chunk_) |
| 314 return true; | 314 return true; |
| 315 std::string dump_base_name = StringPrintf( | 315 std::string dump_base_name = StringPrintf( |
| 316 "tracing/thread_%d", static_cast<int>(PlatformThread::CurrentId())); | 316 "tracing/thread_%d", static_cast<int>(PlatformThread::CurrentId())); |
| 317 TraceEventMemoryOverhead overhead; | 317 TraceEventMemoryOverhead overhead; |
| 318 chunk_->EstimateTraceMemoryOverhead(&overhead); | 318 chunk_->EstimateTraceMemoryOverhead(&overhead); |
| 319 overhead.DumpInto(dump_base_name.c_str(), pmd); | 319 overhead.DumpInto(dump_base_name.c_str(), pmd); |
| 320 return true; | 320 return true; |
| 321 } | 321 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 !CheckGeneration(thread_local_event_buffer->generation())) { | 407 !CheckGeneration(thread_local_event_buffer->generation())) { |
| 408 delete thread_local_event_buffer; | 408 delete thread_local_event_buffer; |
| 409 thread_local_event_buffer = NULL; | 409 thread_local_event_buffer = NULL; |
| 410 } | 410 } |
| 411 if (!thread_local_event_buffer) { | 411 if (!thread_local_event_buffer) { |
| 412 thread_local_event_buffer = new ThreadLocalEventBuffer(this); | 412 thread_local_event_buffer = new ThreadLocalEventBuffer(this); |
| 413 thread_local_event_buffer_.Set(thread_local_event_buffer); | 413 thread_local_event_buffer_.Set(thread_local_event_buffer); |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool TraceLog::OnMemoryDump(const MemoryDumpArgs& args, | 417 bool TraceLog::OnMemoryDump(const MemoryDumpArgs&, ProcessMemoryDump* pmd) { |
| 418 ProcessMemoryDump* pmd) { | |
| 419 // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested | 418 // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested |
| 420 // (crbug.com/499731). | 419 // (crbug.com/499731). |
| 421 TraceEventMemoryOverhead overhead; | 420 TraceEventMemoryOverhead overhead; |
| 422 overhead.Add("TraceLog", sizeof(*this)); | 421 overhead.Add("TraceLog", sizeof(*this)); |
| 423 { | 422 { |
| 424 AutoLock lock(lock_); | 423 AutoLock lock(lock_); |
| 425 if (logged_events_) | 424 if (logged_events_) |
| 426 logged_events_->EstimateTraceMemoryOverhead(&overhead); | 425 logged_events_->EstimateTraceMemoryOverhead(&overhead); |
| 427 | 426 |
| 428 for (auto& metadata_event : metadata_events_) | 427 for (auto& metadata_event : metadata_events_) |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 } | 1785 } |
| 1787 | 1786 |
| 1788 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 1787 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 1789 if (*category_group_enabled_) { | 1788 if (*category_group_enabled_) { |
| 1790 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, | 1789 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, name_, |
| 1791 event_handle_); | 1790 event_handle_); |
| 1792 } | 1791 } |
| 1793 } | 1792 } |
| 1794 | 1793 |
| 1795 } // namespace trace_event_internal | 1794 } // namespace trace_event_internal |
| OLD | NEW |