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

Side by Side Diff: runtime/vm/thread_registry.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 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/thread_registry.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/thread_registry.h" 5 #include "vm/thread_registry.h"
6 6
7 #include "vm/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/json_stream.h" 8 #include "vm/json_stream.h"
9 #include "vm/lockers.h" 9 #include "vm/lockers.h"
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Get thread structure from free list or create a new one. 139 // Get thread structure from free list or create a new one.
140 if (free_list_ == NULL) { 140 if (free_list_ == NULL) {
141 thread = new Thread(isolate); 141 thread = new Thread(isolate);
142 } else { 142 } else {
143 thread = free_list_; 143 thread = free_list_;
144 free_list_ = thread->next_; 144 free_list_ = thread->next_;
145 } 145 }
146 return thread; 146 return thread;
147 } 147 }
148 148
149
149 void ThreadRegistry::ReturnToFreelistLocked(Thread* thread) { 150 void ThreadRegistry::ReturnToFreelistLocked(Thread* thread) {
150 ASSERT(thread != NULL); 151 ASSERT(thread != NULL);
151 ASSERT(thread->os_thread_ == NULL); 152 ASSERT(thread->os_thread_ == NULL);
152 ASSERT(thread->isolate_ == NULL); 153 ASSERT(thread->isolate_ == NULL);
153 ASSERT(thread->heap_ == NULL); 154 ASSERT(thread->heap_ == NULL);
154 ASSERT(threads_lock()->IsOwnedByCurrentThread()); 155 ASSERT(threads_lock()->IsOwnedByCurrentThread());
155 // Add thread to the free list. 156 // Add thread to the free list.
156 thread->next_ = free_list_; 157 thread->next_ = free_list_;
157 free_list_ = thread; 158 free_list_ = thread;
158 } 159 }
159 160
161
162 intptr_t ThreadRegistry::ThreadHighWatermarksTotalLocked() const {
163 ASSERT(threads_lock()->IsOwnedByCurrentThread());
164 intptr_t max_memory_usage_total = 0;
165 Thread* current = active_list_;
166 while (current != NULL) {
167 max_memory_usage_total += current->GetThreadHighWatermark();
168 current = current->next_;
169 }
170 return max_memory_usage_total;
171 }
172
160 } // namespace dart 173 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/thread_registry.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698