OLD | NEW |
1 """ | 1 """ |
2 readprofile - a tool to read kernel profiling information | 2 readprofile - a tool to read kernel profiling information |
3 | 3 |
4 The readprofile command uses the /proc/profile information to print ascii data | 4 The readprofile command uses the /proc/profile information to print ascii data |
5 on standard output. The output is organized in three columns: the first is the | 5 on standard output. The output is organized in three columns: the first is the |
6 number of clock ticks, the second is the name of the C function in the kernel | 6 number of clock ticks, the second is the name of the C function in the kernel |
7 where those many ticks occurred, and the third is the normalized `load' of the | 7 where those many ticks occurred, and the third is the normalized `load' of the |
8 procedure, calculated as a ratio between the number of ticks and the length of | 8 procedure, calculated as a ratio between the number of ticks and the length of |
9 the procedure. The output is filled with blanks to ease readability. | 9 the procedure. The output is filled with blanks to ease readability. |
10 """ | 10 """ |
11 import os, shutil | 11 import os, shutil |
12 from autotest_lib.client.bin import utils, profiler | 12 from autotest_lib.client.bin import utils, profiler |
13 from autotest_lib.client.common_lib import error | 13 from autotest_lib.client.common_lib import error |
14 | 14 |
15 class readprofile(profiler.profiler): | 15 class readprofile(profiler.profiler): |
16 version = 1 | 16 version = 1 |
17 | 17 |
18 # http://www.kernel.org/pub/linux/utils/util-linux/util-linux-2.12r.tar.bz2 | 18 # http://www.kernel.org/pub/linux/utils/util-linux/util-linux-2.12r.tar.bz2 |
19 def setup(self, tarball = 'util-linux-2.12r.tar.bz2'): | 19 def setup(self, tarball = 'util-linux-2.12r.tar.bz2'): |
20 self.tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 20 self.tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) |
21 utils.extract_tarball_to_dir(self.tarball, self.srcdir) | 21 utils.extract_tarball_to_dir(self.tarball, self.srcdir) |
22 os.chdir(self.srcdir) | 22 os.chdir(self.srcdir) |
23 | 23 |
24 utils.configure() | 24 utils.system('./configure') |
25 os.chdir('sys-utils') | 25 os.chdir('sys-utils') |
26 utils.make('readprofile') | 26 utils.system('make readprofile') |
27 | 27 |
28 | 28 |
29 def initialize(self): | 29 def initialize(self): |
30 self.job.require_gcc() | 30 self.job.require_gcc() |
31 | 31 |
32 try: | 32 try: |
33 utils.system('grep -iq " profile=" /proc/cmdline') | 33 utils.system('grep -iq " profile=" /proc/cmdline') |
34 except error.CmdError: | 34 except error.CmdError: |
35 raise error.AutotestError('readprofile not enabled') | 35 raise error.AutotestError('readprofile not enabled') |
36 | 36 |
(...skipping 13 matching lines...) Expand all Loading... |
50 | 50 |
51 | 51 |
52 def report(self, test): | 52 def report(self, test): |
53 args = ' -n' | 53 args = ' -n' |
54 args += ' -m ' + utils.get_systemmap() | 54 args += ' -m ' + utils.get_systemmap() |
55 args += ' -p ' + self.rawprofile | 55 args += ' -p ' + self.rawprofile |
56 cmd = self.cmd + ' ' + args | 56 cmd = self.cmd + ' ' + args |
57 txtprofile = test.profdir + '/profile.text' | 57 txtprofile = test.profdir + '/profile.text' |
58 utils.system(cmd + ' | sort -nr > ' + txtprofile) | 58 utils.system(cmd + ' | sort -nr > ' + txtprofile) |
59 utils.system('bzip2 ' + self.rawprofile) | 59 utils.system('bzip2 ' + self.rawprofile) |
OLD | NEW |