Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: base/debug/trace_event_impl.cc

Issue 717083003: Report trace buffer usage as number of events, not only percentage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 size_t TraceLog::GetBufferUsage() const {
1590 AutoLock lock(lock_);
1591 return logged_events_->Size();
1592 }
1593
1589 float TraceLog::GetBufferPercentFull() const { 1594 float TraceLog::GetBufferPercentFull() const {
1590 AutoLock lock(lock_); 1595 AutoLock lock(lock_);
1591 return static_cast<float>(static_cast<double>(logged_events_->Size()) / 1596 return static_cast<float>(static_cast<double>(logged_events_->Size()) /
1592 logged_events_->Capacity()); 1597 logged_events_->Capacity());
1593 } 1598 }
1594 1599
1595 bool TraceLog::BufferIsFull() const { 1600 bool TraceLog::BufferIsFull() const {
1596 AutoLock lock(lock_); 1601 AutoLock lock(lock_);
1597 return logged_events_->IsFull(); 1602 return logged_events_->IsFull();
1598 } 1603 }
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 } 2569 }
2565 2570
2566 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 2571 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
2567 if (*category_group_enabled_) { 2572 if (*category_group_enabled_) {
2568 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, 2573 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_,
2569 name_, event_handle_); 2574 name_, event_handle_);
2570 } 2575 }
2571 } 2576 }
2572 2577
2573 } // namespace trace_event_internal 2578 } // namespace trace_event_internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698