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

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

Issue 205713004: Add isolate tag-profile and better handling of errors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/service/message.dart » ('j') | 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/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 if (!code.IsNull()) { 1410 if (!code.IsNull()) {
1411 code.PrintToJSONStream(js, false); 1411 code.PrintToJSONStream(js, false);
1412 return true; 1412 return true;
1413 } 1413 }
1414 PrintError(js, "Could not find code with id: %s", command); 1414 PrintError(js, "Could not find code with id: %s", command);
1415 return true; 1415 return true;
1416 } 1416 }
1417 1417
1418 1418
1419 static bool HandleProfile(Isolate* isolate, JSONStream* js) { 1419 static bool HandleProfile(Isolate* isolate, JSONStream* js) {
1420 if (js->num_arguments() == 2) {
1421 const char* sub_command = js->GetArgument(1);
1422 if (!strcmp(sub_command, "tag")) {
1423 {
1424 JSONObject miniProfile(js);
1425 miniProfile.AddProperty("type", "TagProfile");
1426 miniProfile.AddProperty("id", "profile/tag");
1427 isolate->vm_tag_counters()->PrintToJSONObject(&miniProfile);
1428 }
1429 return true;
1430 } else {
1431 PrintError(js, "Unrecognized subcommand '%s'", sub_command);
1432 return true;
1433 }
1434 }
1420 // A full profile includes disassembly of all Dart code objects. 1435 // A full profile includes disassembly of all Dart code objects.
1421 // TODO(johnmccutchan): Add sub command to trigger full code dump. 1436 // TODO(johnmccutchan): Add sub command to trigger full code dump.
1422 bool full_profile = false; 1437 bool full_profile = false;
1423 const char* tags_option = js->LookupOption("tags"); 1438 const char* tags_option = js->LookupOption("tags");
1424 bool use_tags = true; 1439 bool use_tags = true;
1425 if (tags_option != NULL) { 1440 if (tags_option != NULL) {
1426 if (strcmp("hide", tags_option) != 0) { 1441 if (strcmp("hide", tags_option) != 0) {
1427 PrintError(js, "Invalid tags option value: %s\n", tags_option); 1442 PrintError(js, "Invalid tags option value: %s\n", tags_option);
1428 return true; 1443 return true;
1429 } 1444 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 { 1584 {
1570 NoGCScope no_gc; 1585 NoGCScope no_gc;
1571 ContainsAddressVisitor visitor(isolate, addr); 1586 ContainsAddressVisitor visitor(isolate, addr);
1572 object = isolate->heap()->FindObject(&visitor); 1587 object = isolate->heap()->FindObject(&visitor);
1573 } 1588 }
1574 object.PrintToJSONStream(js, true); 1589 object.PrintToJSONStream(js, true);
1575 return true; 1590 return true;
1576 } 1591 }
1577 1592
1578 1593
1594 static bool HandleMalformedJson(Isolate* isolate, JSONStream* js) {
1595 JSONObject jsobj(js);
1596 jsobj.AddProperty("a", "a");
1597 JSONObject jsobj1(js);
1598 jsobj1.AddProperty("a", "a");
1599 JSONObject jsobj2(js);
1600 jsobj2.AddProperty("a", "a");
1601 JSONObject jsobj3(js);
1602 jsobj3.AddProperty("a", "a");
1603 return true;
1604 }
1605
1606
1607 static bool HandleMalformedObject(Isolate* isolate, JSONStream* js) {
1608 JSONObject jsobj(js);
1609 jsobj.AddProperty("bart", "simpson");
1610 return true;
1611 }
1612
1613
1579 static IsolateMessageHandlerEntry isolate_handlers[] = { 1614 static IsolateMessageHandlerEntry isolate_handlers[] = {
1615 { "_malformedjson", HandleMalformedJson },
1616 { "_malformedobject", HandleMalformedObject },
1580 { "_echo", HandleIsolateEcho }, 1617 { "_echo", HandleIsolateEcho },
1581 { "", HandleIsolate }, 1618 { "", HandleIsolate },
1582 { "address", HandleAddress }, 1619 { "address", HandleAddress },
1583 { "allocationprofile", HandleAllocationProfile }, 1620 { "allocationprofile", HandleAllocationProfile },
1584 { "classes", HandleClasses }, 1621 { "classes", HandleClasses },
1585 { "code", HandleCode }, 1622 { "code", HandleCode },
1586 { "coverage", HandleCoverage }, 1623 { "coverage", HandleCoverage },
1587 { "debug", HandleDebug }, 1624 { "debug", HandleDebug },
1588 { "heapmap", HandleHeapMap }, 1625 { "heapmap", HandleHeapMap },
1589 { "libraries", HandleLibraries }, 1626 { "libraries", HandleLibraries },
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 while (current != NULL) { 1876 while (current != NULL) {
1840 if (strcmp(name, current->name()) == 0) { 1877 if (strcmp(name, current->name()) == 0) {
1841 return current; 1878 return current;
1842 } 1879 }
1843 current = current->next(); 1880 current = current->next();
1844 } 1881 }
1845 return NULL; 1882 return NULL;
1846 } 1883 }
1847 1884
1848 } // namespace dart 1885 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/service/message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698