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

Unified Diff: runtime/vm/profiler.h

Issue 2748403002: Added page to Observatory to display native memory allocation information. (Closed)
Patch Set: Added page to Observatory to display native memory allocation information. Created 3 years, 9 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 9f967cf9bea02ca0b3b176a14616582e3f6a1d75..49bf670ef7600ee60cbeb2b59c75132e149a710c 100644
--- a/runtime/vm/profiler.h
+++ b/runtime/vm/profiler.h
@@ -60,7 +60,9 @@ class Profiler : public AllStatic {
static void DumpStackTrace();
static void SampleAllocation(Thread* thread, intptr_t cid);
- static Sample* SampleNativeAllocation(intptr_t skip_count);
+ static Sample* SampleNativeAllocation(intptr_t skip_count,
+ uword address,
+ uintptr_t allocation_size);
// 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
@@ -141,6 +143,8 @@ class SampleFilter : public ValueObject {
// Returns |true| if |sample| passes the thread task filter.
bool TaskFilterSample(Sample* sample);
+ static const intptr_t kNoTaskFilter = -1;
+
private:
Dart_Port port_;
intptr_t thread_task_mask_;
@@ -183,6 +187,8 @@ class Sample {
lr_ = 0;
metadata_ = 0;
state_ = 0;
+ native_allocation_address_ = 0;
+ native_allocation_size_bytes_ = 0;
continuation_index_ = -1;
uword* pcs = GetPCArray();
for (intptr_t i = 0; i < pcs_length_; i++) {
@@ -279,6 +285,20 @@ class Sample {
NativeAllocationSampleBit::update(native_allocation_sample, state_);
}
+ void set_native_allocation_address(uword address) {
+ native_allocation_address_ = address;
+ }
+
+ uword native_allocation_address() const { return native_allocation_address_; }
+
+ uintptr_t native_allocation_size_bytes() const {
+ return native_allocation_size_bytes_;
+ }
+
+ void set_native_allocation_size_bytes(uintptr_t size) {
+ native_allocation_size_bytes_ = size;
+ }
+
Thread::TaskKind thread_task() const { return ThreadTaskBit::decode(state_); }
void set_thread_task(Thread::TaskKind task) {
@@ -373,6 +393,8 @@ class Sample {
uword metadata_;
uword lr_;
uword state_;
+ uword native_allocation_address_;
+ uintptr_t native_allocation_size_bytes_;
intptr_t continuation_index_;
/* There are a variable number of words that follow, the words hold the
@@ -564,6 +586,18 @@ class ProcessedSample : public ZoneAllocated {
bool IsAllocationSample() const { return allocation_cid_ > 0; }
+ bool is_native_allocation_sample() const { return native_allocation_sample_; }
+ void set_is_native_allocation_sample(bool native_allocation_sample) {
+ native_allocation_sample_ = native_allocation_sample;
Cutch 2017/03/21 20:27:11 do you need this as a separate bool? Couldn't this
bkonyi 2017/03/22 21:25:21 Done.
+ }
+
+ uintptr_t native_allocation_size_bytes() const {
+ return native_allocation_size_bytes_;
+ }
+ void set_native_allocation_size_bytes(uintptr_t allocation_size) {
+ native_allocation_size_bytes_ = allocation_size;
+ }
+
// Was the stack trace truncated?
bool truncated() const { return truncated_; }
void set_truncated(bool truncated) { truncated_ = truncated; }
@@ -598,6 +632,9 @@ class ProcessedSample : public ZoneAllocated {
intptr_t allocation_cid_;
bool truncated_;
bool first_frame_executing_;
+ bool native_allocation_sample_;
+ uword native_allocation_address_;
+ uintptr_t native_allocation_size_bytes_;
ProfileTrieNode* timeline_trie_;
friend class SampleBuffer;

Powered by Google App Engine
This is Rietveld 408576698