| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 bool TraceLog::HasEnabledStateObserver(EnabledStateObserver* listener) const { | 1581 bool TraceLog::HasEnabledStateObserver(EnabledStateObserver* listener) const { |
| 1582 std::vector<EnabledStateObserver*>::const_iterator it = | 1582 std::vector<EnabledStateObserver*>::const_iterator it = |
| 1583 std::find(enabled_state_observer_list_.begin(), | 1583 std::find(enabled_state_observer_list_.begin(), |
| 1584 enabled_state_observer_list_.end(), | 1584 enabled_state_observer_list_.end(), |
| 1585 listener); | 1585 listener); |
| 1586 return it != enabled_state_observer_list_.end(); | 1586 return it != enabled_state_observer_list_.end(); |
| 1587 } | 1587 } |
| 1588 | 1588 |
| 1589 float TraceLog::GetBufferPercentFull() const { | 1589 void TraceLog::GetBufferUsage(float* percent_full, |
| 1590 size_t* approximate_event_count) const { |
| 1590 AutoLock lock(lock_); | 1591 AutoLock lock(lock_); |
| 1591 return static_cast<float>(static_cast<double>(logged_events_->Size()) / | 1592 *percent_full = static_cast<float>( |
| 1592 logged_events_->Capacity()); | 1593 static_cast<double>(logged_events_->Size()) / logged_events_->Capacity()); |
| 1594 *approximate_event_count = logged_events_->Size(); |
| 1593 } | 1595 } |
| 1594 | 1596 |
| 1595 bool TraceLog::BufferIsFull() const { | 1597 bool TraceLog::BufferIsFull() const { |
| 1596 AutoLock lock(lock_); | 1598 AutoLock lock(lock_); |
| 1597 return logged_events_->IsFull(); | 1599 return logged_events_->IsFull(); |
| 1598 } | 1600 } |
| 1599 | 1601 |
| 1600 TraceBuffer* TraceLog::CreateTraceBuffer() { | 1602 TraceBuffer* TraceLog::CreateTraceBuffer() { |
| 1601 InternalTraceOptions options = trace_options(); | 1603 InternalTraceOptions options = trace_options(); |
| 1602 if (options & kInternalRecordContinuously) | 1604 if (options & kInternalRecordContinuously) |
| (...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2564 } | 2566 } |
| 2565 | 2567 |
| 2566 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2568 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 2567 if (*category_group_enabled_) { | 2569 if (*category_group_enabled_) { |
| 2568 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2570 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
| 2569 name_, event_handle_); | 2571 name_, event_handle_); |
| 2570 } | 2572 } |
| 2571 } | 2573 } |
| 2572 | 2574 |
| 2573 } // namespace trace_event_internal | 2575 } // namespace trace_event_internal |
| OLD | NEW |