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

Unified Diff: base/trace_event/trace_log.cc

Issue 1276163003: Increase number of bits for trace buffer chunk index (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct number of bits Created 5 years, 4 months 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/trace_event_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_log.cc
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc
index 56c01c1d610a695d086dc55cbbd4ba47812dcb18..8eb46c521492c60186b06112b965b6792d1de579 100644
--- a/base/trace_event/trace_log.cc
+++ b/base/trace_event/trace_log.cc
@@ -58,10 +58,18 @@ namespace {
// Controls the number of trace events we will buffer in-memory
// before throwing them away.
const size_t kTraceBufferChunkSize = TraceBufferChunk::kTraceBufferChunkSize;
+
const size_t kTraceEventVectorBigBufferChunks =
512000000 / kTraceBufferChunkSize;
+static_assert(
+ kTraceEventVectorBigBufferChunks <= TraceBufferChunk::kMaxChunkIndex,
+ "Too many big buffer chunks");
const size_t kTraceEventVectorBufferChunks = 256000 / kTraceBufferChunkSize;
+static_assert(
+ kTraceEventVectorBufferChunks <= TraceBufferChunk::kMaxChunkIndex,
+ "Too many vector buffer chunks");
const size_t kTraceEventRingBufferChunks = kTraceEventVectorBufferChunks / 4;
+
// Can store results for 30 seconds with 1 ms sampling interval.
const size_t kMonitorTraceEventBufferChunks = 30000 / kTraceBufferChunkSize;
// ECHO_TO_CONSOLE needs a small buffer to hold the unfinished COMPLETE events.
@@ -167,8 +175,8 @@ void MakeHandle(uint32 chunk_seq,
size_t event_index,
TraceEventHandle* handle) {
DCHECK(chunk_seq);
- DCHECK(chunk_index < (1u << 16));
- DCHECK(event_index < (1u << 16));
+ DCHECK(chunk_index <= TraceBufferChunk::kMaxChunkIndex);
+ DCHECK(event_index < TraceBufferChunk::kTraceBufferChunkSize);
handle->chunk_seq = chunk_seq;
handle->chunk_index = static_cast<uint16>(chunk_index);
handle->event_index = static_cast<uint16>(event_index);
« no previous file with comments | « base/trace_event/trace_event_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698