Index: runtime/vm/service.cc |
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc |
index cdfdd288fd5a6bdac4b41a622febbfbb234d28de..56f9e00df80a2098430dc5e9689b1b8babe069de 100644 |
--- a/runtime/vm/service.cc |
+++ b/runtime/vm/service.cc |
@@ -647,7 +647,6 @@ class EnumListParameter : public MethodParameter { |
// Returns number of elements in the list. -1 on parse error. |
intptr_t ElementCount(const char* value) const { |
const char* kJsonWhitespaceChars = " \t\r\n"; |
- |
if (value == NULL) { |
return -1; |
} |
@@ -2860,27 +2859,57 @@ static bool GetVMMetric(Thread* thread, JSONStream* js) { |
return false; |
} |
+static const char* const timeline_streams_enum_names[] = { |
+ "all", |
+#define DEFINE_NAME(name, unused) \ |
+ #name, |
+ISOLATE_TIMELINE_STREAM_LIST(DEFINE_NAME) |
+#undef DEFINE_NAME |
+ "VM", |
+ NULL |
+}; |
+ |
+static const EnumListParameter* recorded_streams_param = |
+ new EnumListParameter("recordedStreams", |
zra
2016/02/12 18:57:56
Where is this deleted?
Cutch
2016/02/12 20:13:57
It's not and none of our parameter lists are.
zra
2016/02/12 20:23:55
If there isn't one already, please file a bug to c
|
+ false, |
+ timeline_streams_enum_names); |
-static const MethodParameter* set_vm_timeline_flag_params[] = { |
+static const MethodParameter* set_vm_timeline_flags_params[] = { |
NO_ISOLATE_PARAMETER, |
- new MethodParameter("_record", true), |
+ recorded_streams_param, |
zra
2016/02/12 18:57:56
Does this rely on the order that globals are initi
Cutch
2016/02/12 20:13:57
Fixed here and elsewhere.
|
NULL, |
}; |
-static bool SetVMTimelineFlag(Thread* thread, JSONStream* js) { |
+static bool HasStream(const char** recorded_streams, const char* stream) { |
+ while (*recorded_streams != NULL) { |
+ if ((strcasestr(*recorded_streams, "all") != NULL) || |
+ (strcasestr(*recorded_streams, stream) != NULL)) { |
+ return true; |
+ } |
+ recorded_streams++; |
+ } |
+ return false; |
+} |
+ |
+ |
+static bool SetVMTimelineFlags(Thread* thread, JSONStream* js) { |
Isolate* isolate = thread->isolate(); |
ASSERT(isolate != NULL); |
StackZone zone(thread); |
- bool recording = strcmp(js->LookupParam("_record"), "all") == 0; |
- Timeline::SetStreamAPIEnabled(recording); |
- Timeline::SetStreamCompilerEnabled(recording); |
- Timeline::SetStreamDartEnabled(recording); |
- Timeline::SetStreamDebuggerEnabled(recording); |
- Timeline::SetStreamEmbedderEnabled(recording); |
- Timeline::SetStreamGCEnabled(recording); |
- Timeline::SetStreamIsolateEnabled(recording); |
+ const char* recorded_streams_str = js->LookupParam("recordedStreams"); |
+ const char** recorded_streams = |
+ recorded_streams_param->Parse(thread->zone(), recorded_streams_str); |
+ |
+ Timeline::SetStreamAPIEnabled(HasStream(recorded_streams, "API")); |
zra
2016/02/12 18:57:56
Is it possible to use ISOLATE_TIMELINE_STREAM_LIST
Cutch
2016/02/12 20:13:57
Done.
|
+ Timeline::SetStreamCompilerEnabled(HasStream(recorded_streams, "Compiler")); |
+ Timeline::SetStreamDartEnabled(HasStream(recorded_streams, "Dart")); |
+ Timeline::SetStreamDebuggerEnabled(HasStream(recorded_streams, "Debugger")); |
+ Timeline::SetStreamEmbedderEnabled(HasStream(recorded_streams, "Embedder")); |
+ Timeline::SetStreamGCEnabled(HasStream(recorded_streams, "GC")); |
+ Timeline::SetStreamIsolateEnabled(HasStream(recorded_streams, "Isolate")); |
+ Timeline::SetVMStreamEnabled(HasStream(recorded_streams, "VM")); |
PrintSuccess(js); |
@@ -2888,19 +2917,17 @@ static bool SetVMTimelineFlag(Thread* thread, JSONStream* js) { |
} |
-static const MethodParameter* get_vm_timeline_flag_params[] = { |
+static const MethodParameter* get_vm_timeline_flags_params[] = { |
NO_ISOLATE_PARAMETER, |
- new MethodParameter("_record", false), |
NULL, |
}; |
-static bool GetVMTimelineFlag(Thread* thread, JSONStream* js) { |
+static bool GetVMTimelineFlags(Thread* thread, JSONStream* js) { |
Isolate* isolate = thread->isolate(); |
ASSERT(isolate != NULL); |
StackZone zone(thread); |
- |
- js->PrintError(kFeatureDisabled, "TODO(johnmccutchan)"); |
+ Timeline::PrintFlagsToJSON(js); |
return true; |
} |
@@ -3918,8 +3945,8 @@ static const ServiceMethodDescriptor service_methods_[] = { |
get_vm_metric_list_params }, |
{ "_getVMTimeline", GetVMTimeline, |
get_vm_timeline_params }, |
- { "_getVMTimelineFlag", GetVMTimelineFlag, |
- get_vm_timeline_flag_params }, |
+ { "_getVMTimelineFlags", GetVMTimelineFlags, |
+ get_vm_timeline_flags_params }, |
{ "pause", Pause, |
pause_params }, |
{ "removeBreakpoint", RemoveBreakpoint, |
@@ -3942,8 +3969,8 @@ static const ServiceMethodDescriptor service_methods_[] = { |
set_trace_class_allocation_params }, |
{ "setVMName", SetVMName, |
set_vm_name_params }, |
- { "_setVMTimelineFlag", SetVMTimelineFlag, |
- set_vm_timeline_flag_params }, |
+ { "_setVMTimelineFlags", SetVMTimelineFlags, |
+ set_vm_timeline_flags_params }, |
}; |