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

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 comments 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') | no next file with comments »
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 void GetBufferUsage(float* percent_full,
caseq 2014/11/13 17:16:21 nit: we could probably keep several callsites less
yurys 2014/11/14 10:06:59 Done.
499 size_t* approximate_event_count) const;
499 bool BufferIsFull() const; 500 bool BufferIsFull() const;
500 501
501 // Not using base::Callback because of its limited by 7 parameters. 502 // Not using base::Callback because of its limited by 7 parameters.
502 // Also, using primitive type allows directly passing callback from WebCore. 503 // Also, using primitive type allows directly passing callback from WebCore.
503 // WARNING: It is possible for the previously set callback to be called 504 // WARNING: It is possible for the previously set callback to be called
504 // after a call to SetEventCallbackEnabled() that replaces or a call to 505 // after a call to SetEventCallbackEnabled() that replaces or a call to
505 // SetEventCallbackDisabled() that disables the callback. 506 // SetEventCallbackDisabled() that disables the callback.
506 // This callback may be invoked on any thread. 507 // This callback may be invoked on any thread.
507 // For TRACE_EVENT_PHASE_COMPLETE events, the client will still receive pairs 508 // 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 509 // 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_; } 597 int process_id() const { return process_id_; }
597 598
598 // Exposed for unittesting: 599 // Exposed for unittesting:
599 600
600 void WaitSamplingEventForTesting(); 601 void WaitSamplingEventForTesting();
601 602
602 // Allows deleting our singleton instance. 603 // Allows deleting our singleton instance.
603 static void DeleteForTesting(); 604 static void DeleteForTesting();
604 605
605 // Allow tests to inspect TraceEvents. 606 // Allow tests to inspect TraceEvents.
606 size_t GetEventsSize() const { return logged_events_->Size(); }
607 TraceEvent* GetEventByHandle(TraceEventHandle handle); 607 TraceEvent* GetEventByHandle(TraceEventHandle handle);
608 608
609 void SetProcessID(int process_id); 609 void SetProcessID(int process_id);
610 610
611 // Process sort indices, if set, override the order of a process will appear 611 // 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 612 // 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. 613 // on their sort index, ascending, then by their name, and then tid.
614 void SetProcessSortIndex(int sort_index); 614 void SetProcessSortIndex(int sort_index);
615 615
616 // Sets the name of the process. 616 // 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_; 799 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_;
800 subtle::AtomicWord generation_; 800 subtle::AtomicWord generation_;
801 801
802 DISALLOW_COPY_AND_ASSIGN(TraceLog); 802 DISALLOW_COPY_AND_ASSIGN(TraceLog);
803 }; 803 };
804 804
805 } // namespace debug 805 } // namespace debug
806 } // namespace base 806 } // namespace base
807 807
808 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 808 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698