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

Side by Side Diff: runtime/vm/zone.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/zone.h" 5 #include "vm/zone.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/handles_impl.h" 10 #include "vm/handles_impl.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 va_end(args); 253 va_end(args);
254 return buffer; 254 return buffer;
255 } 255 }
256 256
257 257
258 char* Zone::VPrint(const char* format, va_list args) { 258 char* Zone::VPrint(const char* format, va_list args) {
259 return OS::VSCreate(this, format, args); 259 return OS::VSCreate(this, format, args);
260 } 260 }
261 261
262 262
263 #ifndef PRODUCT
264 void Zone::PrintToJSONObject(JSONObject* obj) const {
265 const Zone* zone = this;
266 intptr_t size = SizeInBytes();
267 obj->AddPropertyF("address", "0x%" Px "", reinterpret_cast<uword>(zone));
Cutch 2016/12/06 19:11:15 don't forget "type" and "id" fields.
268 obj->AddProperty("size", size);
269 }
270 #endif
271
263 StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() { 272 StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() {
264 if (FLAG_trace_zones) { 273 if (FLAG_trace_zones) {
265 OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n", 274 OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n",
266 reinterpret_cast<intptr_t>(this), 275 reinterpret_cast<intptr_t>(this),
267 reinterpret_cast<intptr_t>(&zone_)); 276 reinterpret_cast<intptr_t>(&zone_));
268 } 277 }
269 zone_.Link(thread->zone()); 278 zone_.Link(thread->zone());
270 thread->set_zone(&zone_); 279 thread->set_zone(&zone_);
271 } 280 }
272 281
273 282
274 StackZone::~StackZone() { 283 StackZone::~StackZone() {
275 ASSERT(thread()->zone() == &zone_); 284 ASSERT(thread()->zone() == &zone_);
276 thread()->set_zone(zone_.previous_); 285 thread()->set_zone(zone_.previous_);
277 if (FLAG_trace_zones) { 286 if (FLAG_trace_zones) {
278 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n", 287 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n",
279 reinterpret_cast<intptr_t>(this), 288 reinterpret_cast<intptr_t>(this),
280 reinterpret_cast<intptr_t>(&zone_)); 289 reinterpret_cast<intptr_t>(&zone_));
281 } 290 }
282 } 291 }
283 292
284 } // namespace dart 293 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698