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

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

Issue 12221022: Initial prototype of vmstats support, based on Dart VM Stats draft design doc. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months 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 | Annotate | Revision Log
« runtime/vm/debugger_api_impl.cc ('K') | « runtime/vm/isolate.h ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/isolate.h" 5 #include "vm/isolate.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "lib/mirrors.h" 9 #include "lib/mirrors.h"
10 #include "vm/code_observers.h" 10 #include "vm/code_observers.h"
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 } 620 }
621 621
622 622
623 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor, 623 void Isolate::VisitWeakPersistentHandles(HandleVisitor* visitor,
624 bool visit_prologue_weak_handles) { 624 bool visit_prologue_weak_handles) {
625 if (api_state() != NULL) { 625 if (api_state() != NULL) {
626 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles); 626 api_state()->VisitWeakHandles(visitor, visit_prologue_weak_handles);
627 } 627 }
628 } 628 }
629 629
630
631 char* Isolate::GetStatus(const char* request) {
632 char* p = const_cast<char*>(request);
633 const char* service_type = "/isolate/";
634 ASSERT(strncmp(p, service_type, strlen(service_type)) == 0);
635 p += strlen(service_type);
636
637 // Extract isolate handle.
638 int64_t addr;
639 OS::StringToInt64(p, &addr);
640 Isolate* isolate = reinterpret_cast<Isolate*>(addr);
641 Heap* heap = isolate->heap();
642
643 char buffer[256];
644 int n = OS::SNPrint(buffer, 256, "{\n"
645 " \"name\": \"%s\",\n"
646 " \"port\": %lld,\n"
647 " \"starttime\": %lld,\n"
648 " \"stacklimit\": %d,\n"
649 " \"newspace\": {\n"
650 " \"used\": %d,\n"
651 " \"capacity\": %d\n"
652 " },\n"
653 " \"oldspace\": {\n"
654 " \"used\": %d,\n"
655 " \"capacity\": %d\n"
656 " }\n"
657 "}",
658 isolate->name(), isolate->main_port(),
659 (isolate->start_time() / 1000), isolate->saved_stack_limit(),
660 heap->Used(Heap::kNew) / KB, heap->Capacity(Heap::kNew) / KB,
661 heap->Used(Heap::kOld) / KB, heap->Capacity(Heap::kOld) / KB);
662 ASSERT(n < 256);
663 return strdup(buffer);
664 }
665
630 } // namespace dart 666 } // namespace dart
OLDNEW
« runtime/vm/debugger_api_impl.cc ('K') | « runtime/vm/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698