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

Unified Diff: runtime/vm/profiler.h

Issue 151143003: Improve CodeRegionTable build time by 30x (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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
Index: runtime/vm/profiler.h
diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h
index 1e7c52701b54003e91c3bb518bbc986a9ce0becb..c33c10015d75c0c58bb4cfea6c607f714a9db07e 100644
--- a/runtime/vm/profiler.h
+++ b/runtime/vm/profiler.h
@@ -41,21 +41,11 @@ class Profiler : public AllStatic {
return sample_buffer_;
}
+
siva 2014/02/19 18:09:54 extra blank line?
Cutch 2014/02/19 18:20:31 Done.
private:
static bool initialized_;
static Monitor* monitor_;
- static intptr_t ProcessSamples(Isolate* isolate,
- ProfilerCodeRegionTable* code_region_table,
- SampleBuffer* sample_buffer);
-
- static intptr_t ProcessSample(Isolate* isolate,
- ProfilerCodeRegionTable* code_region_table,
- Sample* sample);
-
- static void RecordTickInterruptCallback(const InterruptedThreadState& state,
- void* data);
-
static void RecordSampleInterruptCallback(const InterruptedThreadState& state,
void* data);
@@ -90,8 +80,8 @@ class Sample {
static void InitOnce();
- uintptr_t At(intptr_t i) const;
- void SetAt(intptr_t i, uintptr_t pc);
+ uword At(intptr_t i) const;
+ void SetAt(intptr_t i, uword pc);
void Init(SampleType type, Isolate* isolate, int64_t timestamp, ThreadId tid);
void CopyInto(Sample* dst) const;
@@ -120,12 +110,39 @@ class Sample {
SampleType type_;
// Note: This class has a size determined at run-time. The pcs_ array
// must be the final field.
- uintptr_t pcs_[0];
+ uword pcs_[0];
DISALLOW_COPY_AND_ASSIGN(Sample);
};
+class SampleVisitor {
+ public:
+ explicit SampleVisitor(Isolate* isolate) : isolate_(isolate), visited_(0) { }
+ virtual ~SampleVisitor() {}
+
+ virtual void VisitSample(Sample* sample) = 0;
+
+ intptr_t visited() const {
+ return visited_;
+ }
+
+ void IncrementVisited() {
+ visited_++;
+ }
+
+ Isolate* isolate() const {
+ return isolate_;
+ }
+
+ private:
+ Isolate* isolate_;
+ intptr_t visited_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SampleVisitor);
+};
+
+
// Ring buffer of samples.
class SampleBuffer {
public:
@@ -139,6 +156,8 @@ class SampleBuffer {
void CopySample(intptr_t i, Sample* sample) const;
Sample* At(intptr_t idx) const;
+ void VisitSamples(SampleVisitor* visitor);
+
private:
Sample* samples_;
intptr_t capacity_;
@@ -148,35 +167,6 @@ class SampleBuffer {
};
-class ProfilerSampleStackWalker : public ValueObject {
- public:
- ProfilerSampleStackWalker(Sample* sample,
- uintptr_t stack_lower,
- uintptr_t stack_upper,
- uintptr_t pc,
- uintptr_t fp,
- uintptr_t sp);
-
- int walk();
-
- private:
- uword* CallerPC(uword* fp);
- uword* CallerFP(uword* fp);
-
- bool ValidInstructionPointer(uword* pc);
-
- bool ValidFramePointer(uword* fp);
-
- Sample* sample_;
- const uintptr_t stack_lower_;
- const uintptr_t stack_upper_;
- const uintptr_t original_pc_;
- const uintptr_t original_fp_;
- const uintptr_t original_sp_;
- uintptr_t lower_bound_;
-};
-
-
} // namespace dart
#endif // VM_PROFILER_H_

Powered by Google App Engine
This is Rietveld 408576698