On Tue, 2010-09-14 at 12:53 -0700, David Sharp wrote:
> That seems to be a much better way of doing it, thanks. Couple comments below.
> 
> On Tue, Sep 14, 2010 at 12:03 PM, Lucas Meneghel Rodrigues
> <[email protected]> wrote:
> > ftrace profiler for autotest. It builds ftrace from souce and runs
> > trace-cmd with configurable parameters.
> >
> > Signed-off-by: David Sharp <[email protected]>
> > Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
> > ---
> >  client/profilers/ftrace/control           |    3 +
> >  client/profilers/ftrace/ftrace.py         |  107 
> > +++++++++++++++++++++++++++++
> >  client/profilers/ftrace/trace-cmd.tar.bz2 |  Bin 0 -> 4174301 bytes
> >  3 files changed, 110 insertions(+), 0 deletions(-)
> >  create mode 100644 client/profilers/ftrace/__init__.py
> >  create mode 100644 client/profilers/ftrace/control
> >  create mode 100644 client/profilers/ftrace/ftrace.py
> >  create mode 100644 client/profilers/ftrace/trace-cmd.tar.bz2
> >
> > diff --git a/client/profilers/ftrace/__init__.py 
> > b/client/profilers/ftrace/__init__.py
> > new file mode 100644
> > index 0000000..e69de29
> > diff --git a/client/profilers/ftrace/control 
> > b/client/profilers/ftrace/control
> > new file mode 100644
> > index 0000000..03da793
> > --- /dev/null
> > +++ b/client/profilers/ftrace/control
> > @@ -0,0 +1,3 @@
> > +job.profilers.add('ftrace', tracepoints=['syscalls'])
> > +job.run_test('sleeptest', seconds=1)
> > +job.profilers.delete('ftrace')
> > diff --git a/client/profilers/ftrace/ftrace.py 
> > b/client/profilers/ftrace/ftrace.py
> > new file mode 100644
> > index 0000000..68b0b90
> > --- /dev/null
> > +++ b/client/profilers/ftrace/ftrace.py
> > @@ -0,0 +1,107 @@
> > +"""
> > +Function tracer profiler for autotest.
> > +
> > +...@author: David Sharp ([email protected])
> > +"""
> > +import os, signal, subprocess
> > +from autotest_lib.client.bin import profiler, utils
> > +
> > +
> > +class ftrace(profiler.profiler):
> > +    """
> > +    ftrace profiler for autotest. It builds ftrace from souce and runs
> > +    trace-cmd with configurable parameters.
> > +
> > +    @see: 
> > git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
> > +    """
> > +    version = 1
> > +
> > +    mountpoint = '/sys/kernel/debug'
> > +    tracing_dir = os.path.join(mountpoint, 'tracing')
> > +
> > +    @staticmethod
> > +    def join_command(cmd):
> > +        """
> > +        Shell escape the command for BgJob. grmbl.
> > +
> > +        @param cmd: Command list.
> > +        """
> > +        result = []
> > +        for arg in cmd:
> > +            arg = '"%s"' % utils.sh_escape(arg)
> > +            result += [arg]
> > +        return ' '.join(result)
> > +
> > +
> > +    def setup(self, tarball='trace-cmd.tar.bz2', **kwargs):
> > +        """
> > +        Build and install trace-cmd from source.
> > +
> > +        The tarball was obtained by checking the git repo at 09-14-2010 and
> > +        packaging it.
> > +
> > +        @param tarball: Path to trace-cmd tarball.
> > +        @param **kwargs: Dictionary with additional parameters.
> > +        """
> > +        self.tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
> > +        utils.extract_tarball_to_dir(self.tarball, self.srcdir)
> > +        os.chdir(self.srcdir)
> > +        self.builddir = os.path.join(self.bindir, 'build')
> > +        if not os.path.isdir(self.builddir):
> > +            os.makedirs(self.builddir)
> > +        utils.system("make prefix='%s'" % self.builddir)
> > +        utils.system("make prefix='%s' install" % self.builddir)
> > +        self.trace_cmd = os.path.join(self.builddir, 'bin', 'trace-cmd')
> 
> This won't get set if setup() is not run. self.builddir as well. My
> understanding is that setup is only re-run if the version has changed.
> Is that wrong?

Good catch, you're right. I've fixed that, by moving self.builddir and
self.trace_cmd attributions to the initialize() method. I also moved the
reset command to start() as well. Thank you very much David!

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to