From: Harsh Bora <harsh@linux.vnet.ibm.com>
To: "Lluís Vilanova" <vilanova@ac.upc.edu>, stefanha@linux.vnet.ibm.com
Cc: aneesh.kumar@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH v3 1/3] Converting tracetool.sh to tracetool.py
Date: Wed, 11 Jan 2012 14:16:43 +0530 [thread overview]
Message-ID: <4F0D4C73.2010006@linux.vnet.ibm.com> (raw)
In-Reply-To: <4F0D2E66.9010401@linux.vnet.ibm.com>
On 01/11/2012 12:08 PM, Harsh Bora wrote:
> On 01/11/2012 04:21 AM, Lluís Vilanova wrote:
>> Harsh Prateek Bora writes:
>>
>>> Signed-off-by: Harsh Prateek Bora<harsh@linux.vnet.ibm.com>
>>> ---
>>> Makefile.objs | 6 +-
>>> Makefile.target | 10 +-
>>> configure | 7 +-
>>> scripts/tracetool | 643
>>> --------------------------------------------------
>>> scripts/tracetool.py | 585 +++++++++++++++++++++++++++++++++++++++++++++
>>> 5 files changed, 597 insertions(+), 654 deletions(-)
>>> delete mode 100755 scripts/tracetool
>>> create mode 100755 scripts/tracetool.py
>>
[...]
>>> +def main():
>>> + global backend, output, binary, targettype, targetarch, probeprefix
>>> + supported_backends = ["simple", "nop", "stderr", "dtrace", "ust"]
>>> + short_options = "hcd"
>>> + long_options = ["stap", "backend=", "binary=", "target-arch=",
>>> "target-type=", "probe-prefix=", "list-backends", "check-backend"]
>>> + try:
>>> + opts, args = getopt.getopt(sys.argv[1:], short_options, long_options)
>>> + except getopt.GetoptError, err:
>>> + # print help information and exit:
>>> + print str(err) # will print something like "option -a not recognized"
>>> + usage()
>>> + sys.exit(2)
>>> + for opt, arg in opts:
>>> + if opt == '-h':
>>> + output = 'h'
>>> + elif opt == '-c':
>>> + output = 'c'
>>> + elif opt == '-d':
>>> + output = 'd'
>>> + elif opt == '--stap':
>>> + output = 'stap'
>>> + elif opt == '--backend':
>>> + backend = arg
>>> + elif opt == '--binary':
>>> + binary = arg
>>> + elif opt == '--target-arch':
>>> + targetarch = arg
>>> + elif opt == '--target-type':
>>> + targettype = arg
>>> + elif opt == '--probe-prefix':
>>> + probeprefix = arg
>>> + elif opt == '--list-backends':
>>> + print 'simple, nop, stderr, dtrace'
>>> + sys.exit(0)
>>> + elif opt == "--check-backend":
>>> + if any(backend in s for s in supported_backends):
>>> + sys.exit(0)
>>> + else:
>>> + sys.exit(1)
>>> + else:
>>> + #assert False, "unhandled option"
>>> + print "unhandled option: ", opt
>>> + usage()
>>> +
>>> + if backend == "" or output == "":
>>> + usage()
>>> + sys.exit(0)
>>> +
>>> + events = read_events(sys.stdin)
>>> + trace_gen[output]['begin']()
>>> + converters[backend][output](events)
>>
>> This should use the "disable" property to establish whether to use
>> output or
>> "nop".
Will it be better to again break converters to their begin,
process_line, end counterparts and call respective converters
accordingly for enabled/disabled events, or let all the backends handle
disabled events on their own ?
Stefan ?
- Harsh
>>
>>> + trace_gen[output]['end']()
>>> + return
>>> +
>>> +if __name__ == "__main__":
>>> + main()
>>> +
>>> --
>>> 1.7.1.1
>>
>> Lluis
>>
>>
>
>
next prev parent reply other threads:[~2012-01-11 8:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 10:59 [Qemu-devel] [RFC PATCH v3 0/3] simpletrace : support var num of args and strings Harsh Prateek Bora
2012-01-10 10:59 ` [Qemu-devel] [RFC PATCH v3 1/3] Converting tracetool.sh to tracetool.py Harsh Prateek Bora
2012-01-10 14:50 ` Stefan Hajnoczi
2012-01-11 6:25 ` Harsh Bora
2012-01-11 10:03 ` Stefan Hajnoczi
2012-01-10 21:45 ` Lluís Vilanova
2012-01-11 17:14 ` Stefan Hajnoczi
2012-01-10 22:51 ` Lluís Vilanova
2012-01-11 6:38 ` Harsh Bora
2012-01-11 8:46 ` Harsh Bora [this message]
2012-01-11 10:50 ` Stefan Hajnoczi
2012-01-12 9:33 ` Stefan Hajnoczi
2012-01-11 10:07 ` Stefan Hajnoczi
2012-01-10 10:59 ` [Qemu-devel] [RFC PATCH v3 2/3] simpletrace-v2: Handle variable number/size of elements per trace record Harsh Prateek Bora
2012-01-10 16:41 ` Stefan Hajnoczi
2012-01-18 9:14 ` Harsh Bora
2012-01-18 10:31 ` Stefan Hajnoczi
2012-01-18 10:41 ` Harsh Bora
2012-01-18 10:52 ` Harsh Bora
2012-01-18 10:59 ` Stefan Hajnoczi
2012-01-18 11:09 ` Harsh Bora
2012-01-10 10:59 ` [Qemu-devel] [RFC PATCH v3 3/3] simpletrace.py: updated log reader script to handle new log format Harsh Prateek Bora
2012-01-11 12:30 ` Stefan Hajnoczi
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=4F0D4C73.2010006@linux.vnet.ibm.com \
--to=harsh@linux.vnet.ibm.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
--cc=vilanova@ac.upc.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.