blob: 178d185cc4b4ef452ba90c0e6f725abb35691bfc [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
mblighb8a14e32006-05-06 00:17:35 +000025 kernel.clean() # Don't leave litter lying around
26 os.chdir(self.resultsdir)
apwc7846102006-04-06 18:22:13 +000027 system("grep elapsed time.* > time")