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

Unified 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: Fixed ifndefs, various whitespace issues, and removed extra optional parameters 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
Index: runtime/vm/thread_registry.cc
diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc
index c660843c1eac3bd892de539293114b2dae1632c6..fc68f52d5549f2072c4ec6ce14fd3576b48af98b 100644
--- a/runtime/vm/thread_registry.cc
+++ b/runtime/vm/thread_registry.cc
@@ -5,6 +5,7 @@
#include "vm/thread_registry.h"
#include "vm/isolate.h"
+#include "vm/json_stream.h"
#include "vm/lockers.h"
namespace dart {
@@ -91,6 +92,24 @@ void ThreadRegistry::PrepareForGC() {
}
+#ifndef PRODUCT
+void ThreadRegistry::PrintJSON(JSONStream* stream) const {
+ MonitorLocker ml(threads_lock());
+ JSONArray threads(stream);
+ PrintJSONHelper(&threads, active_list_);
+ PrintJSONHelper(&threads, free_list_);
Cutch 2016/12/08 22:25:54 We shouldn't include the free list. These are Thre
bkonyi 2016/12/08 22:42:01 I'll go ahead and remove this then.
+}
+
+
+void ThreadRegistry::PrintJSONHelper(JSONArray* array, Thread* thread) const {
+ while (thread != NULL) {
+ array->AddValue(thread);
+ thread = thread->next_;
+ }
+}
+#endif
+
+
void ThreadRegistry::AddToActiveListLocked(Thread* thread) {
ASSERT(thread != NULL);
ASSERT(threads_lock()->IsOwnedByCurrentThread());

Powered by Google App Engine
This is Rietveld 408576698