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

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

Issue 1412733008: Switch profiler from isolates to threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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); 36 static void BeginExecution(Isolate* isolate);
41 static void EndExecution(Isolate* isolate); 37 static void EndExecution(Isolate* isolate);
42 38
43 static SampleBuffer* sample_buffer() { 39 static SampleBuffer* sample_buffer() {
44 return sample_buffer_; 40 return sample_buffer_;
45 } 41 }
46 42
47 static void RecordAllocation(Thread* thread, intptr_t cid); 43 static void SampleAllocation(Thread* thread, intptr_t cid);
44 static void SampleMutator(Thread* thread,
Ivan Posva 2015/10/28 06:45:16 Shouldn't this be SampleThread or is the mutator h
45 uintptr_t pc,
46 uintptr_t fp,
47 uintptr_t sp);
48 48
49 private: 49 private:
50 static bool initialized_; 50 static bool initialized_;
51 static Monitor* monitor_; 51 static Monitor* monitor_;
52 52
53 static void RecordSampleInterruptCallback(const InterruptedThreadState& state, 53 static void RecordSampleInterruptCallback(const InterruptedThreadState& state,
54 void* data); 54 void* data);
55 55
56 static SampleBuffer* sample_buffer_; 56 static SampleBuffer* sample_buffer_;
57 }; 57 };
58 58
59 59
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 { 60 class SampleVisitor : public ValueObject {
89 public: 61 public:
90 explicit SampleVisitor(Isolate* isolate) : isolate_(isolate), visited_(0) { } 62 explicit SampleVisitor(Isolate* isolate) : isolate_(isolate), visited_(0) { }
91 virtual ~SampleVisitor() {} 63 virtual ~SampleVisitor() {}
92 64
93 virtual void VisitSample(Sample* sample) = 0; 65 virtual void VisitSample(Sample* sample) = 0;
94 66
95 intptr_t visited() const { 67 intptr_t visited() const {
96 return visited_; 68 return visited_;
97 } 69 }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 528
557 private: 529 private:
558 ZoneGrowableArray<ProcessedSample*> samples_; 530 ZoneGrowableArray<ProcessedSample*> samples_;
559 531
560 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); 532 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer);
561 }; 533 };
562 534
563 } // namespace dart 535 } // namespace dart
564 536
565 #endif // VM_PROFILER_H_ 537 #endif // VM_PROFILER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698