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

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

Issue 109933006: Implement sampling profiler (chromium side change) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: first CL Created 7 years 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 | Annotate | Revision Log
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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 const TraceLog::OutputCallback& flush_output_callback); 629 const TraceLog::OutputCallback& flush_output_callback);
630 void FinishFlush(int generation); 630 void FinishFlush(int generation);
631 void OnFlushTimeout(int generation); 631 void OnFlushTimeout(int generation);
632 632
633 int generation() const { 633 int generation() const {
634 return static_cast<int>(subtle::NoBarrier_Load(&generation_)); 634 return static_cast<int>(subtle::NoBarrier_Load(&generation_));
635 } 635 }
636 bool CheckGeneration(int generation) const { 636 bool CheckGeneration(int generation) const {
637 return generation == this->generation(); 637 return generation == this->generation();
638 } 638 }
639 int NextGeneration() { 639 int NextGeneration();
640 return static_cast<int>(subtle::NoBarrier_AtomicIncrement(&generation_, 1));
641 }
642 640
643 TimeTicks OffsetNow() const { 641 TimeTicks OffsetNow() const {
644 return OffsetTimestamp(TimeTicks::NowFromSystemTraceTime()); 642 return OffsetTimestamp(TimeTicks::NowFromSystemTraceTime());
645 } 643 }
646 TimeTicks OffsetTimestamp(const TimeTicks& timestamp) const { 644 TimeTicks OffsetTimestamp(const TimeTicks& timestamp) const {
647 return timestamp - time_offset_; 645 return timestamp - time_offset_;
648 } 646 }
649 647
650 // This lock protects TraceLog member accesses (except for members protected 648 // This lock protects TraceLog member accesses (except for members protected
651 // by thread_info_lock_) from arbitrary threads. 649 // by thread_info_lock_) from arbitrary threads.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; 709 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_;
712 subtle::AtomicWord generation_; 710 subtle::AtomicWord generation_;
713 711
714 DISALLOW_COPY_AND_ASSIGN(TraceLog); 712 DISALLOW_COPY_AND_ASSIGN(TraceLog);
715 }; 713 };
716 714
717 } // namespace debug 715 } // namespace debug
718 } // namespace base 716 } // namespace base
719 717
720 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 718 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698