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

Unified Diff: runtime/vm/profiler.h

Issue 2718523003: Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing… (Closed)
Patch Set: Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing… Created 3 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
« no previous file with comments | « runtime/vm/os_win.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.h
diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h
index ee87a31d954051b61af6a7a822b7f2bb78da23eb..9f967cf9bea02ca0b3b176a14616582e3f6a1d75 100644
--- a/runtime/vm/profiler.h
+++ b/runtime/vm/profiler.h
@@ -41,6 +41,8 @@ struct ProfilerCounters {
int64_t stack_walker_dart_exit;
int64_t stack_walker_dart;
int64_t stack_walker_none;
+ // Count of failed checks:
+ int64_t failure_native_allocation_sample;
};
@@ -58,6 +60,7 @@ class Profiler : public AllStatic {
static void DumpStackTrace();
static void SampleAllocation(Thread* thread, intptr_t cid);
+ static Sample* SampleNativeAllocation(intptr_t skip_count);
// SampleThread is called from inside the signal handler and hence it is very
// critical that the implementation of SampleThread does not do any of the
@@ -91,7 +94,7 @@ class Profiler : public AllStatic {
class SampleVisitor : public ValueObject {
public:
- explicit SampleVisitor(Isolate* isolate) : isolate_(isolate), visited_(0) {}
+ explicit SampleVisitor(Dart_Port port) : port_(port), visited_(0) {}
virtual ~SampleVisitor() {}
virtual void VisitSample(Sample* sample) = 0;
@@ -100,10 +103,10 @@ class SampleVisitor : public ValueObject {
void IncrementVisited() { visited_++; }
- Isolate* isolate() const { return isolate_; }
+ Dart_Port port() const { return port_; }
private:
- Isolate* isolate_;
+ Dart_Port port_;
intptr_t visited_;
DISALLOW_IMPLICIT_CONSTRUCTORS(SampleVisitor);
@@ -112,11 +115,11 @@ class SampleVisitor : public ValueObject {
class SampleFilter : public ValueObject {
public:
- SampleFilter(Isolate* isolate,
+ SampleFilter(Dart_Port port,
intptr_t thread_task_mask,
int64_t time_origin_micros,
int64_t time_extent_micros)
- : isolate_(isolate),
+ : port_(port),
thread_task_mask_(thread_task_mask),
time_origin_micros_(time_origin_micros),
time_extent_micros_(time_extent_micros) {
@@ -130,7 +133,7 @@ class SampleFilter : public ValueObject {
// Return |true| if |sample| passes the filter.
virtual bool FilterSample(Sample* sample) { return true; }
- Isolate* isolate() const { return isolate_; }
+ Dart_Port port() const { return port_; }
// Returns |true| if |sample| passes the time filter.
bool TimeFilterSample(Sample* sample);
@@ -139,7 +142,7 @@ class SampleFilter : public ValueObject {
bool TaskFilterSample(Sample* sample);
private:
- Isolate* isolate_;
+ Dart_Port port_;
intptr_t thread_task_mask_;
int64_t time_origin_micros_;
int64_t time_extent_micros_;
@@ -157,21 +160,20 @@ class ClearProfileVisitor : public SampleVisitor {
// Each Sample holds a stack trace from an isolate.
class Sample {
public:
- void Init(Isolate* isolate, int64_t timestamp, ThreadId tid) {
+ void Init(Dart_Port port, int64_t timestamp, ThreadId tid) {
Clear();
timestamp_ = timestamp;
tid_ = tid;
- isolate_ = isolate;
+ port_ = port;
}
- // Isolate sample was taken from.
- Isolate* isolate() const { return isolate_; }
+ Dart_Port port() const { return port_; }
// Thread sample was taken on.
ThreadId tid() const { return tid_; }
void Clear() {
- isolate_ = NULL;
+ port_ = ILLEGAL_PORT;
pc_marker_ = 0;
for (intptr_t i = 0; i < kStackBufferSizeInWords; i++) {
stack_buffer_[i] = 0;
@@ -268,6 +270,15 @@ class Sample {
state_ = ClassAllocationSampleBit::update(allocation_sample, state_);
}
+ bool is_native_allocation_sample() const {
+ return NativeAllocationSampleBit::decode(state_);
+ }
+
+ void set_is_native_allocation_sample(bool native_allocation_sample) {
+ state_ =
+ NativeAllocationSampleBit::update(native_allocation_sample, state_);
+ }
+
Thread::TaskKind thread_task() const { return ThreadTaskBit::decode(state_); }
void set_thread_task(Thread::TaskKind task) {
@@ -331,7 +342,8 @@ class Sample {
kClassAllocationSampleBit = 6,
kContinuationSampleBit = 7,
kThreadTaskBit = 8, // 5 bits.
- kNextFreeBit = 13,
+ kNativeAllocationSampleBit = 13,
+ kNextFreeBit = 14,
};
class HeadSampleBit : public BitField<uword, bool, kHeadSampleBit, 1> {};
class LeafFrameIsDart : public BitField<uword, bool, kLeafFrameIsDartBit, 1> {
@@ -348,10 +360,12 @@ class Sample {
: public BitField<uword, bool, kContinuationSampleBit, 1> {};
class ThreadTaskBit
: public BitField<uword, Thread::TaskKind, kThreadTaskBit, 5> {};
+ class NativeAllocationSampleBit
+ : public BitField<uword, bool, kNativeAllocationSampleBit, 1> {};
int64_t timestamp_;
ThreadId tid_;
- Isolate* isolate_;
+ Dart_Port port_;
uword pc_marker_;
uword stack_buffer_[kStackBufferSizeInWords];
uword vm_tag_;
@@ -474,7 +488,7 @@ class SampleBuffer {
// Bad sample.
continue;
}
- if (sample->isolate() != visitor->isolate()) {
+ if (sample->port() != visitor->port()) {
// Another isolate.
continue;
}
« no previous file with comments | « runtime/vm/os_win.cc ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698