public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/6] lib/sched_mc.py: fix path for ebizzy/kernbench benchmark
@ 2015-02-06  8:41 Xing Gu
  2015-02-06  8:41 ` [LTP] [PATCH v2 2/6] power_management: compile and install testcases/kernel/power_management by default Xing Gu
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Xing Gu @ 2015-02-06  8:41 UTC (permalink / raw)
  To: ltp-list

The ebizzy/kernbench benchmark are located in testcase/bin
rather than utils/benchmark directory after installing LTP,
fix this.

Signed-off-by: Xing Gu <gux.fnst@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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-02-24  9:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06  8:41 [LTP] [PATCH v2 1/6] lib/sched_mc.py: fix path for ebizzy/kernbench benchmark Xing Gu
2015-02-06  8:41 ` [LTP] [PATCH v2 2/6] power_management: compile and install testcases/kernel/power_management by default Xing Gu
2015-02-09 14:10   ` Cyril Hrubis
2015-02-06  8:41 ` [LTP] [PATCH v2 3/6] power_management: install lib/sched_mc.py into testcases/bin directory Xing Gu
2015-02-09 14:17   ` Cyril Hrubis
     [not found]     ` <54DC3837.8050300@cn.fujitsu.com>
2015-02-24  9:36       ` Cyril Hrubis
2015-02-06  8:41 ` [LTP] [PATCH v2 4/6] power_management: add uclinux check and move some check Xing Gu
2015-02-09 14:19   ` Cyril Hrubis
2015-02-09 14:22     ` Cyril Hrubis
2015-02-06  8:41 ` [LTP] [PATCH v2 5/6] power_management: cleanup Xing Gu
2015-02-09 14:39   ` Cyril Hrubis
     [not found]     ` <54DC3853.7030203@cn.fujitsu.com>
2015-02-24  9:44       ` Cyril Hrubis
2015-02-06  8:41 ` [LTP] [PATCH v2 6/6] power_management: add it into default Xing Gu
2015-02-09 14:49 ` [LTP] [PATCH v2 1/6] lib/sched_mc.py: fix path for ebizzy/kernbench benchmark Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox