OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef BASE_TRACE_EVENT_TRACE_BUFFER_H_ | 5 #ifndef BASE_TRACE_EVENT_TRACE_BUFFER_H_ |
6 #define BASE_TRACE_EVENT_TRACE_BUFFER_H_ | 6 #define BASE_TRACE_EVENT_TRACE_BUFFER_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_impl.h" | 10 #include "base/trace_event/trace_event_impl.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 const TraceEvent* GetEventAt(size_t index) const { | 34 const TraceEvent* GetEventAt(size_t index) const { |
35 DCHECK(index < size()); | 35 DCHECK(index < size()); |
36 return &chunk_[index]; | 36 return &chunk_[index]; |
37 } | 37 } |
38 | 38 |
39 scoped_ptr<TraceBufferChunk> Clone() const; | 39 scoped_ptr<TraceBufferChunk> Clone() const; |
40 | 40 |
41 void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); | 41 void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); |
42 | 42 |
| 43 // These values must be kept consistent with the numbers of bits of |
| 44 // chunk_index and event_index fields in TraceEventHandle |
| 45 // (in trace_event_impl.h). |
| 46 static const size_t kMaxChunkIndex = (1u << 26) - 1; |
43 static const size_t kTraceBufferChunkSize = 64; | 47 static const size_t kTraceBufferChunkSize = 64; |
44 | 48 |
45 private: | 49 private: |
46 size_t next_free_; | 50 size_t next_free_; |
47 scoped_ptr<TraceEventMemoryOverhead> cached_overhead_estimate_; | 51 scoped_ptr<TraceEventMemoryOverhead> cached_overhead_estimate_; |
48 TraceEvent chunk_[kTraceBufferChunkSize]; | 52 TraceEvent chunk_[kTraceBufferChunkSize]; |
49 uint32 seq_; | 53 uint32 seq_; |
50 }; | 54 }; |
51 | 55 |
52 // TraceBuffer holds the events as they are collected. | 56 // TraceBuffer holds the events as they are collected. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 121 |
118 private: | 122 private: |
119 OutputCallback output_callback_; | 123 OutputCallback output_callback_; |
120 bool append_comma_; | 124 bool append_comma_; |
121 }; | 125 }; |
122 | 126 |
123 } // namespace trace_event | 127 } // namespace trace_event |
124 } // namespace base | 128 } // namespace base |
125 | 129 |
126 #endif // BASE_TRACE_EVENT_TRACE_BUFFER_H_ | 130 #endif // BASE_TRACE_EVENT_TRACE_BUFFER_H_ |
OLD | NEW |