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

Unified Diff: runtime/vm/profiler.h

Issue 2680213002: Updated MallocHooks to collect stack traces when memory is allocated. (Closed)
Patch Set: Addressed comments + added ability to disable stacktrace collection for tests/benchmarks that timeo… 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
Index: runtime/vm/profiler.h
diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h
index ee87a31d954051b61af6a7a822b7f2bb78da23eb..31f4485692639bd8ab3a97edf4cf1d7dd22b9150 100644
--- a/runtime/vm/profiler.h
+++ b/runtime/vm/profiler.h
@@ -58,6 +58,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 +92,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 +101,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 +113,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 +131,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 +140,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 +158,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;
@@ -351,7 +351,7 @@ class Sample {
int64_t timestamp_;
ThreadId tid_;
- Isolate* isolate_;
+ Dart_Port port_;
uword pc_marker_;
uword stack_buffer_[kStackBufferSizeInWords];
uword vm_tag_;
@@ -474,7 +474,8 @@ class SampleBuffer {
// Bad sample.
continue;
}
- if (sample->isolate() != visitor->isolate()) {
+ if ((sample->port() != visitor->port()) &&
+ sample->port() != ILLEGAL_PORT) {
// Another isolate.
continue;
}
« no previous file with comments | « runtime/vm/os_win.cc ('k') | runtime/vm/profiler.cc » ('j') | runtime/vm/profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698