| OLD | NEW |
| 1 """ | 1 """ |
| 2 Autotest profiler for blktrace | 2 Autotest profiler for blktrace |
| 3 blktrace - generate traces of the i/o traffic on block devices | 3 blktrace - generate traces of the i/o traffic on block devices |
| 4 """ | 4 """ |
| 5 import os | 5 import os |
| 6 from autotest_lib.client.common_lib import error | 6 from autotest_lib.client.common_lib import error |
| 7 from autotest_lib.client.bin import profiler, utils | 7 from autotest_lib.client.bin import profiler, utils |
| 8 | 8 |
| 9 | 9 |
| 10 class blktrace(profiler.profiler): | 10 class blktrace(profiler.profiler): |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 self.gcc_flags = ldflags + ' ' + cflags | 23 self.gcc_flags = ldflags + ' ' + cflags |
| 24 self.device = dargs.get('device', None) | 24 self.device = dargs.get('device', None) |
| 25 | 25 |
| 26 | 26 |
| 27 def setup(self, tarball='blktrace.tar.bz2', **dargs): | 27 def setup(self, tarball='blktrace.tar.bz2', **dargs): |
| 28 # v1.0.1, pulled from git, 2009/06/10 | 28 # v1.0.1, pulled from git, 2009/06/10 |
| 29 # commit 1e09f6e9012826fca69fa07222b7bc53c3e629ee | 29 # commit 1e09f6e9012826fca69fa07222b7bc53c3e629ee |
| 30 self.tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 30 self.tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) |
| 31 utils.extract_tarball_to_dir(self.tarball, self.srcdir) | 31 utils.extract_tarball_to_dir(self.tarball, self.srcdir) |
| 32 os.chdir(self.srcdir) | 32 os.chdir(self.srcdir) |
| 33 utils.system('make ' + '"CFLAGS=' + self.gcc_flags + '"') | 33 utils.make('"CFLAGS=' + self.gcc_flags + '"') |
| 34 | 34 |
| 35 | 35 |
| 36 def get_device(self, test): | 36 def get_device(self, test): |
| 37 if getattr(test, 'device', None): | 37 if getattr(test, 'device', None): |
| 38 device = test.device | 38 device = test.device |
| 39 else: | 39 else: |
| 40 if self.device: | 40 if self.device: |
| 41 device=self.device | 41 device=self.device |
| 42 else: | 42 else: |
| 43 raise error.TestWarn('No device specified for blktrace') | 43 raise error.TestWarn('No device specified for blktrace') |
| (...skipping 14 matching lines...) Expand all Loading... |
| 58 utils.nuke_subprocess(self.blktrace_job.sp) | 58 utils.nuke_subprocess(self.blktrace_job.sp) |
| 59 self.blktrace_job = None | 59 self.blktrace_job = None |
| 60 | 60 |
| 61 | 61 |
| 62 def report(self, test): | 62 def report(self, test): |
| 63 output_file = os.path.join(test.profdir, 'blktrace') | 63 output_file = os.path.join(test.profdir, 'blktrace') |
| 64 if getattr(test, 'profile_tag', None): | 64 if getattr(test, 'profile_tag', None): |
| 65 output_file += '.' + test.profile_tag | 65 output_file += '.' + test.profile_tag |
| 66 device = self.get_device(test) | 66 device = self.get_device(test) |
| 67 utils.system('%s %s > %s' % (self.blkparse, device, output_file)) | 67 utils.system('%s %s > %s' % (self.blkparse, device, output_file)) |
| OLD | NEW |