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

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

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: Addressed comment 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
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | components/tracing/tracing_messages.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_
8 8
9 #include <stack> 9 #include <stack>
10 #include <string> 10 #include <string>
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 virtual void OnTraceLogEnabled() = 0; 488 virtual void OnTraceLogEnabled() = 0;
489 489
490 // Called just after the tracing system disables, outside of the |lock_|. 490 // Called just after the tracing system disables, outside of the |lock_|.
491 // TraceLog::IsEnabled() is false at this point. 491 // TraceLog::IsEnabled() is false at this point.
492 virtual void OnTraceLogDisabled() = 0; 492 virtual void OnTraceLogDisabled() = 0;
493 }; 493 };
494 void AddEnabledStateObserver(EnabledStateObserver* listener); 494 void AddEnabledStateObserver(EnabledStateObserver* listener);
495 void RemoveEnabledStateObserver(EnabledStateObserver* listener); 495 void RemoveEnabledStateObserver(EnabledStateObserver* listener);
496 bool HasEnabledStateObserver(EnabledStateObserver* listener) const; 496 bool HasEnabledStateObserver(EnabledStateObserver* listener) const;
497 497
498 float GetBufferPercentFull() const; 498 struct BufferUsage {
499 float percent_full;
500 size_t approximate_event_count;
501 };
502 BufferUsage GetBufferUsage() const;
499 bool BufferIsFull() const; 503 bool BufferIsFull() const;
500 504
501 // Not using base::Callback because of its limited by 7 parameters. 505 // Not using base::Callback because of its limited by 7 parameters.
502 // Also, using primitive type allows directly passing callback from WebCore. 506 // Also, using primitive type allows directly passing callback from WebCore.
503 // WARNING: It is possible for the previously set callback to be called 507 // WARNING: It is possible for the previously set callback to be called
504 // after a call to SetEventCallbackEnabled() that replaces or a call to 508 // after a call to SetEventCallbackEnabled() that replaces or a call to
505 // SetEventCallbackDisabled() that disables the callback. 509 // SetEventCallbackDisabled() that disables the callback.
506 // This callback may be invoked on any thread. 510 // This callback may be invoked on any thread.
507 // For TRACE_EVENT_PHASE_COMPLETE events, the client will still receive pairs 511 // For TRACE_EVENT_PHASE_COMPLETE events, the client will still receive pairs
508 // of TRACE_EVENT_PHASE_BEGIN and TRACE_EVENT_PHASE_END events to keep the 512 // of TRACE_EVENT_PHASE_BEGIN and TRACE_EVENT_PHASE_END events to keep the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 int process_id() const { return process_id_; } 600 int process_id() const { return process_id_; }
597 601
598 // Exposed for unittesting: 602 // Exposed for unittesting:
599 603
600 void WaitSamplingEventForTesting(); 604 void WaitSamplingEventForTesting();
601 605
602 // Allows deleting our singleton instance. 606 // Allows deleting our singleton instance.
603 static void DeleteForTesting(); 607 static void DeleteForTesting();
604 608
605 // Allow tests to inspect TraceEvents. 609 // Allow tests to inspect TraceEvents.
606 size_t GetEventsSize() const { return logged_events_->Size(); }
607 TraceEvent* GetEventByHandle(TraceEventHandle handle); 610 TraceEvent* GetEventByHandle(TraceEventHandle handle);
608 611
609 void SetProcessID(int process_id); 612 void SetProcessID(int process_id);
610 613
611 // Process sort indices, if set, override the order of a process will appear 614 // Process sort indices, if set, override the order of a process will appear
612 // relative to other processes in the trace viewer. Processes are sorted first 615 // relative to other processes in the trace viewer. Processes are sorted first
613 // on their sort index, ascending, then by their name, and then tid. 616 // on their sort index, ascending, then by their name, and then tid.
614 void SetProcessSortIndex(int sort_index); 617 void SetProcessSortIndex(int sort_index);
615 618
616 // Sets the name of the process. 619 // Sets the name of the process.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; 802 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_;
800 subtle::AtomicWord generation_; 803 subtle::AtomicWord generation_;
801 804
802 DISALLOW_COPY_AND_ASSIGN(TraceLog); 805 DISALLOW_COPY_AND_ASSIGN(TraceLog);
803 }; 806 };
804 807
805 } // namespace debug 808 } // namespace debug
806 } // namespace base 809 } // namespace base
807 810
808 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 811 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | components/tracing/tracing_messages.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698