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

Unified Diff: base/trace_event/trace_buffer.h

Issue 2503473002: tracing: split out ThreadLocalEventBuffer
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/thread_local_event_buffer.cc ('k') | base/trace_event/trace_log.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_buffer.h
diff --git a/base/trace_event/trace_buffer.h b/base/trace_event/trace_buffer.h
index 4885a3c7c0931b829cda6207808c378c09463e8e..369e481e63a5c23a1119a41e742ebd0c21e48dd6 100644
--- a/base/trace_event/trace_buffer.h
+++ b/base/trace_event/trace_buffer.h
@@ -8,6 +8,8 @@
#include <stddef.h>
#include <stdint.h>
+#include <limits>
+
#include "base/base_export.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_impl.h"
@@ -19,6 +21,12 @@ namespace trace_event {
// TraceBufferChunk is the basic unit of TraceBuffer.
class BASE_EXPORT TraceBufferChunk {
public:
+ // These values must be kept consistent with the numbers of bits of
+ // chunk_index and event_index fields in TraceEventHandle
+ // (in trace_event_impl.h).
+ static const size_t kMaxChunkIndex = (1u << 26) - 1;
+ static const size_t kTraceBufferChunkSize = 64;
+
explicit TraceBufferChunk(uint32_t seq);
~TraceBufferChunk();
@@ -39,13 +47,19 @@ class BASE_EXPORT TraceBufferChunk {
return &chunk_[index];
}
- void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead);
+ void MakeHandle(size_t chunk_index,
+ size_t event_index,
+ TraceEventHandle* handle) {
+ DCHECK(seq_);
+ DCHECK(chunk_index <= kMaxChunkIndex);
+ DCHECK(event_index < kTraceBufferChunkSize);
+ DCHECK(chunk_index <= std::numeric_limits<uint16_t>::max());
+ handle->chunk_seq = seq_;
+ handle->chunk_index = static_cast<uint16_t>(chunk_index);
+ handle->event_index = static_cast<uint16_t>(event_index);
+ }
- // These values must be kept consistent with the numbers of bits of
- // chunk_index and event_index fields in TraceEventHandle
- // (in trace_event_impl.h).
- static const size_t kMaxChunkIndex = (1u << 26) - 1;
- static const size_t kTraceBufferChunkSize = 64;
+ void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead);
private:
size_t next_free_;
« no previous file with comments | « base/trace_event/thread_local_event_buffer.cc ('k') | base/trace_event/trace_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698