blob: 3800152b3c3eb6f8608f6e82280b244ae6d34354 [file] [log] [blame]
mblighb8a14e32006-05-06 00:17:35 +00001import test, pickle
mblighf4c35322006-03-13 01:01:10 +00002from autotest_utils import *
3
apw7a0d5782006-04-21 14:21:17 +00004class kernbench(test.test):
mbligh96aee2a2006-05-03 16:28:26 +00005 version = 1
6
mblighb8a14e32006-05-06 00:17:35 +00007 def setup(self):
8 tarball = '/usr/local/src/linux-2.6.14.tar.bz2'
9 config = self.bindir + "/config"
10 kernel = self.job.kernel(self.srcdir, tarball)
11 kernel.config(config)
12 # have to save this off, as we might use it in another run
13 kernel.pickle_dump(self.srcdir + '/.pickle')
mblighf4c35322006-03-13 01:01:10 +000014
15
mbligh82641862006-04-23 06:21:36 +000016 def execute(self, iterations = 1, threads = 2 * count_cpus()):
mblighb8a14e32006-05-06 00:17:35 +000017 kernel = pickle.load(open(self.srcdir + '/.pickle', 'r'))
mbligh82641862006-04-23 06:21:36 +000018 print "kernbench x %d: %d threads" % (iterations, threads)
19
mblighb8a14e32006-05-06 00:17:35 +000020 kernel.build_timed(threads) # warmup run
mblighf4c35322006-03-13 01:01:10 +000021 for i in range(1, iterations+1):
mblighb8a14e32006-05-06 00:17:35 +000022 logfile = self.resultsdir+'/time.%d' % i
23 kernel.build_timed(threads, logfile)
mblighf4c35322006-03-13 01:01:10 +000024
mbligh72905562006-05-25 01:30:49 +000025 # Do a profiling run if necessary
26 profilers = self.job.profilers
27 if profilers.present():
28 profilers.start(self)
29 logfile = self.resultsdir+'/time.profile'
30 kernel.build_timed(threads, logfile)
31 profilers.stop(self)
32 profilers.report(self)
33
mblighb8a14e32006-05-06 00:17:35 +000034 kernel.clean() # Don't leave litter lying around
35 os.chdir(self.resultsdir)
apwc7846102006-04-06 18:22:13 +000036 system("grep elapsed time.* > time")