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

Side by Side Diff: runtime/vm/profiler.h

Issue 100103011: Changes to support dprof and Observatory profiler UIs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_PROFILER_H_ 5 #ifndef VM_PROFILER_H_
6 #define VM_PROFILER_H_ 6 #define VM_PROFILER_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/code_observers.h" 9 #include "vm/code_observers.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
11 #include "vm/thread.h" 11 #include "vm/thread.h"
12 #include "vm/thread_interrupter.h" 12 #include "vm/thread_interrupter.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 // Forward declarations. 16 // Forward declarations.
17 class JSONArray; 17 class JSONArray;
18 class JSONStream; 18 class JSONStream;
19 class ProfilerSymbolHelper;
19 struct Sample; 20 struct Sample;
20 21
21 // Profiler 22 // Profiler
22 class Profiler : public AllStatic { 23 class Profiler : public AllStatic {
23 public: 24 public:
24 static void InitOnce(); 25 static void InitOnce();
25 static void Shutdown(); 26 static void Shutdown();
26 27
27 static void InitProfilingForIsolate(Isolate* isolate, 28 static void InitProfilingForIsolate(Isolate* isolate,
28 bool shared_buffer = false); 29 bool shared_buffer = false);
29 static void ShutdownProfilingForIsolate(Isolate* isolate); 30 static void ShutdownProfilingForIsolate(Isolate* isolate);
30 31
31 static void BeginExecution(Isolate* isolate); 32 static void BeginExecution(Isolate* isolate);
32 static void EndExecution(Isolate* isolate); 33 static void EndExecution(Isolate* isolate);
33 34
34 static void PrintToJSONStream(Isolate* isolate, JSONStream* stream); 35 static void PrintToJSONStream(Isolate* isolate, JSONStream* stream);
35 36 static void WriteSamples(Isolate* isolate);
36 static void WriteTracing(Isolate* isolate);
37 37
38 static SampleBuffer* sample_buffer() { 38 static SampleBuffer* sample_buffer() {
39 return sample_buffer_; 39 return sample_buffer_;
40 } 40 }
41 41
42 private: 42 private:
43 static bool initialized_; 43 static bool initialized_;
44 static Monitor* monitor_; 44 static Monitor* monitor_;
45 45
46 static void WriteTracingSample(Isolate* isolate, intptr_t pid, 46 static void WriteSample(Isolate* isolate,
47 Sample* sample, JSONArray& events); 47 ProfilerSymbolHelper* symbol_helper,
48 Sample* sample, JSONArray& events);
48 49
49 static void RecordTickInterruptCallback(const InterruptedThreadState& state, 50 static void RecordTickInterruptCallback(const InterruptedThreadState& state,
50 void* data); 51 void* data);
51 52
52 static void RecordSampleInterruptCallback(const InterruptedThreadState& state, 53 static void RecordSampleInterruptCallback(const InterruptedThreadState& state,
53 void* data); 54 void* data);
54 55
55 static SampleBuffer* sample_buffer_; 56 static SampleBuffer* sample_buffer_;
56 }; 57 };
57 58
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 public: 103 public:
103 static const intptr_t kDefaultBufferCapacity = 120000; // 2 minutes @ 1000hz. 104 static const intptr_t kDefaultBufferCapacity = 120000; // 2 minutes @ 1000hz.
104 105
105 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity); 106 explicit SampleBuffer(intptr_t capacity = kDefaultBufferCapacity);
106 ~SampleBuffer(); 107 ~SampleBuffer();
107 108
108 intptr_t capacity() const { return capacity_; } 109 intptr_t capacity() const { return capacity_; }
109 110
110 Sample* ReserveSample(); 111 Sample* ReserveSample();
111 112
112 Sample* GetSample(intptr_t i) const { 113 Sample GetSample(intptr_t i) const {
113 ASSERT(i >= 0); 114 ASSERT(i >= 0);
114 ASSERT(i < capacity_); 115 ASSERT(i < capacity_);
115 return &samples_[i]; 116 return samples_[i];
116 } 117 }
117 118
118 private: 119 private:
119 Sample* samples_; 120 Sample* samples_;
120 intptr_t capacity_; 121 intptr_t capacity_;
121 uintptr_t cursor_; 122 uintptr_t cursor_;
122 123
123 DISALLOW_COPY_AND_ASSIGN(SampleBuffer); 124 DISALLOW_COPY_AND_ASSIGN(SampleBuffer);
124 }; 125 };
125 126
(...skipping 23 matching lines...) Expand all
149 const uintptr_t original_pc_; 150 const uintptr_t original_pc_;
150 const uintptr_t original_fp_; 151 const uintptr_t original_fp_;
151 const uintptr_t original_sp_; 152 const uintptr_t original_sp_;
152 uintptr_t lower_bound_; 153 uintptr_t lower_bound_;
153 }; 154 };
154 155
155 156
156 } // namespace dart 157 } // namespace dart
157 158
158 #endif // VM_PROFILER_H_ 159 #endif // VM_PROFILER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698