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

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

Issue 1423473004: Switch profiler from isolates to threads [second landing] (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bitfield.h" 9 #include "vm/bitfield.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 15 matching lines...) Expand all
26 class SampleBuffer; 26 class SampleBuffer;
27 27
28 class Profiler : public AllStatic { 28 class Profiler : public AllStatic {
29 public: 29 public:
30 static void InitOnce(); 30 static void InitOnce();
31 static void Shutdown(); 31 static void Shutdown();
32 32
33 static void SetSampleDepth(intptr_t depth); 33 static void SetSampleDepth(intptr_t depth);
34 static void SetSamplePeriod(intptr_t period); 34 static void SetSamplePeriod(intptr_t period);
35 35
36 static void InitProfilingForIsolate(Isolate* isolate,
37 bool shared_buffer = true);
38 static void ShutdownProfilingForIsolate(Isolate* isolate);
39
40 static void BeginExecution(Isolate* isolate);
41 static void EndExecution(Isolate* isolate);
42
43 static SampleBuffer* sample_buffer() { 36 static SampleBuffer* sample_buffer() {
44 return sample_buffer_; 37 return sample_buffer_;
45 } 38 }
46 39
47 static void RecordAllocation(Thread* thread, intptr_t cid); 40 static void SampleAllocation(Thread* thread, intptr_t cid);
41 static void SampleThread(Thread* thread,
42 const InterruptedThreadState& state);
48 43
49 private: 44 private:
50 static bool initialized_; 45 static bool initialized_;
51 static Monitor* monitor_; 46 static Monitor* monitor_;
52 47
53 static void RecordSampleInterruptCallback(const InterruptedThreadState& state, 48 static SampleBuffer* sample_buffer_;
54 void* data);
55 49
56 static SampleBuffer* sample_buffer_; 50 friend class Thread;
57 }; 51 };
58 52
59 53
60 class IsolateProfilerData {
61 public:
62 IsolateProfilerData(SampleBuffer* sample_buffer, bool own_sample_buffer);
63 ~IsolateProfilerData();
64
65 SampleBuffer* sample_buffer() const { return sample_buffer_; }
66
67 void set_sample_buffer(SampleBuffer* sample_buffer) {
68 sample_buffer_ = sample_buffer;
69 }
70
71 bool blocked() const {
72 return block_count_ > 0;
73 }
74
75 void Block();
76
77 void Unblock();
78
79 private:
80 SampleBuffer* sample_buffer_;
81 bool own_sample_buffer_;
82 intptr_t block_count_;
83
84 DISALLOW_COPY_AND_ASSIGN(IsolateProfilerData);
85 };
86
87
88 class SampleVisitor : public ValueObject { 54 class SampleVisitor : public ValueObject {
89 public: 55 public:
90 explicit SampleVisitor(Isolate* isolate) : isolate_(isolate), visited_(0) { } 56 explicit SampleVisitor(Isolate* isolate) : isolate_(isolate), visited_(0) { }
91 virtual ~SampleVisitor() {} 57 virtual ~SampleVisitor() {}
92 58
93 virtual void VisitSample(Sample* sample) = 0; 59 virtual void VisitSample(Sample* sample) = 0;
94 60
95 intptr_t visited() const { 61 intptr_t visited() const {
96 return visited_; 62 return visited_;
97 } 63 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 522
557 private: 523 private:
558 ZoneGrowableArray<ProcessedSample*> samples_; 524 ZoneGrowableArray<ProcessedSample*> samples_;
559 525
560 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); 526 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer);
561 }; 527 };
562 528
563 } // namespace dart 529 } // namespace dart
564 530
565 #endif // VM_PROFILER_H_ 531 #endif // VM_PROFILER_H_
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698