Index: runtime/vm/thread.cc |
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc |
index 709d735156f35122f439b1abe52a1709a25d7ee9..944b3504c9e663cb5c603d82d598d118132bea86 100644 |
--- a/runtime/vm/thread.cc |
+++ b/runtime/vm/thread.cc |
@@ -8,6 +8,7 @@ |
#include "vm/dart_api_state.h" |
#include "vm/growable_array.h" |
#include "vm/isolate.h" |
+#include "vm/json_stream.h" |
#include "vm/lockers.h" |
#include "vm/log.h" |
#include "vm/message_handler.h" |
@@ -205,6 +206,31 @@ void Thread::InitVMConstants() { |
} |
+#ifndef RELEASE |
Cutch
2016/12/06 19:11:15
dito
bkonyi
2016/12/08 18:04:14
Done.
|
+// Collect information about each individual zone associated with this thread. |
+void Thread::PrintToJSONObject(JSONObject* obj) { |
+ intptr_t size = 0; |
+ Zone* zone = zone_; |
+ while (zone != NULL) { |
+ size += zone->SizeInBytes(); |
+ zone = zone->previous(); |
+ } |
+ obj->AddPropertyF("thread_address", "0x%" Px "", |
Cutch
2016/12/06 19:11:15
we use dartCamelCase for service protocol property
bkonyi
2016/12/08 18:04:14
Done.
|
+ reinterpret_cast<uword>(this)); |
+ obj->AddPropertyF("thread_zone_size_total", "%ld", size); |
+ { |
+ JSONArray zone_info_array(obj, "zones"); |
+ zone = zone_; |
+ while (zone != NULL) { |
+ JSONObject zone_obj(&zone_info_array); |
+ zone->PrintToJSONObject(&zone_obj); |
+ zone = zone->previous(); |
+ } |
+ } |
+} |
+#endif |
+ |
+ |
RawGrowableObjectArray* Thread::pending_functions() { |
if (pending_functions_ == GrowableObjectArray::null()) { |
pending_functions_ = GrowableObjectArray::New(Heap::kOld); |