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

Unified Diff: runtime/vm/timeline_analysis.h

Issue 1284263002: Start TimelineAnalysis utility (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 | « runtime/vm/timeline.cc ('k') | runtime/vm/timeline_analysis.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/timeline_analysis.h
diff --git a/runtime/vm/timeline_analysis.h b/runtime/vm/timeline_analysis.h
new file mode 100644
index 0000000000000000000000000000000000000000..04806c1f68cfd30369796228b2feebf1884d7a9b
--- /dev/null
+++ b/runtime/vm/timeline_analysis.h
@@ -0,0 +1,99 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef VM_TIMELINE_ANALYSIS_H_
+#define VM_TIMELINE_ANALYSIS_H_
+
+#include "vm/growable_array.h"
+#include "vm/timeline.h"
+
+namespace dart {
+
+class TimelineAnalysisThread : public ZoneAllocated {
+ public:
+ explicit TimelineAnalysisThread(ThreadId id);
+ ~TimelineAnalysisThread();
+
+ ThreadId id() const {
+ return id_;
+ }
+
+ intptr_t NumBlocks() const {
+ return blocks_.length();
+ }
+
+ TimelineEventBlock* At(intptr_t i) const {
+ return blocks_.At(i);
+ }
+
+ private:
+ void AddBlock(TimelineEventBlock* block);
+ void Finalize();
+
+ const ThreadId id_;
+ ZoneGrowableArray<TimelineEventBlock*> blocks_;
+
+ friend class TimelineAnalysis;
+};
+
+
+// Base of all timeline analysis classes. Base functionality:
+// - discovery of all thread ids in a recording.
+// - collecting all ThreadEventBlocks by thread id.
+class TimelineAnalysis : public ValueObject {
+ public:
+ TimelineAnalysis(Zone* zone,
+ Isolate* isolate,
+ TimelineEventEndlessRecorder* recorder);
+ ~TimelineAnalysis();
+
+ void BuildThreads();
+
+ intptr_t NumThreads() const {
+ return threads_.length();
+ }
+
+ TimelineAnalysisThread* At(intptr_t i) const {
+ return threads_[i];
+ }
+
+ TimelineAnalysisThread* GetThread(ThreadId tid);
+
+ bool has_error() const {
+ return has_error_;
+ }
+
+ const char* error_msg() const {
+ return error_msg_;
+ }
+
+ protected:
+ TimelineAnalysisThread* GetOrAddThread(ThreadId tid);
+
+ void DiscoverThreads();
+ void FinalizeThreads();
+
+ void SetError(const char* format, ...);
+
+ Zone* zone_;
+ Isolate* isolate_;
+ TimelineEventEndlessRecorder* recorder_;
+ bool has_error_;
+ const char* error_msg_;
+
+ ZoneGrowableArray<TimelineAnalysisThread*> threads_;
+};
+
+
+class TimelinePauses : public TimelineAnalysis {
+ public:
+ TimelinePauses(Zone* zone,
+ Isolate* isolate,
+ TimelineEventEndlessRecorder* recorder);
+ private:
+};
+
+} // namespace dart
+
+#endif // VM_TIMELINE_ANALYSIS_H_
« no previous file with comments | « runtime/vm/timeline.cc ('k') | runtime/vm/timeline_analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698