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

Unified Diff: runtime/vm/thread.h

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.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.h
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 576d57c19d1e637908acb34d5fd4a7c721f421cb..410f7a120d2412640da515e0e27445e377d681f7 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -264,6 +264,26 @@ class Thread : public BaseThread {
bool ZoneIsOwnedByThread(Zone* zone) const;
+ void IncrementThreadMemoryUsage(intptr_t value) {
+ current_thread_memory_ += value;
+ if (current_thread_memory_ > thread_memory_high_watermark_) {
+ thread_memory_high_watermark_ = current_thread_memory_;
+ }
+ }
+
+ void DecrementThreadMemoryUsage(intptr_t value) {
+ current_thread_memory_ -= value;
+ }
+
+ intptr_t GetThreadHighWatermark() const {
+ return thread_memory_high_watermark_;
+ }
+
+ void ClearThreadMemoryUsageStats() {
+ thread_memory_high_watermark_ = 0;
+ current_thread_memory_ = 0;
+ }
+
// The reusable api local scope for this thread.
ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; }
void set_api_reusable_scope(ApiLocalScope* value) {
@@ -679,6 +699,8 @@ class Thread : public BaseThread {
OSThread* os_thread_;
Monitor* thread_lock_;
Zone* zone_;
+ intptr_t current_thread_memory_;
+ intptr_t thread_memory_high_watermark_;
ApiLocalScope* api_reusable_scope_;
ApiLocalScope* api_top_scope_;
StackResource* top_resource_;
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698