* After installing LTP, the ebizzy/kernbench benchmark are located in testcase/bin. Here using utils/benchmark path for searching ebizzy/kernbench outputs "INFO: ebizzy/kernbench benchmark not found" error message. So add the testcase/bin path for benchmark in trigger_ebizzy/trigger_kernbench function.
* Change formatting in trigger_ebizzy/trigger_kernbench function. Signed-off-by: Xing Gu <gux.f...@cn.fujitsu.com> --- testcases/kernel/power_management/lib/sched_mc.py | 138 +++++++++++++--------- 1 file changed, 85 insertions(+), 53 deletions(-) diff --git a/testcases/kernel/power_management/lib/sched_mc.py b/testcases/kernel/power_management/lib/sched_mc.py index cb78b55..24285eb 100755 --- a/testcases/kernel/power_management/lib/sched_mc.py +++ b/testcases/kernel/power_management/lib/sched_mc.py @@ -318,51 +318,67 @@ def trigger_ebizzy (sched_smt, stress, duration, background, pinned): ''' try: threads = get_job_count(stress, "ebizzy", sched_smt) - olddir = os.getcwd() - path = '%s/utils/benchmark' % os.environ['LTPROOT'] - os.chdir(path) - wklds_avlbl = list() workload = "ebizzy" - workload_dir = "" + olddir = os.getcwd() + installdir = '%s/utils/benchmark' % os.environ['LTPROOT'] + if os.path.exists(installdir): + path = '%s/utils/benchmark' % os.environ['LTPROOT'] + os.chdir(path) + wklds_avlbl = list() + workload_dir = "" + + # Use the latest version of similar workload available + for file_name in os.listdir('.'): + if file_name.find(workload) != -1: + wklds_avlbl.append(file_name) - # Use the latest version of similar workload available - for file_name in os.listdir('.'): - if file_name.find(workload) != -1: - wklds_avlbl.append(file_name) - - wklds_avlbl.sort() - workload_dir = wklds_avlbl[len(wklds_avlbl)-1] - if workload_dir != "": - new_path = os.path.join(path,"%s" % workload_dir) - get_proc_data(stats_start) - get_proc_loc_count(intr_start) - try: + wklds_avlbl.sort() + workload_dir = wklds_avlbl[len(wklds_avlbl)-1] + if workload_dir != "": + new_path = os.path.join(path,"%s" % workload_dir) os.chdir(new_path) - if background == "yes": - succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &' - % (threads, duration)) + else: + print "INFO: ebizzy benchmark not found" + sys.exit(1) + else: + path = '%s/testcases/bin' % os.environ['LTPROOT'] + os.chdir(path) + workload_file = "" + for file_name in os.listdir('.'): + if file_name == workload: + workload_file = file_name + break + if workload_file == "": + print "INFO: ebizzy benchmark not found" + sys.exit(1) + get_proc_data(stats_start) + get_proc_loc_count(intr_start) + try: + if background == "yes": + succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &' + % (threads, duration)) + else: + if pinned == "yes": + succ = os.system('taskset -c %s ./ebizzy -t%s -s4096 -S %s >/dev/null' + % (cpu_count -1, threads, duration)) else: - if pinned == "yes": - succ = os.system('taskset -c %s ./ebizzy -t%s -s4096 -S %s >/dev/null' - % (cpu_count -1, threads, duration)) - else: - succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null' - % (threads, duration)) - - if succ == 0: - print "INFO: ebizzy workload triggerd" - os.chdir(olddir) - #Commented bcoz it doesnt make sense to capture it when workload triggered - #in background - #get_proc_loc_count(intr_stop) - #get_proc_data(stats_stop) - else: - print "INFO: ebizzy workload triggerd failed" - os.chdir(olddir) - sys.exit(1) - except Exception, details: - print "Ebizzy workload trigger failed ", details + succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null' + % (threads, duration)) + + if succ == 0: + print "INFO: ebizzy workload triggerd" + os.chdir(olddir) + #Commented bcoz it doesnt make sense to capture it when workload triggered + #in background + #get_proc_loc_count(intr_stop) + #get_proc_data(stats_stop) + else: + print "INFO: ebizzy workload triggerd failed" + os.chdir(olddir) sys.exit(1) + except Exception, details: + print "Ebizzy workload trigger failed ", details + sys.exit(1) except Exception, details: print "Ebizzy workload trigger failed ", details sys.exit(1) @@ -377,22 +393,38 @@ def trigger_kernbench (sched_smt, stress, background, pinned, perf_test): threads = get_job_count(stress, "kernbench", sched_smt) dst_path = "/root" + workload = "kernbench" olddir = os.getcwd() - path = '%s/utils/benchmark' % os.environ['LTPROOT'] - os.chdir(path) - wklds_avlbl = list() - for file_name in os.listdir('.'): - if file_name.find("kernbench") != -1: - wklds_avlbl.append(file_name) - if len(wklds_avlbl): - wklds_avlbl.sort() - workload_dir = wklds_avlbl[len(wklds_avlbl)-1] - if workload_dir != "": - benchmark_path = os.path.join(path,"%s" % workload_dir) + installdir = '%s/utils/benchmark' % os.environ['LTPROOT'] + if os.path.exists(installdir): + path = '%s/utils/benchmark' % os.environ['LTPROOT'] + os.chdir(path) + wklds_avlbl = list() + workload_dir = "" + for file_name in os.listdir('.'): + if file_name.find(workload) != -1: + wklds_avlbl.append(file_name) + if len(wklds_avlbl): + wklds_avlbl.sort() + workload_dir = wklds_avlbl[len(wklds_avlbl)-1] + if workload_dir != "": + benchmark_path = os.path.join(path,"%s" % workload_dir) + else: + print "INFO: kernbench benchmark not found" + sys.exit(1) + else: + path = '%s/testcases/bin' % os.environ['LTPROOT'] + os.chdir(path) + workload_file = "" + for file_name in os.listdir('.'): + if file_name == workload: + workload_file = file_name + break + if workload_file != "": + benchmark_path = path else: print "INFO: kernbench benchmark not found" sys.exit(1) - os.chdir(olddir) os.chdir(dst_path) linux_source_dir="" @@ -405,7 +437,7 @@ def trigger_kernbench (sched_smt, stress, background, pinned, perf_test): else: print "INFO: Linux kernel source not found in /root. Workload\ Kernbench cannot be executed" - sys.exit(1) + sys.exit(1) get_proc_data(stats_start) get_proc_loc_count(intr_start) -- 1.9.3 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list