Patchwork [v6,4/7] trace: [monitor] Use new event control interface

login
register
mail settings
Submitter Lluís Vilanova
Date June 13, 2012, 7:11 p.m.
Message ID <20120613191116.7037.36348.stgit@fimbulvetr.bsc.es>
Download mbox | patch
Permalink /patch/164743/
State New
Headers show

Comments

Lluís Vilanova - June 13, 2012, 7:11 p.m.
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 monitor.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index a3bc2c7..83ce956 100644
--- a/monitor.c
+++ b/monitor.c
@@ -589,10 +589,19 @@  static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
 {
     const char *tp_name = qdict_get_str(qdict, "name");
     bool new_state = qdict_get_bool(qdict, "option");
-    int ret = trace_event_set_state(tp_name, new_state);
 
-    if (!ret) {
-        monitor_printf(mon, "unknown event name \"%s\"\n", tp_name);
+    if (trace_event_is_pattern(tp_name)) {
+        TraceEvent *ev = NULL;
+        while ((ev = trace_event_pattern(tp_name, ev)) != NULL) {
+            trace_event_set_state_dynamic(ev, new_state);
+        }
+    } else {
+        TraceEvent *ev = trace_event_name(tp_name);
+        if (ev == NULL) {
+            monitor_printf(mon, "unknown event name \"%s\"\n", tp_name);
+        } else {
+            trace_event_set_state_dynamic(ev, new_state);
+        }
     }
 }