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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 6c5d834389dfd221cc962137d9ab0d26cf47b2f4..33f1af31d5ddb18358ba139f68255366385dcd6d 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1417,6 +1417,21 @@ static bool HandleCode(Isolate* isolate, JSONStream* js) {
static bool HandleProfile(Isolate* isolate, JSONStream* js) {
+ if (js->num_arguments() == 2) {
+ const char* sub_command = js->GetArgument(1);
+ if (!strcmp(sub_command, "tag")) {
+ {
+ JSONObject miniProfile(js);
+ miniProfile.AddProperty("type", "TagProfile");
+ miniProfile.AddProperty("id", "profile/tag");
+ isolate->vm_tag_counters()->PrintToJSONObject(&miniProfile);
+ }
+ return true;
+ } else {
+ PrintError(js, "Unrecognized subcommand '%s'", sub_command);
+ return true;
+ }
+ }
// A full profile includes disassembly of all Dart code objects.
// TODO(johnmccutchan): Add sub command to trigger full code dump.
bool full_profile = false;
@@ -1576,7 +1591,29 @@ static bool HandleAddress(Isolate* isolate, JSONStream* js) {
}
+static bool HandleMalformedJson(Isolate* isolate, JSONStream* js) {
+ JSONObject jsobj(js);
+ jsobj.AddProperty("a", "a");
+ JSONObject jsobj1(js);
+ jsobj1.AddProperty("a", "a");
+ JSONObject jsobj2(js);
+ jsobj2.AddProperty("a", "a");
+ JSONObject jsobj3(js);
+ jsobj3.AddProperty("a", "a");
+ return true;
+}
+
+
+static bool HandleMalformedObject(Isolate* isolate, JSONStream* js) {
+ JSONObject jsobj(js);
+ jsobj.AddProperty("bart", "simpson");
+ return true;
+}
turnidge 2014/03/24 20:22:13 How do you use these currently? Just curious.
Cutch 2014/03/25 14:39:06 I am manually using these to test error handling i
+
+
static IsolateMessageHandlerEntry isolate_handlers[] = {
+ { "_malformedjson", HandleMalformedJson },
+ { "_malformedobject", HandleMalformedObject },
{ "_echo", HandleIsolateEcho },
{ "", HandleIsolate },
{ "address", HandleAddress },

Powered by Google App Engine
This is Rietveld 408576698