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

Side by Side Diff: runtime/vm/thread.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
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.h" 5 #include "vm/thread.h"
6 6
7 #include "vm/compiler_stats.h" 7 #include "vm/compiler_stats.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
11 #include "vm/json_stream.h"
11 #include "vm/lockers.h" 12 #include "vm/lockers.h"
12 #include "vm/log.h" 13 #include "vm/log.h"
13 #include "vm/message_handler.h" 14 #include "vm/message_handler.h"
14 #include "vm/native_entry.h" 15 #include "vm/native_entry.h"
15 #include "vm/object.h" 16 #include "vm/object.h"
16 #include "vm/os_thread.h" 17 #include "vm/os_thread.h"
17 #include "vm/profiler.h" 18 #include "vm/profiler.h"
18 #include "vm/runtime_entry.h" 19 #include "vm/runtime_entry.h"
19 #include "vm/stub_code.h" 20 #include "vm/stub_code.h"
20 #include "vm/symbols.h" 21 #include "vm/symbols.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 #undef INIT_VALUE 199 #undef INIT_VALUE
199 200
200 // Setup the thread specific reusable handles. 201 // Setup the thread specific reusable handles.
201 #define REUSABLE_HANDLE_ALLOCATION(object) \ 202 #define REUSABLE_HANDLE_ALLOCATION(object) \
202 this->object##_handle_ = this->AllocateReusableHandle<object>(); 203 this->object##_handle_ = this->AllocateReusableHandle<object>();
203 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) 204 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION)
204 #undef REUSABLE_HANDLE_ALLOCATION 205 #undef REUSABLE_HANDLE_ALLOCATION
205 } 206 }
206 207
207 208
209 #ifndef RELEASE
Cutch 2016/12/06 19:11:15 dito
bkonyi 2016/12/08 18:04:14 Done.
210 // Collect information about each individual zone associated with this thread.
211 void Thread::PrintToJSONObject(JSONObject* obj) {
212 intptr_t size = 0;
213 Zone* zone = zone_;
214 while (zone != NULL) {
215 size += zone->SizeInBytes();
216 zone = zone->previous();
217 }
218 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.
219 reinterpret_cast<uword>(this));
220 obj->AddPropertyF("thread_zone_size_total", "%ld", size);
221 {
222 JSONArray zone_info_array(obj, "zones");
223 zone = zone_;
224 while (zone != NULL) {
225 JSONObject zone_obj(&zone_info_array);
226 zone->PrintToJSONObject(&zone_obj);
227 zone = zone->previous();
228 }
229 }
230 }
231 #endif
232
233
208 RawGrowableObjectArray* Thread::pending_functions() { 234 RawGrowableObjectArray* Thread::pending_functions() {
209 if (pending_functions_ == GrowableObjectArray::null()) { 235 if (pending_functions_ == GrowableObjectArray::null()) {
210 pending_functions_ = GrowableObjectArray::New(Heap::kOld); 236 pending_functions_ = GrowableObjectArray::New(Heap::kOld);
211 } 237 }
212 return pending_functions_; 238 return pending_functions_;
213 } 239 }
214 240
215 241
216 void Thread::clear_pending_functions() { 242 void Thread::clear_pending_functions() {
217 pending_functions_ = GrowableObjectArray::null(); 243 pending_functions_ = GrowableObjectArray::null();
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 799
774 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() { 800 DisableThreadInterruptsScope::~DisableThreadInterruptsScope() {
775 if (thread() != NULL) { 801 if (thread() != NULL) {
776 OSThread* os_thread = thread()->os_thread(); 802 OSThread* os_thread = thread()->os_thread();
777 ASSERT(os_thread != NULL); 803 ASSERT(os_thread != NULL);
778 os_thread->EnableThreadInterrupts(); 804 os_thread->EnableThreadInterrupts();
779 } 805 }
780 } 806 }
781 807
782 } // namespace dart 808 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698