From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Lluís Vilanova" <vilanova@ac.upc.edu>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL 04/16] trace: [hmp] Reimplement "trace-event" and "info trace-events" using QMP
Date: Fri, 26 Sep 2014 11:59:25 +0100 [thread overview]
Message-ID: <1411729177-5222-5-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1411729177-5222-1-git-send-email-stefanha@redhat.com>
From: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Message-id: 20140825112002.31112.60143.stgit@fimbulvetr.bsc.es
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
monitor.c | 27 ++++++++++++++-------------
trace/control.c | 13 -------------
trace/control.h | 7 -------
3 files changed, 14 insertions(+), 33 deletions(-)
diff --git a/monitor.c b/monitor.c
index 667efb7..b96710e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -886,19 +886,12 @@ 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");
+ Error *local_err = NULL;
- bool found = false;
- TraceEvent *ev = NULL;
- while ((ev = trace_event_pattern(tp_name, ev)) != NULL) {
- found = true;
- if (!trace_event_get_state_static(ev)) {
- monitor_printf(mon, "event \"%s\" is not traceable\n", tp_name);
- } else {
- trace_event_set_state_dynamic(ev, new_state);
- }
- }
- if (!trace_event_is_pattern(tp_name) && !found) {
- monitor_printf(mon, "unknown event name \"%s\"\n", tp_name);
+ qmp_trace_event_set_state(tp_name, new_state, true, true, &local_err);
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
}
}
@@ -1079,7 +1072,15 @@ static void do_info_cpu_stats(Monitor *mon, const QDict *qdict)
static void do_trace_print_events(Monitor *mon, const QDict *qdict)
{
- trace_print_events((FILE *)mon, &monitor_fprintf);
+ TraceEventInfoList *events = qmp_trace_event_get_state("*", NULL);
+ TraceEventInfoList *elem;
+
+ for (elem = events; elem != NULL; elem = elem->next) {
+ monitor_printf(mon, "%s : state %u\n",
+ elem->value->name,
+ elem->value->state == TRACE_EVENT_STATE_ENABLED ? 1 : 0);
+ }
+ qapi_free_TraceEventInfoList(events);
}
static int client_migrate_info(Monitor *mon, const QDict *qdict,
diff --git a/trace/control.c b/trace/control.c
index 9631a40..0d30801 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -85,19 +85,6 @@ TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev)
return NULL;
}
-void trace_print_events(FILE *stream, fprintf_function stream_printf)
-{
- TraceEventID i;
-
- for (i = 0; i < trace_event_count(); i++) {
- TraceEvent *ev = trace_event_id(i);
- stream_printf(stream, "%s [Event ID %u] : state %u\n",
- trace_event_get_name(ev), i,
- trace_event_get_state_static(ev) &&
- trace_event_get_state_dynamic(ev));
- }
-}
-
static void trace_init_events(const char *fname)
{
Location loc;
diff --git a/trace/control.h b/trace/control.h
index e1ec033..da9bb6b 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -149,13 +149,6 @@ static void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
/**
- * trace_print_events:
- *
- * Print the state of all events.
- */
-void trace_print_events(FILE *stream, fprintf_function stream_printf);
-
-/**
* trace_init_backends:
* @events: Name of file with events to be enabled at startup; may be NULL.
* Corresponds to commandline option "-trace events=...".
--
1.9.3
next prev parent reply other threads:[~2014-09-26 11:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 10:59 [Qemu-devel] [PULL 00/16] Tracing patches Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 01/16] trace: [ust] Fix format string computation in tcg-enabled events Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 02/16] trace: docs: add trace file description Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 03/16] trace: [qmp] Add commands to query and control event tracing state Stefan Hajnoczi
2014-09-26 10:59 ` Stefan Hajnoczi [this message]
2014-09-26 10:59 ` [Qemu-devel] [PULL 05/16] trace-events: drop orphan virtio_blk_data_plane_complete_request Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 06/16] trace-events: drop orphan usb_mtp_data_out Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 07/16] trace-events: drop orphan iscsi trace events Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 08/16] trace: tighten up trace-events regex to fix bad parse Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 09/16] cleanup-trace-events.pl: Tighten search for trace event call Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 10/16] trace-events: Drop unused megasas trace event Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 11/16] trace-events: Drop orphaned monitor " Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 12/16] trace-events: Fix comments pointing to source files Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 13/16] trace: install trace-events file Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 14/16] scripts/tracetool: don't barf on formats with precision Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 15/16] ohci: Split long traces to smaller ones Stefan Hajnoczi
2014-09-26 10:59 ` [Qemu-devel] [PULL 16/16] ohci: drop computed flags from trace events Stefan Hajnoczi
2014-09-26 13:16 ` [Qemu-devel] [PULL 00/16] Tracing patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411729177-5222-5-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).