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

Side by Side Diff: runtime/vm/thread_registry.cc

Issue 2554983002: Created methods to surface zone memory information for each isolate and thread in JSON. (Closed)
Patch Set: Created methods to surface zone memory information for each isolate and thread in JSON. 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 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/lockers.h" 9 #include "vm/lockers.h"
9 10
10 namespace dart { 11 namespace dart {
11 12
12 ThreadRegistry::~ThreadRegistry() { 13 ThreadRegistry::~ThreadRegistry() {
13 // Go over the free thread list and delete the thread objects. 14 // Go over the free thread list and delete the thread objects.
14 { 15 {
15 MonitorLocker ml(threads_lock()); 16 MonitorLocker ml(threads_lock());
16 // At this point the active list should be empty. 17 // At this point the active list should be empty.
17 ASSERT(active_list_ == NULL); 18 ASSERT(active_list_ == NULL);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void ThreadRegistry::PrepareForGC() { 85 void ThreadRegistry::PrepareForGC() {
85 MonitorLocker ml(threads_lock()); 86 MonitorLocker ml(threads_lock());
86 Thread* thread = active_list_; 87 Thread* thread = active_list_;
87 while (thread != NULL) { 88 while (thread != NULL) {
88 thread->PrepareForGC(); 89 thread->PrepareForGC();
89 thread = thread->next_; 90 thread = thread->next_;
90 } 91 }
91 } 92 }
92 93
93 94
95 #ifndef PRODUCT
96 void ThreadRegistry::PrintJSON(JSONStream* stream) const {
97 MonitorLocker ml(threads_lock());
98 JSONArray threads(stream);
99 Thread* current = active_list_;
100 while (current != NULL) {
101 threads.AddValue(current);
102 current = current->next_;
103 }
104 }
105 #endif
106
107
94 void ThreadRegistry::AddToActiveListLocked(Thread* thread) { 108 void ThreadRegistry::AddToActiveListLocked(Thread* thread) {
95 ASSERT(thread != NULL); 109 ASSERT(thread != NULL);
96 ASSERT(threads_lock()->IsOwnedByCurrentThread()); 110 ASSERT(threads_lock()->IsOwnedByCurrentThread());
97 thread->next_ = active_list_; 111 thread->next_ = active_list_;
98 active_list_ = thread; 112 active_list_ = thread;
99 } 113 }
100 114
101 115
102 void ThreadRegistry::RemoveFromActiveListLocked(Thread* thread) { 116 void ThreadRegistry::RemoveFromActiveListLocked(Thread* thread) {
103 ASSERT(thread != NULL); 117 ASSERT(thread != NULL);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ASSERT(thread->os_thread_ == NULL); 151 ASSERT(thread->os_thread_ == NULL);
138 ASSERT(thread->isolate_ == NULL); 152 ASSERT(thread->isolate_ == NULL);
139 ASSERT(thread->heap_ == NULL); 153 ASSERT(thread->heap_ == NULL);
140 ASSERT(threads_lock()->IsOwnedByCurrentThread()); 154 ASSERT(threads_lock()->IsOwnedByCurrentThread());
141 // Add thread to the free list. 155 // Add thread to the free list.
142 thread->next_ = free_list_; 156 thread->next_ = free_list_;
143 free_list_ = thread; 157 free_list_ = thread;
144 } 158 }
145 159
146 } // namespace dart 160 } // 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