qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 10/12] trace: [tracetool] Automatically establis


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 10/12] trace: [tracetool] Automatically establish available backends and formats
Date: Thu, 22 Mar 2012 08:07:53 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Mar 21, 2012 at 03:10:49PM +0100, Lluís Vilanova wrote:
> Stefan Hajnoczi writes:
> [...]
> >> Maybe this would work nice for everybody:
> >> 
> >> tracetool.py                  # main program (just parse cmdline opts and 
> >> call tracetool module)
> >> tracetool/__init__.py         # common boilerplate code (e.g., event 
> >> parsing and call dispatching)
> >> tracetool/format/__init__.py  # format auto-registration/lookup code
> >> tracetool/format/h.py         # code for the 'h' format
> >>                              # __doc__           [mandatory, format 
> >> description]
> >>                              # def begin(events) [optional]
> >>                              # def end(events)   [optional]
> >> tracetool/backend/__init__.py # backend auto-registration/lookup code
> >> tracetool/backend/simple.py   # code for the 'simple' backend
> >>                              # __doc__            [mandatory, backend 
> >> description]
> >>                              # PUBLIC = [True|False] [optional,
> >>                              #                        defaults to False,
> >>                              #                        indicates it's 
> >> listed on --list-backends]
> >>                              # def format(events) [optional,
> >>                              #                     backend-specific code 
> >> for given format,
> >>                              #                     implicitly indicates 
> >> format compatibility]
> 
> > Let's call this function backend.generate(events) instead of "format"
> > since we already use that term and it's a Python builtin too.  This is
> > a code generation function.
> 
> Maybe I wasn't clear. I meant that for tracetool/backend/simple.py to work 
> with
> the format 'h', it must have the following routine:
> 
>     def h (events):
>         ...
> 
> That is, there must exist a routine with the same name of the format (with '-'
> replaced with '_', when necessary) for the backend to be compatible with that
> format.

Ah, yes.  That makes sense, I misunderstood.

Stefan



reply via email to

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