| Index: runtime/vm/trace_buffer.h
|
| diff --git a/runtime/vm/trace_buffer.h b/runtime/vm/trace_buffer.h
|
| index f8b1c78de406e15451c8fb8cefbb36dcf68dd095..e6b325e310a9075d942678e6eda6ad91976428be 100644
|
| --- a/runtime/vm/trace_buffer.h
|
| +++ b/runtime/vm/trace_buffer.h
|
| @@ -11,6 +11,7 @@
|
|
|
| namespace dart {
|
|
|
| +class JSONObject;
|
| class JSONStream;
|
|
|
| struct TraceBufferEntry {
|
| @@ -23,9 +24,13 @@ struct TraceBufferEntry {
|
|
|
| class TraceBuffer {
|
| public:
|
| - static const intptr_t kDefaultCapacity = 1024;
|
| + static const intptr_t kInitialCapacity = 16;
|
| + static const intptr_t kMaximumCapacity = 1024;
|
|
|
| - explicit TraceBuffer(intptr_t capacity = kDefaultCapacity);
|
| + // TraceBuffer starts with kInitialCapacity and will expand itself until
|
| + // it reaches kMaximumCapacity.
|
| + TraceBuffer(intptr_t initial_capacity = kInitialCapacity,
|
| + intptr_t maximum_capacity = kMaximumCapacity);
|
| ~TraceBuffer();
|
|
|
| void Clear();
|
| @@ -36,20 +41,26 @@ class TraceBuffer {
|
| void Trace(const char* message);
|
| void TraceF(const char* format, ...) PRINTF_ATTRIBUTE(2, 3);
|
|
|
| + void PrintToJSONObject(JSONObject* obj) const;
|
| void PrintToJSONStream(JSONStream* stream) const;
|
|
|
| + intptr_t capacity() const { return capacity_; }
|
| +
|
| private:
|
| void Init();
|
| + void Resize(intptr_t capacity);
|
| void Cleanup();
|
| void Fill(TraceBufferEntry* entry, int64_t micros, char* msg);
|
| void AppendTrace(int64_t micros, char* message);
|
|
|
| TraceBufferEntry* ring_;
|
| - const intptr_t ring_capacity_;
|
| + intptr_t size_;
|
| + intptr_t capacity_;
|
| intptr_t ring_cursor_;
|
| + const intptr_t max_capacity_;
|
|
|
| intptr_t RingIndex(intptr_t i) const {
|
| - return i % ring_capacity_;
|
| + return i % capacity_;
|
| }
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TraceBuffer);
|
|
|