aboutsummaryrefslogtreecommitdiff
path: root/tracetool
diff options
context:
space:
mode:
Diffstat (limited to 'tracetool')
-rwxr-xr-xtracetool44
1 files changed, 39 insertions, 5 deletions
diff --git a/tracetool b/tracetool
index 2e2e37dbd3..8aeac4870b 100755
--- a/tracetool
+++ b/tracetool
@@ -87,6 +87,20 @@ get_fmt()
echo "$fmt"
}
+# Get the state of a trace event
+get_state()
+{
+ local str disable state
+ str=$(get_name "$1")
+ disable=${str##disable }
+ if [ "$disable" = "$str" ] ; then
+ state=1
+ else
+ state=0
+ fi
+ echo "$state"
+}
+
linetoh_begin_nop()
{
return
@@ -146,10 +160,14 @@ cast_args_to_uint64_t()
linetoh_simple()
{
- local name args argc trace_args
+ local name args argc trace_args state
name=$(get_name "$1")
args=$(get_args "$1")
argc=$(get_argc "$1")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ]; then
+ name=${name##disable }
+ fi
trace_args="$simple_event_num"
if [ "$argc" -gt 0 ]
@@ -188,10 +206,14 @@ EOF
linetoc_simple()
{
- local name
+ local name state
name=$(get_name "$1")
+ state=$(get_state "$1")
+ if [ "$state" = "0" ] ; then
+ name=${name##disable }
+ fi
cat <<EOF
-{.tp_name = "$name", .state=0},
+{.tp_name = "$name", .state=$state},
EOF
simple_event_num=$((simple_event_num + 1))
}
@@ -206,7 +228,7 @@ EOF
# Process stdin by calling begin, line, and end functions for the backend
convert()
{
- local begin process_line end
+ local begin process_line end str disable
begin="lineto$1_begin_$backend"
process_line="lineto$1_$backend"
end="lineto$1_end_$backend"
@@ -218,8 +240,20 @@ convert()
str=${str%%#*}
test -z "$str" && continue
+ # Process the line. The nop backend handles disabled lines.
+ disable=${str%%disable *}
echo
- "$process_line" "$str"
+ if test -z "$disable"; then
+ # Pass the disabled state as an arg to lineto$1_simple().
+ # For all other cases, call lineto$1_nop()
+ if [ $backend = "simple" ]; then
+ "$process_line" "$str"
+ else
+ "lineto$1_nop" "${str##disable }"
+ fi
+ else
+ "$process_line" "$str"
+ fi
done
echo