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

Unified Diff: runtime/vm/timeline.h

Issue 2315353004: Record Timeline to Android Systrace (Closed)
Patch Set: rmacnak review Created 4 years, 3 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 | « no previous file | runtime/vm/timeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline.h
diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
index d91e9090189a519f0e2172072d779ffd74140556..851113f8ca3f5caa578cdbd937b71a2b5faa3ef3 100644
--- a/runtime/vm/timeline.h
+++ b/runtime/vm/timeline.h
@@ -342,6 +342,9 @@ class TimelineEvent {
state_ = OwnsLabelBit::update(owns_label, state_);
}
+ // Returns the number of bytes written into |buffer|.
+ intptr_t PrintSystrace(char* buffer, intptr_t buffer_size);
+
private:
void FreeArguments();
@@ -413,6 +416,7 @@ class TimelineEvent {
friend class TimelineEventEndlessRecorder;
friend class TimelineEventRingRecorder;
friend class TimelineEventStartupRecorder;
+ friend class TimelineEventSystraceRecorder;
friend class TimelineStream;
friend class TimelineTestHelper;
DISALLOW_COPY_AND_ASSIGN(TimelineEvent);
@@ -622,6 +626,7 @@ class TimelineEventBlock {
friend class TimelineEventEndlessRecorder;
friend class TimelineEventRingRecorder;
friend class TimelineEventStartupRecorder;
+ friend class TimelineEventSystraceRecorder;
friend class TimelineTestHelper;
friend class JSONStream;
@@ -786,6 +791,28 @@ class TimelineEventRingRecorder : public TimelineEventFixedBufferRecorder {
};
+// A recorder that writes events to Android Systrace. Events are also stored in
+// a buffer of fixed capacity. When the buffer is full, new events overwrite
+// old events.
+class TimelineEventSystraceRecorder
+ : public TimelineEventFixedBufferRecorder {
+ public:
+ explicit TimelineEventSystraceRecorder(intptr_t capacity = kDefaultCapacity);
+
+ ~TimelineEventSystraceRecorder();
+
+ const char* name() const {
+ return "Systrace";
+ }
+
+ protected:
+ TimelineEventBlock* GetNewBlockLocked();
+ void CompleteEvent(TimelineEvent* event);
+
+ int systrace_fd_;
+};
+
+
// A recorder that stores events in a buffer of fixed capacity. When the buffer
// is full, new events are dropped.
class TimelineEventStartupRecorder : public TimelineEventFixedBufferRecorder {
« no previous file with comments | « no previous file | runtime/vm/timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698