qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 4/4] trace: add ability to do simple printf l


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 4/4] trace: add ability to do simple printf logging via systemtap
Date: Tue, 22 Jan 2019 11:42:31 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0

On 1/22/19 10:49 AM, Daniel P. Berrangé wrote:
> The dtrace systemtap trace backend for QEMU is very powerful but it is
> also somewhat unfriendly to users who aren't familiar with systemtap,
> or who don't need its power right now.
> 
>   stap -e "....some strange script...."
> 

> By default it monitors all existing running processes and all future
> launched proceses. This can be restricted to a specific PID using the
> --pid arg
> 
>  $ qemu-trace-stap run --pid 2532 qemu-system-x86_64 'qio*'
> 

Can --pid mode be smart enough to check /proc/NNN/exe without the user
having to specify the explicit qemu-system-x86_64 argument?  (Could be
followup patch)

> +++ b/scripts/qemu-trace-stap
> @@ -0,0 +1,174 @@

> +#  QEMU SystemTap Trace Tool
> +#
> +#  This program is free software; you can redistribute it and/or modify
> +#  it under the terms of the GNU General Public License as published by
> +#  the Free Software Foundation; under version 2 of the License.
> +#

Why GPLv2-only?

> +def main():
> +    parser = argparse.ArgumentParser(description="QEMU SystemTap trace tool")
> +    parser.add_argument("-v", "--verbose", help="Print verbose progress 
> info",
> +                        action='store_true')
> +
> +    subparser = parser.add_subparsers(help="commands")
> +    subparser.required = True
> +    subparser.dest = "command"
> +
> +    runparser = subparser.add_parser("run", help="Run a trace session",
> +                                     
> formatter_class=argparse.RawDescriptionHelpFormatter,
> +                                     epilog="""
> +
> +To watch all trace points on the qemu-system-x86_64 binary:
> +
> +   %(argv0)s run qemu-system-x86_64
> +
> +To only watch the trace points matching the qio* and qcrypto* patterns
> +
> +   %(argv0)s run qemu-system-x86_64 'qio*' 'qcrypto*'
> +""" % {"argv0": sys.argv[0]})
> +    runparser.set_defaults(func=cmd_run)
> +    runparser.add_argument("--pid", "-p", dest="pid",
> +                           help="Restrict tracing to a specific process ID")
> +    runparser.add_argument("binary", help="QEMU system or user emulator 
> binary")
> +    runparser.add_argument("probes", help="Probe names or wildcards",
> +                           nargs=argparse.REMAINDER)
> +
> +    listparser = subparser.add_parser("list", help="List probe points",
> +                                      
> formatter_class=argparse.RawDescriptionHelpFormatter,
> +                                      epilog="""
> +
> +To list all trace points on the qemu-system-x86_64 binary:
> +
> +   %(argv0)s list qemu-system-x86_64

No mention of --pid mode in the --help output?

> +++ b/scripts/qemu-trace-stap.texi
> @@ -0,0 +1,139 @@
> address@hidden
> address@hidden man begin SYNOPSIS
> address@hidden @var{GLOBAL-OPTIONS} @var{COMMAND} @var{COMMAND-OPTIONS} 
> @var{ARGS...}
> address@hidden man end
> address@hidden example
> +
> address@hidden man begin DESCRIPTION
> +
> +The @command{qemu-trace-stap} program facilitates tracing of the execution
> +of QEMU emulators using SystemTap.
> +
> +It is required to have the SystemTap runtime environment installed to use
> +this program, since it is a wrapper around execution of the @command{stap}
> +program.
> +
> address@hidden man end
> +
> address@hidden man begin OPTIONS
> +
> +The following global options may be used regardless of which command
> +is executed
> +

Could use trailing ':'

> address@hidden @option
> address@hidden @var{--verbose}, @var{-v}
> +
> +Display verbose information about command execution

Trailing '.'


> address@hidden @var{run} @var{OPTIONS} @var{BINARY} @var{PATTERN...}
> +
> +Run a trace session, printing formatted output any time a process that is
> +executing @var{BINARY} triggers a probe matching @var{PATTERN}.
> +
> +If @var{BINARY} is not an absolute path, it will be located by searching
> +the directories listed in the @code{$PATH} environment variable.
> +
> address@hidden is a plain string that matches a probe name shown by the
> address@hidden command. It may optionally contain a @code{*} wildcard to
> +facilitate matching multiple probes without listing each one explicitly.
> +Multiple @var{PATTERN} arguments may be given, causing all matching probes
> +to be monitored. At least one @var{PATTERN} is required, since stap is not
> +capable of tracing all known QEMU probes concurrently without overflowing
> +its trace buffer.
> +
> +Invokation of this command does not need to be synchronized with

s/Invokation/Invocation/

> +invokation of the QEMU process(es). It will match probes on all

and again

> +existing running processes and all future launched processes,
> +unless told to only monitor a specific procss.

s/procss/process/

> +
> +Valid command specific options are:
> +
> address@hidden @option
> address@hidden @var{--pid=PID}, @var{-p PID}
> +
> +Restrict the tracing session so that it only triggers for the process
> +identified by @code{PID}.
> +
> address@hidden table
> +
> +For example, to monitor all processes executing @command{qemu-system-x86_64},

Maybe "executing @command{qemu-system-x86_64} as found on $PATH,"


> address@hidden qemu-trace-stap
> address@hidden QEMU SystemTap trace tool
> +
> address@hidden man begin LICENSE
> +
> +Copyright (C) 2018 Red Hat, Inc.

Welcome to 2019

> +
> +This program is free software; you can redistribute it and/or modify
> +it under the terms of the GNU General Public License as published by
> +the Free Software Foundation; under version 2 of the License.

Why GPLv2-only?

> +
> address@hidden man end
> +
> address@hidden man begin SEEALSO
> +qemu(1), stap(1)
> address@hidden man end
> +
> address@hidden ignore
> diff --git a/scripts/tracetool/format/log_stap.py 
> b/scripts/tracetool/format/log_stap.py
> new file mode 100644
> index 0000000000..3ccbc09d61
> --- /dev/null
> +++ b/scripts/tracetool/format/log_stap.py
> @@ -0,0 +1,127 @@
> +#!/usr/bin/env python
> +# -*- coding: utf-8 -*-
> +
> +"""
> +Generate .stp file that printfs log messages (DTrace with SystemTAP only).
> +"""
> +
> +__author__     = "Daniel P. Berrange <address@hidden>"
> +__copyright__  = "Copyright (C) 2014-2019, Red Hat, Inc."
> +__license__    = "GPL version 2 or (at your option) any later version"

At least this file is GPLv2+.

Typos are trivial, licensing less so, but I trust you can fix licensing
without me having to see a respin (as it won't change code).  So:
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]