qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Lluís Vilanova" <vilanova@ac.upc.edu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines
Date: Thu, 08 Dec 2011 23:49:23 +0100	[thread overview]
Message-ID: <20111208224923.21668.87729.stgit@ginnungagap.bsc.es> (raw)
In-Reply-To: <20111208224750.21668.26153.stgit@ginnungagap.bsc.es>

All backends now use 'get_api_name' to build the name of the routines that are
used by QEMU code when invoking trace points. This is built based on the value
of 'get_api_name_fmt_default'.

The old 'get_name' is still available to refer to the name of an event.

This ensures proper naming across tracing backends.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool |   40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index f2b6680..853f1bd 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -57,6 +57,19 @@ get_name()
     echo "${name##* }"
 }
 
+get_api_name_fmt_default="trace_%s"
+
+# Get the tracepoint name of a trace event (the name of the function QEMU uses)
+# The result is 'printf "$fmt" $name', where 'fmt' is
+# 'get_api_name_fmt_default'.
+get_api_name()
+{
+    local name fmt
+    name=$(get_name "$1")
+    fmt="$get_api_name_fmt_default"
+    printf "$fmt" "$name"
+}
+
 # Get the given property of a trace event
 # 1: trace-events line
 # 2: property name
@@ -248,13 +261,13 @@ linetoh_begin_nop()
 
 linetoh_nop()
 {
-    local name args
-    name=$(get_name "$1")
+    local api args
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
 
     # Define an empty function for the trace event
     cat <<EOF
-static inline void trace_$name($args)
+static inline void ${api}($args)
 {
 }
 EOF
@@ -300,8 +313,8 @@ cast_args_to_uint64_t()
 
 linetoh_simple()
 {
-    local name args argc trace_args
-    name=$(get_name "$1")
+    local api args argc trace_args
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argc=$(get_argc "$1")
 
@@ -312,7 +325,7 @@ linetoh_simple()
     fi
 
     cat <<EOF
-static inline void trace_$name($args)
+static inline void ${api}($args)
 {
     trace$argc($trace_args);
 }
@@ -372,8 +385,9 @@ EOF
 
 linetoh_stderr()
 {
-    local name args argnames argc fmt
+    local name api args argnames argc fmt
     name=$(get_name "$1")
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1" ",")
     argc=$(get_argc "$1")
@@ -384,7 +398,7 @@ linetoh_stderr()
     fi
 
     cat <<EOF
-static inline void trace_$name($args)
+static inline void ${api}($args)
 {
     if (trace_list[$stderr_event_num].state != 0) {
         fprintf(stderr, "$name " $fmt "\n" $argnames);
@@ -448,14 +462,15 @@ linetoh_begin_ust()
 
 linetoh_ust()
 {
-    local name args argnames
+    local name api args argnames
     name=$(get_name "$1")
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1", ",")
 
     cat <<EOF
 DECLARE_TRACE(ust_$name, TP_PROTO($args), TP_ARGS($argnames));
-#define trace_$name trace_ust_$name
+#define ${api} trace_ust_$name
 EOF
 }
 
@@ -520,8 +535,9 @@ EOF
 
 linetoh_dtrace()
 {
-    local name args argnames nameupper
+    local name api args argnames nameupper
     name=$(get_name "$1")
+    api=$(get_api_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1", ",")
 
@@ -529,7 +545,7 @@ linetoh_dtrace()
 
     # Define an empty function for the trace event
     cat <<EOF
-static inline void trace_$name($args) {
+static inline void ${api}($args) {
     if (QEMU_${nameupper}_ENABLED()) {
         QEMU_${nameupper}($argnames);
     }

  parent reply	other threads:[~2011-12-08 22:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08 22:47 [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section Lluís Vilanova
2011-12-09 20:08   ` Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 02/10] trace-tcg: Add documentation Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 03/10] Trivial changes to eliminate auto-generated files Lluís Vilanova
2011-12-08 22:48 ` [Qemu-devel] [PATCH 04/10] [m68k, s390, xtensa] Move helpers.h to helper.h Lluís Vilanova
2011-12-08 22:49 ` [Qemu-devel] [PATCH 05/10] trace: [tracetool] Common functions to manage event arguments Lluís Vilanova
2011-12-08 22:49 ` Lluís Vilanova [this message]
2011-12-08 22:49 ` [Qemu-devel] [PATCH 07/10] trace-tcg: [tracetool] Allow TCG types in trace event declarations Lluís Vilanova
2011-12-08 22:49 ` [Qemu-devel] [PATCH 08/10] trace-tcg: [tracetool] Declare TCG tracing helper routines Lluís Vilanova
2011-12-08 22:50 ` [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define " Lluís Vilanova
2011-12-08 22:50 ` [Qemu-devel] [PATCH 10/10] trace-tcg: [all] Include TCG-tracing helpers Lluís Vilanova

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=20111208224923.21668.87729.stgit@ginnungagap.bsc.es \
    --to=vilanova@ac.upc.edu \
    --cc=qemu-devel@nongnu.org \
    /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).