Home | History | Annotate | Download | only in kernbench
      1 print "I AM KERNBENCH!"
      2 
      3 threads = 2 * count_cpus()
      4 kernelver = autodir + '/src/linux-2.6.14.tar.bz2' # "2.6.7"
      5 config = autodir + "/bin/tests/kernbench/config"
      6 iterations = 1	
      7 	
      8 def usage():
      9 	print "kernbench [-j threads] [-i iterations] [-c config] [-k kernel]"
     10 
     11 
     12 def 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 
     37 getopts()
     38 print "kernbench -j %d -i %d -c %s -k %s" % (threads, iterations, config, kernelver)
     39 
     40 top_dir = system.tmpdir+'/kernbench'
     41 testkernel = kernel.kernel(system, top_dir, kernelver, '', config, None)
     42 
     43 testkernel.build_timed(threads)         # warmup run
     44 for i in range(1, iterations+1):
     45 	testkernel.build_timed(threads, '../log/time.%d' % i)
     46 
     47 os.chdir(top_dir + '/log')
     48 os.system("grep elapsed time.* > time")
     49