[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to cons
From: |
Lluís Vilanova |
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 |
User-agent: |
StGit/0.15 |
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 <address@hidden>
---
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);
}
- [Qemu-devel] [RFC][PATCH 00/10] trace-tcg: Allow tracing guest events in TCG-generated code, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 01/10] trace: [doc] Document event properties on a separate section, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 02/10] trace-tcg: Add documentation, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 03/10] Trivial changes to eliminate auto-generated files, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 04/10] [m68k, s390, xtensa] Move helpers.h to helper.h, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 05/10] trace: [tracetool] Common functions to manage event arguments, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 06/10] trace: [tracetool] Add 'get_api_name' to construct the name of tracing routines,
Lluís Vilanova <=
- [Qemu-devel] [PATCH 07/10] trace-tcg: [tracetool] Allow TCG types in trace event declarations, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 08/10] trace-tcg: [tracetool] Declare TCG tracing helper routines, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 09/10] trace-tcg: [tracetool] Define TCG tracing helper routines, Lluís Vilanova, 2011/12/08
- [Qemu-devel] [PATCH 10/10] trace-tcg: [all] Include TCG-tracing helpers, Lluís Vilanova, 2011/12/08