OLD | NEW |
1 import os | 1 import os |
2 from autotest_lib.client.bin import test, utils | 2 from autotest_lib.client.bin import test, utils |
3 | 3 |
4 | 4 |
5 class stress(test.test): | 5 class stress(test.test): |
6 """ | 6 """ |
7 Calls stress, a simple program which aims to impose certain types of | 7 Calls stress, a simple program which aims to impose certain types of |
8 computing stress on the target machine. | 8 computing stress on the target machine. |
9 @author: Yi Yang (yang.y.yi@gmail.com) | 9 @author: Yi Yang (yang.y.yi@gmail.com) |
10 | 10 |
11 In order to verify at a glance the options supported by the program stress, | 11 In order to verify at a glance the options supported by the program stress, |
12 check out the options summary located at the stress example control file. | 12 check out the options summary located at the stress example control file. |
13 """ | 13 """ |
14 version = 1 | 14 version = 1 |
15 | 15 |
16 def initialize(self): | 16 def initialize(self): |
17 self.job.require_gcc() | 17 self.job.require_gcc() |
18 | 18 |
19 | 19 |
20 # http://weather.ou.edu/~apw/projects/stress/stress-1.0.0.tar.gz | 20 # http://weather.ou.edu/~apw/projects/stress/stress-1.0.0.tar.gz |
21 def setup(self, tarball = 'stress-1.0.0.tar.gz'): | 21 def setup(self, tarball = 'stress-1.0.0.tar.gz'): |
22 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 22 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) |
23 utils.extract_tarball_to_dir(tarball, self.srcdir) | 23 utils.extract_tarball_to_dir(tarball, self.srcdir) |
24 os.chdir(self.srcdir) | 24 os.chdir(self.srcdir) |
25 | 25 |
26 utils.configure() | 26 utils.system('./configure') |
27 utils.make() | 27 utils.system('make') |
28 | 28 |
29 | 29 |
30 def run_once(self, args = '', stress_length=60): | 30 def run_once(self, args = '', stress_length=60): |
31 if not args: | 31 if not args: |
32 # We will use 2 workers of each type for each CPU detected | 32 # We will use 2 workers of each type for each CPU detected |
33 threads = 2 * utils.count_cpus() | 33 threads = 2 * utils.count_cpus() |
34 | 34 |
35 # Sometimes the default memory used by each memory worker (256 M) | 35 # Sometimes the default memory used by each memory worker (256 M) |
36 # might make our machine go OOM and then funny things might start to | 36 # might make our machine go OOM and then funny things might start to |
37 # happen. Let's avoid that. | 37 # happen. Let's avoid that. |
(...skipping 19 matching lines...) Expand all Loading... |
57 # Number of HD workers spinning on write()/ulink() | 57 # Number of HD workers spinning on write()/ulink() |
58 args += '--hdd %d ' % threads | 58 args += '--hdd %d ' % threads |
59 # Size of the files created by each worker in bytes | 59 # Size of the files created by each worker in bytes |
60 args += '--hdd-bytes %d ' % file_size_per_thread | 60 args += '--hdd-bytes %d ' % file_size_per_thread |
61 # Time for which the stress test will run | 61 # Time for which the stress test will run |
62 args += '--timeout %d ' % stress_length | 62 args += '--timeout %d ' % stress_length |
63 # Verbose flag | 63 # Verbose flag |
64 args += '--verbose' | 64 args += '--verbose' |
65 | 65 |
66 utils.system(self.srcdir + '/src/stress ' + args) | 66 utils.system(self.srcdir + '/src/stress ' + args) |
OLD | NEW |