blob: 6d16fcd1c683546fe9a234596c31ff7b980a2d10 [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):
mbligh4f6243c2006-08-29 06:15:15 +00008 # http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.bz2
9 tarball = self.bindir + '/linux-2.6.14.tar.bz2'
mblighb8a14e32006-05-06 00:17:35 +000010 config = self.bindir + "/config"
11 kernel = self.job.kernel(self.srcdir, tarball)
12 kernel.config(config)
13 # have to save this off, as we might use it in another run
14 kernel.pickle_dump(self.srcdir + '/.pickle')
mblighf4c35322006-03-13 01:01:10 +000015
16
mbligh82641862006-04-23 06:21:36 +000017 def execute(self, iterations = 1, threads = 2 * count_cpus()):
mblighb8a14e32006-05-06 00:17:35 +000018 kernel = pickle.load(open(self.srcdir + '/.pickle', 'r'))
mbligh82641862006-04-23 06:21:36 +000019 print "kernbench x %d: %d threads" % (iterations, threads)
20
mblighb8a14e32006-05-06 00:17:35 +000021 kernel.build_timed(threads) # warmup run
mblighf4c35322006-03-13 01:01:10 +000022 for i in range(1, iterations+1):
mblighb8a14e32006-05-06 00:17:35 +000023 logfile = self.resultsdir+'/time.%d' % i
24 kernel.build_timed(threads, logfile)
mblighf4c35322006-03-13 01:01:10 +000025
mbligh72905562006-05-25 01:30:49 +000026 # Do a profiling run if necessary
27 profilers = self.job.profilers
28 if profilers.present():
29 profilers.start(self)
30 logfile = self.resultsdir+'/time.profile'
31 kernel.build_timed(threads, logfile)
32 profilers.stop(self)
33 profilers.report(self)
34
mblighb8a14e32006-05-06 00:17:35 +000035 kernel.clean() # Don't leave litter lying around
36 os.chdir(self.resultsdir)
apwc7846102006-04-06 18:22:13 +000037 system("grep elapsed time.* > time")