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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef VM_TIMELINE_ANALYSIS_H_
6 #define VM_TIMELINE_ANALYSIS_H_
7
8 #include "vm/growable_array.h"
9 #include "vm/timeline.h"
10
11 namespace dart {
12
13 class TimelineAnalysisThread : public ZoneAllocated {
14 public:
15 explicit TimelineAnalysisThread(ThreadId id);
16 ~TimelineAnalysisThread();
17
18 ThreadId id() const {
19 return id_;
20 }
21
22 intptr_t NumBlocks() const {
23 return blocks_.length();
24 }
25
26 TimelineEventBlock* At(intptr_t i) const {
27 return blocks_.At(i);
28 }
29
30 private:
31 void AddBlock(TimelineEventBlock* block);
32 void Finalize();
33
34 const ThreadId id_;
35 ZoneGrowableArray<TimelineEventBlock*> blocks_;
36
37 friend class TimelineAnalysis;
38 };
39
40
41 // Base of all timeline analysis classes. Base functionality:
42 // - discovery of all thread ids in a recording.
43 // - collecting all ThreadEventBlocks by thread id.
44 class TimelineAnalysis : public ValueObject {
45 public:
46 TimelineAnalysis(Zone* zone,
47 Isolate* isolate,
48 TimelineEventEndlessRecorder* recorder);
49 ~TimelineAnalysis();
50
51 void BuildThreads();
52
53 intptr_t NumThreads() const {
54 return threads_.length();
55 }
56
57 TimelineAnalysisThread* At(intptr_t i) const {
58 return threads_[i];
59 }
60
61 TimelineAnalysisThread* GetThread(ThreadId tid);
62
63 bool has_error() const {
64 return has_error_;
65 }
66
67 const char* error_msg() const {
68 return error_msg_;
69 }
70
71 protected:
72 TimelineAnalysisThread* GetOrAddThread(ThreadId tid);
73
74 void DiscoverThreads();
75 void FinalizeThreads();
76
77 void SetError(const char* format, ...);
78
79 Zone* zone_;
80 Isolate* isolate_;
81 TimelineEventEndlessRecorder* recorder_;
82 bool has_error_;
83 const char* error_msg_;
84
85 ZoneGrowableArray<TimelineAnalysisThread*> threads_;
86 };
87
88
89 class TimelinePauses : public TimelineAnalysis {
90 public:
91 TimelinePauses(Zone* zone,
92 Isolate* isolate,
93 TimelineEventEndlessRecorder* recorder);
94 private:
95 };
96
97 } // namespace dart
98
99 #endif // VM_TIMELINE_ANALYSIS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698