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

Unified Diff: runtime/vm/trace_buffer.h

Issue 227423005: Add TraceBuffer log to all Functions (plus small tweaks to function-view) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/trace_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/trace_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698