print "I AM KERNBENCH!" threads = 2 * count_cpus() kernelver = autodir + '/src/linux-2.6.14.tar.bz2' # "2.6.7" config = autodir + "/bin/tests/kernbench/config" iterations = 1 def usage(): print "kernbench [-j threads] [-i iterations] [-c config] [-k kernel]" def getopts(): try: opts, args = getopt.getopt(argv, "hj:i:c:k:", ["help"]) except getopt.GetoptError: usage() sys.exit(2) global threads,iterations,config,kernelver for o, a in opts: if o == "-j": threads = int(a) if (threads == 0): threads = "" if o == "-i": iterations = int(a) if o == "-c": config = a if o == "-k": kernelver = a if o in ("-h", "--help"): usage() sys.exit() getopts() print "kernbench -j %d -i %d -c %s -k %s" % (threads, iterations, config, kernelver) top_dir = system.tmpdir+'/kernbench' testkernel = kernel.kernel(system, top_dir, kernelver, '', config, None) testkernel.build_timed(threads) # warmup run for i in range(1, iterations+1): testkernel.build_timed(threads, '../log/time.%d' % i) os.chdir(top_dir + '/log') os.system("grep elapsed time.* > time")