qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v3 1/3] Converting tracetool.sh to tracetool


From: Harsh Bora
Subject: Re: [Qemu-devel] [RFC PATCH v3 1/3] Converting tracetool.sh to tracetool.py
Date: Wed, 11 Jan 2012 14:16:43 +0530
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Thunderbird/3.0.5

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<address@hidden>
---
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








reply via email to

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