diff options
Diffstat (limited to 'client/bin/profilers.py')
-rwxr-xr-x | client/bin/profilers.py | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/client/bin/profilers.py b/client/bin/profilers.py index c0800219..298cba95 100755 --- a/client/bin/profilers.py +++ b/client/bin/profilers.py @@ -4,71 +4,71 @@ from autotest_lib.client.common_lib import error, utils class profilers: - def __init__(self, job): - self.job = job - self.list = [] - self.profdir = job.autodir + '/profilers' - self.tmpdir = job.tmpdir - self.profile_run_only = False + def __init__(self, job): + self.job = job + self.list = [] + self.profdir = job.autodir + '/profilers' + self.tmpdir = job.tmpdir + self.profile_run_only = False - # add a profiler - def add(self, profiler, *args, **dargs): - try: - sys.path.insert(0, self.job.profdir + '/' + profiler) - exec 'import ' + profiler - exec 'newprofiler = %s.%s(self)' % (profiler, profiler) - finally: - sys.path.pop(0) - newprofiler.name = profiler - newprofiler.bindir = self.profdir + '/' + profiler - newprofiler.srcdir = newprofiler.bindir + '/src' - newprofiler.tmpdir = self.tmpdir + '/' + profiler - utils.update_version(newprofiler.srcdir, newprofiler.preserve_srcdir, - newprofiler.version, newprofiler.setup, - *args, **dargs) - newprofiler.initialize(*args, **dargs) - self.list.append(newprofiler) + # add a profiler + def add(self, profiler, *args, **dargs): + try: + sys.path.insert(0, self.job.profdir + '/' + profiler) + exec 'import ' + profiler + exec 'newprofiler = %s.%s(self)' % (profiler, profiler) + finally: + sys.path.pop(0) + newprofiler.name = profiler + newprofiler.bindir = self.profdir + '/' + profiler + newprofiler.srcdir = newprofiler.bindir + '/src' + newprofiler.tmpdir = self.tmpdir + '/' + profiler + utils.update_version(newprofiler.srcdir, newprofiler.preserve_srcdir, + newprofiler.version, newprofiler.setup, + *args, **dargs) + newprofiler.initialize(*args, **dargs) + self.list.append(newprofiler) - # remove a profiler - def delete(self, profiler): - nukeme = None - for p in self.list: - if (p.name == profiler): - nukeme = p - self.list.remove(p) + # remove a profiler + def delete(self, profiler): + nukeme = None + for p in self.list: + if (p.name == profiler): + nukeme = p + self.list.remove(p) - # are any profilers enabled ? - def present(self): - if self.list: - return 1 - else: - return 0 + # are any profilers enabled ? + def present(self): + if self.list: + return 1 + else: + return 0 - # Returns True if job is supposed to be run only with profiling turned - # on, False otherwise - def only(self): - return self.profile_run_only + # Returns True if job is supposed to be run only with profiling turned + # on, False otherwise + def only(self): + return self.profile_run_only - # Changes the flag which determines whether or not the job is to be - # run without profilers at all - def set_only(self, value): - self.profile_run_only = value + # Changes the flag which determines whether or not the job is to be + # run without profilers at all + def set_only(self, value): + self.profile_run_only = value - # Start all enabled profilers - def start(self, test): - for p in self.list: - p.start(test) + # Start all enabled profilers + def start(self, test): + for p in self.list: + p.start(test) - # Stop all enabled profilers - def stop(self, test): - for p in self.list: - p.stop(test) + # Stop all enabled profilers + def stop(self, test): + for p in self.list: + p.stop(test) - # Report on all enabled profilers - def report(self, test): - for p in self.list: - p.report(test) + # Report on all enabled profilers + def report(self, test): + for p in self.list: + p.report(test) |