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

Unified Diff: runtime/vm/isolate.cc

Issue 2608463002: Added isolate + thread high watermark tracking to Observatory (Closed)
Patch Set: Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track o… Created 4 years 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/isolate.h ('k') | runtime/vm/thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 8304532470999c81ea515843ad6496c8348db0f3..24007c514abc34dd98ed11a5b03df36b9ccf7f0b 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -2103,6 +2103,8 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) {
}
}
+ jsobj.AddProperty("isolateMemoryHighWatermark",
+ isolate_memory_high_watermark_);
jsobj.AddProperty("threads", thread_registry_);
}
#endif
@@ -2699,6 +2701,7 @@ void Isolate::UnscheduleThread(Thread* thread,
// Ensure that the thread reports itself as being at a safepoint.
thread->EnterSafepoint();
}
+ UpdateIsolateHighWatermark();
OSThread* os_thread = thread->os_thread();
ASSERT(os_thread != NULL);
os_thread->DisableThreadInterrupts();
@@ -2713,12 +2716,22 @@ void Isolate::UnscheduleThread(Thread* thread,
thread->set_execution_state(Thread::kThreadInNative);
thread->set_safepoint_state(Thread::SetAtSafepoint(true, 0));
thread->clear_pending_functions();
+ thread->ClearThreadMemoryUsageStats();
ASSERT(thread->no_safepoint_scope_depth() == 0);
// Return thread structure.
thread_registry()->ReturnThreadLocked(is_mutator, thread);
}
+void Isolate::UpdateIsolateHighWatermark() {
+ intptr_t thread_watermarks_total =
+ thread_registry()->ThreadHighWatermarksTotalLocked();
+ if (thread_watermarks_total > isolate_memory_high_watermark_) {
+ isolate_memory_high_watermark_ = thread_watermarks_total;
+ }
+}
+
+
static RawInstance* DeserializeObject(Thread* thread,
uint8_t* obj_data,
intptr_t obj_len) {
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698