aboutsummaryrefslogtreecommitdiff
path: root/trace/stderr.c
diff options
context:
space:
mode:
authorMark Wu <wudxw@linux.vnet.ibm.com>2011-10-31 11:29:04 +0800
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>2011-11-01 14:12:15 +0000
commit454e202d52a517c631cb750ba65ff8079c08b301 (patch)
treedfa1b8ddc5ac554d14dc5fb24188b60a45eae288 /trace/stderr.c
parentff74c5a9a91c6dbf1017195462aa4176f7381240 (diff)
downloadqemu-454e202d52a517c631cb750ba65ff8079c08b301.zip
qemu-454e202d52a517c631cb750ba65ff8079c08b301.tar.gz
qemu-454e202d52a517c631cb750ba65ff8079c08b301.tar.bz2
trace: Add wildcard trace event support
A basic wildcard matching is supported in both the monitor command "trace-event" and the events list file. That means you can enable/disable the events having a common prefix in a batch. For example, virtio-blk trace events could be enabled using: trace-event virtio_blk_* on Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'trace/stderr.c')
-rw-r--r--trace/stderr.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/trace/stderr.c b/trace/stderr.c
index 7107c4a..0810d6f 100644
--- a/trace/stderr.c
+++ b/trace/stderr.c
@@ -15,14 +15,29 @@ void trace_print_events(FILE *stream, fprintf_function stream_printf)
bool trace_event_set_state(const char *name, bool state)
{
unsigned int i;
+ unsigned int len;
+ bool wildcard = false;
+ bool matched = false;
+ len = strlen(name);
+ if (len > 0 && name[len - 1] == '*') {
+ wildcard = true;
+ len -= 1;
+ }
for (i = 0; i < NR_TRACE_EVENTS; i++) {
+ if (wildcard) {
+ if (!strncmp(trace_list[i].tp_name, name, len)) {
+ trace_list[i].state = state;
+ matched = true;
+ }
+ continue;
+ }
if (!strcmp(trace_list[i].tp_name, name)) {
trace_list[i].state = state;
return true;
}
}
- return false;
+ return matched;
}
bool trace_backend_init(const char *events, const char *file)