diff mbox

[v3] tracetool: Add optional argument to specify dtrace probe names

Message ID 1297945565-10593-1-git-send-email-Jes.Sorensen@redhat.com
State New
Headers show

Commit Message

Jes Sorensen Feb. 17, 2011, 12:26 p.m. UTC
From: Jes Sorensen <Jes.Sorensen@redhat.com>

Optional feature allowing a user to generate the probe list to match
the name of the binary, in case they wish to install qemu under a

Comments

Paolo Bonzini Feb. 17, 2011, 12:29 p.m. UTC | #1
On 02/17/2011 01:26 PM, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen<Jes.Sorensen@redhat.com>
>
> Optional feature allowing a user to generate the probe list to match
> the name of the binary, in case they wish to install qemu under a
> different name than qemu-{system,user},<arch>
>
> Signed-off-by: Jes Sorensen<Jes.Sorensen@redhat.com>
> ---
>   scripts/tracetool |   19 +++++++++++++------
>   1 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/tracetool b/scripts/tracetool
> index e046683..412f695 100755
> --- a/scripts/tracetool
> +++ b/scripts/tracetool
> @@ -30,9 +30,11 @@ Output formats:
>     --stap Generate .stp file (DTrace with SystemTAP only)
>
>   Options:
> -  --binary      [path]  Full path to QEMU binary
> -  --target-arch [arch]  QEMU emulator target arch
> -  --target-type [type]  QEMU emulator target type ('system' or 'user')
> +  --binary       [path]    Full path to QEMU binary
> +  --target-arch  [arch]    QEMU emulator target arch
> +  --target-type  [type]    QEMU emulator target type ('system' or 'user')
> +  --probe-prefix [prefix]  Prefix for dtrace probe names
> +                           (default: qemu-\$targettype-\$targetarch)
>
>   EOF
>       exit 1
> @@ -472,7 +474,7 @@ linetostap_dtrace()
>
>       # Define prototype for probe arguments
>       cat<<EOF
> -probe qemu.$targettype.$targetarch.$name = process("$binary").mark("$name")
> +probe $probeprefix.$name = process("$binary").mark("$name")
>   {
>   EOF
>
> @@ -574,14 +576,17 @@ tracetostap()
>          echo "--binary is required for SystemTAP tapset generator"
>          exit 1
>       fi
> -    if [ -z "$targettype" ]; then
> +    if [ -z "$probeprefix" -a -z "$targettype" ]; then
>          echo "--target-type is required for SystemTAP tapset generator"
>          exit 1
>       fi
> -    if [ -z "$targetarch" ]; then
> +    if [ -z "$probeprefix" -a -z "$targetarch" ]; then
>          echo "--target-arch is required for SystemTAP tapset generator"
>          exit 1
>       fi
> +    if [ -z "$probeprefix" ]; then
> +	probeprefix="qemu.$targettype.$targetarch";
> +    fi
>       echo "/* This file is autogenerated by tracetool, do not edit. */"
>       convert stap
>   }
> @@ -592,6 +597,7 @@ output=
>   binary=
>   targettype=
>   targetarch=
> +probeprefix=
>
>
>   until [ -z "$1" ]
> @@ -602,6 +608,7 @@ do
>       "--binary") shift ; binary="$1" ;;
>       "--target-arch") shift ; targetarch="$1" ;;
>       "--target-type") shift ; targettype="$1" ;;
> +    "--probe-prefix") shift ; probeprefix="$1" ;;
>
>       "-h" | "-c" | "-d") output="${1#-}" ;;
>       "--stap") output="${1#--}" ;;

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo
Stefan Hajnoczi Feb. 17, 2011, 1:04 p.m. UTC | #2
On Thu, Feb 17, 2011 at 01:26:05PM +0100, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> Optional feature allowing a user to generate the probe list to match
> the name of the binary, in case they wish to install qemu under a
> different name than qemu-{system,user},<arch>
> 
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  scripts/tracetool |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)

Thanks for the fix, I missed the problem with v2!

Acked-by: Stefan Hajnoczi <stefaha@linux.vnet.ibm.com>
Aurelien Jarno March 6, 2011, 7:39 p.m. UTC | #3
On Thu, Feb 17, 2011 at 01:26:05PM +0100, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> Optional feature allowing a user to generate the probe list to match
> the name of the binary, in case they wish to install qemu under a
> different name than qemu-{system,user},<arch>
> 
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  scripts/tracetool |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)

Thanks, applied.

> diff --git a/scripts/tracetool b/scripts/tracetool
> index e046683..412f695 100755
> --- a/scripts/tracetool
> +++ b/scripts/tracetool
> @@ -30,9 +30,11 @@ Output formats:
>    --stap Generate .stp file (DTrace with SystemTAP only)
>  
>  Options:
> -  --binary      [path]  Full path to QEMU binary
> -  --target-arch [arch]  QEMU emulator target arch
> -  --target-type [type]  QEMU emulator target type ('system' or 'user')
> +  --binary       [path]    Full path to QEMU binary
> +  --target-arch  [arch]    QEMU emulator target arch
> +  --target-type  [type]    QEMU emulator target type ('system' or 'user')
> +  --probe-prefix [prefix]  Prefix for dtrace probe names
> +                           (default: qemu-\$targettype-\$targetarch)
>  
>  EOF
>      exit 1
> @@ -472,7 +474,7 @@ linetostap_dtrace()
>  
>      # Define prototype for probe arguments
>      cat <<EOF
> -probe qemu.$targettype.$targetarch.$name = process("$binary").mark("$name")
> +probe $probeprefix.$name = process("$binary").mark("$name")
>  {
>  EOF
>  
> @@ -574,14 +576,17 @@ tracetostap()
>         echo "--binary is required for SystemTAP tapset generator"
>         exit 1
>      fi
> -    if [ -z "$targettype" ]; then
> +    if [ -z "$probeprefix" -a -z "$targettype" ]; then
>         echo "--target-type is required for SystemTAP tapset generator"
>         exit 1
>      fi
> -    if [ -z "$targetarch" ]; then
> +    if [ -z "$probeprefix" -a -z "$targetarch" ]; then
>         echo "--target-arch is required for SystemTAP tapset generator"
>         exit 1
>      fi
> +    if [ -z "$probeprefix" ]; then
> +	probeprefix="qemu.$targettype.$targetarch";
> +    fi
>      echo "/* This file is autogenerated by tracetool, do not edit. */"
>      convert stap
>  }
> @@ -592,6 +597,7 @@ output=
>  binary=
>  targettype=
>  targetarch=
> +probeprefix=
>  
>  
>  until [ -z "$1" ]
> @@ -602,6 +608,7 @@ do
>      "--binary") shift ; binary="$1" ;;
>      "--target-arch") shift ; targetarch="$1" ;;
>      "--target-type") shift ; targettype="$1" ;;
> +    "--probe-prefix") shift ; probeprefix="$1" ;;
>  
>      "-h" | "-c" | "-d") output="${1#-}" ;;
>      "--stap") output="${1#--}" ;;
> -- 
> 1.7.4
> 
> 
>
diff mbox

Patch

different name than qemu-{system,user},<arch>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 scripts/tracetool |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index e046683..412f695 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -30,9 +30,11 @@  Output formats:
   --stap Generate .stp file (DTrace with SystemTAP only)
 
 Options:
-  --binary      [path]  Full path to QEMU binary
-  --target-arch [arch]  QEMU emulator target arch
-  --target-type [type]  QEMU emulator target type ('system' or 'user')
+  --binary       [path]    Full path to QEMU binary
+  --target-arch  [arch]    QEMU emulator target arch
+  --target-type  [type]    QEMU emulator target type ('system' or 'user')
+  --probe-prefix [prefix]  Prefix for dtrace probe names
+                           (default: qemu-\$targettype-\$targetarch)
 
 EOF
     exit 1
@@ -472,7 +474,7 @@  linetostap_dtrace()
 
     # Define prototype for probe arguments
     cat <<EOF
-probe qemu.$targettype.$targetarch.$name = process("$binary").mark("$name")
+probe $probeprefix.$name = process("$binary").mark("$name")
 {
 EOF
 
@@ -574,14 +576,17 @@  tracetostap()
        echo "--binary is required for SystemTAP tapset generator"
        exit 1
     fi
-    if [ -z "$targettype" ]; then
+    if [ -z "$probeprefix" -a -z "$targettype" ]; then
        echo "--target-type is required for SystemTAP tapset generator"
        exit 1
     fi
-    if [ -z "$targetarch" ]; then
+    if [ -z "$probeprefix" -a -z "$targetarch" ]; then
        echo "--target-arch is required for SystemTAP tapset generator"
        exit 1
     fi
+    if [ -z "$probeprefix" ]; then
+	probeprefix="qemu.$targettype.$targetarch";
+    fi
     echo "/* This file is autogenerated by tracetool, do not edit. */"
     convert stap
 }
@@ -592,6 +597,7 @@  output=
 binary=
 targettype=
 targetarch=
+probeprefix=
 
 
 until [ -z "$1" ]
@@ -602,6 +608,7 @@  do
     "--binary") shift ; binary="$1" ;;
     "--target-arch") shift ; targetarch="$1" ;;
     "--target-type") shift ; targettype="$1" ;;
+    "--probe-prefix") shift ; probeprefix="$1" ;;
 
     "-h" | "-c" | "-d") output="${1#-}" ;;
     "--stap") output="${1#--}" ;;