• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1print "I AM KERNBENCH!"
2
3threads = 2 * count_cpus()
4kernelver = autodir + '/src/linux-2.6.14.tar.bz2' # "2.6.7"
5config = autodir + "/bin/tests/kernbench/config"
6iterations = 1
7
8def usage():
9	print "kernbench [-j threads] [-i iterations] [-c config] [-k kernel]"
10
11
12def getopts():
13	try:
14		opts, args = getopt.getopt(argv, "hj:i:c:k:", ["help"])
15	except getopt.GetoptError:
16		usage()
17		sys.exit(2)
18
19	global threads,iterations,config,kernelver
20
21	for o, a in opts:
22		if o == "-j":
23			threads = int(a)
24			if (threads == 0):
25				threads = ""
26		if o == "-i":
27        		iterations = int(a)
28		if o == "-c":
29			config = a
30		if o == "-k":
31			kernelver = a
32		if o in ("-h", "--help"):
33			usage()
34			sys.exit()
35
36
37getopts()
38print "kernbench -j %d -i %d -c %s -k %s" % (threads, iterations, config, kernelver)
39
40top_dir = system.tmpdir+'/kernbench'
41testkernel = kernel.kernel(system, top_dir, kernelver, '', config, None)
42
43testkernel.build_timed(threads)         # warmup run
44for i in range(1, iterations+1):
45	testkernel.build_timed(threads, '../log/time.%d' % i)
46
47os.chdir(top_dir + '/log')
48os.system("grep elapsed time.* > time")
49