From: Poornima Nayak <mpnayak@linux.vnet.ibm.com>
To: ltp-list@lists.sourceforge.net, arun@linux.vnet.ibm.com,
svaidy@linux.vnet.ibm.com, ego@in.ibm.com
Subject: [LTP] [Patch 4/8] Addional new reusable functions for ILB testing
Date: Fri, 28 Aug 2009 15:45:05 +0530 [thread overview]
Message-ID: <20090828101505.12177.78037.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090828101440.12177.32012.sendpatchset@localhost.localdomain>
Developed new functions to support ILB test execution and result verification.
Minimal changes has been done for exisitng function to support ILB
test execution.
Signed-off-by: poornima nayak <mpnayak@linux.vnet.ibm.com>
diff -uprN ltp_orig/testcases/kernel/power_management/lib/sched_mc.py ltp/testcases/kernel/power_management/lib/sched_mc.py
--- ltp_orig/testcases/kernel/power_management/lib/sched_mc.py 2009-08-28 10:54:59.000000000 +0530
+++ ltp/testcases/kernel/power_management/lib/sched_mc.py 2009-08-28 12:24:55.000000000 +0530
@@ -15,8 +15,12 @@ cpu_map = {}
stats_start = {}
stats_stop = {}
stats_percentage = {}
+intr_start = []
+intr_stop = []
cpu_count = 0
socket_count = 0
+cpu1_max_intr = 0
+cpu2_max_intr = 0
def clear_dmesg():
'''
@@ -162,6 +166,23 @@ def get_proc_data(stats_list):
print "Could not read statistics", e
sys.exit(1)
+def get_proc_loc_count(loc_stats):
+ ''' Read /proc/stat info and store in dictionary
+ '''
+ try:
+ file_procstat = open("/proc/interrupts", 'r')
+ for line in file_procstat:
+ if line.startswith('LOC:'):
+ data = line.split()
+ for i in range(0, cpu_count):
+ # To skip LOC
+ loc_stats.append(data[i+1])
+ file_procstat.close()
+ except Exception, details:
+ print "Could not read interrupt statistics", details
+ sys.exit(1)
+
+
def set_sched_mc_power(sched_mc_level):
''' Routine to set sched_mc_power_savings to required level
'''
@@ -184,7 +205,23 @@ def set_sched_smt_power(sched_smt_level)
print "Could not set sched_smt_power_savings to", sched_smt_level, e
sys.exit(1)
-def trigger_ebizzy (stress, duration, background):
+def set_timer_migration_interface(value):
+ ''' Set value of timer migration interface to a value
+ passed as argument
+ '''
+ try:
+ os.system('echo %s > \
+ /proc/sys/kernel/timer_migration 2>/dev/null' % value)
+ except OSError, e:
+ print "Could not set timer_migration to ", value, e
+ sys.exit(1)
+
+def start_cyclictest():
+ ''' Trigger cyclictest in background to increase
+ timer interrupts
+ '''
+
+def trigger_ebizzy (stress, duration, background, pinned):
''' Triggers ebizzy workload for sched_mc=1
testing
'''
@@ -197,6 +234,9 @@ def trigger_ebizzy (stress, duration, ba
threads = threads / get_hyper_thread_count()
if stress == "full":
threads = cpu_count
+ if stress == "single_job":
+ threads = 1
+ duration = 180
olddir = os.getcwd()
path = '%s/utils/benchmark' % os.environ['LTPROOT']
@@ -220,7 +260,10 @@ def trigger_ebizzy (stress, duration, ba
if background == "yes":
succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null &' % (threads, duration))
else:
- succ = os.system('./ebizzy -t%s -s4096 -S %s >/dev/null' % (threads, duration))
+ 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"
@@ -238,7 +281,7 @@ def trigger_ebizzy (stress, duration, ba
print "Ebizzy workload trigger failed ", details
sys.exit(1)
-def trigger_kernbench (stress, background):
+def trigger_kernbench (stress, background, pinned):
''' Trigger load on system like kernbench.
Copys existing copy of LTP into as LTP2 and then builds it
with make -j
@@ -253,6 +296,8 @@ def trigger_kernbench (stress, backgroun
threads = threads / get_hyper_thread_count()
if stress == "full":
threads = cpu_count
+ if stress == "single_job":
+ threads = 1
dst_path = "/root"
olddir = os.getcwd()
@@ -283,27 +328,31 @@ def trigger_kernbench (stress, backgroun
else:
print "INFO: Linux kernel source not found. Kernbench cannot be executed"
sys.exit(1)
-
+
get_proc_data(stats_start)
- os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' % (benchmark_path, threads))
- print threads
+ get_proc_loc_count(intr_start)
+ if pinned == "yes":
+ os.system ( 'taskset -c %s %s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' % (cpu_count-1, benchmark_path, threads))
+ else:
+ os.system ( '%s/kernbench -o %s -M -H -n 1 >/dev/null 2>&1' % (benchmark_path, threads))
print "INFO: Workload kernbench triggerd"
os.chdir(olddir)
get_proc_data(stats_stop)
+ get_proc_loc_count(intr_stop)
except Exception, details:
- print "Workload trigger kernbench failed ", details
+ print "Workload kernbench trigger failed ", details
sys.exit(1)
-def trigger_workld(workload, stress, duration, background):
+def trigger_workld(workload, stress, duration, background, pinned):
''' Triggers workload passed as argument. Number of threads
triggered is based on stress value.
'''
try:
if workload == "ebizzy":
- trigger_ebizzy (stress, duration, background)
+ trigger_ebizzy (stress, duration, background, pinned)
if workload == "kernbench":
- trigger_kernbench (stress, background)
+ trigger_kernbench (stress, background, pinned)
except Exception, details:
print "INFO: Trigger workload failed", details
sys.exit(1)
@@ -386,6 +435,22 @@ def generate_report():
print >> keyvalfile
keyvalfile.close()
+def generate_loc_intr_report():
+ ''' Generate interrupt report of CPU's
+ '''
+ if (not os.path.exists('/procstat')):
+ os.mkdir('/procstat')
+
+ reportfile = open('/procstat/cpu-loc_interrupts', 'a')
+ print >> reportfile, "=============================================================="
+ print >> reportfile, " Local timer interrupt stats "
+ print >> reportfile, "=============================================================="
+ for i in range(0, cpu_count):
+ intr_stop[i] = int(intr_stop[i]) - int(intr_start[i])
+ print >> reportfile, "CPU%s: %s" %(i, intr_stop[i])
+ print >> reportfile
+ reportfile.close()
+
def expand_range(range_val):
'''
Expand the range of value into actual numbers
@@ -462,6 +527,7 @@ def validate_cpugrp_map(cpu_group, sched
pkg_cpus = cpu_map[pkg]
if pkg_cpus == cpu_group:
return(0)
+
return(1)
except Exception, details:
print "Exception in validate_cpugrp_map: ", details
@@ -540,6 +606,53 @@ def validate_cpu_consolidation(work_ld,
print "Exception in validate_cpu_consolidation: ", details
sys.exit(1)
+def get_cpuid_max_intr_count():
+ '''Return the cpu id's of two cpu's with highest number of intr'''
+ try:
+ highest = 0
+ second_highest = 0
+ global cpu1_max_intr, cpu2_max_intr
+ #Skipping CPU0 as it is generally high
+ for i in range(1, cpu_count):
+ if int(intr_stop[i]) > int(highest):
+ if highest != 0:
+ second_highest = highest
+ cpu2_max_intr = cpu1_max_intr
+ highest = int(intr_stop[i])
+ cpu1_max_intr = i
+ else:
+ if int(intr_stop[i]) > int(second_highest):
+ second_highest = int(intr_stop[i])
+ cpu2_max_intr = i
+ for i in range(1, cpu_count):
+ if i != cpu1_max_intr and i != cpu2_max_intr:
+ diff = second_highest - intr_stop[i]
+ ''' Threshold of difference has to be manipulated with multiple test'''
+ if diff < 10000:
+ print "INFO: Difference in interrupt count is below threshold"
+ return 1
+ print "INFO: Interrupt count in other CPU's low as expected"
+ return 0
+ except Exception, details:
+ print "Exception in get_cpuid_max_intr_count: ", details
+ sys.exit(1)
+
+def validate_ilb (sched_mc_level, sched_smt_level):
+ ''' Validate if ilb is running in same package where work load is running
+ '''
+ try:
+ status = get_cpuid_max_intr_count()
+ if status == 1:
+ return 1
+ for pkg in sorted(cpu_map.keys()):
+ if cpu1_max_intr in cpu_map[pkg] and cpu2_max_intr in cpu_map[pkg]:
+ return 0
+ print "INFO: CPUs with higher interrupt count is not in same package"
+ return 1
+ except Exception, details:
+ print "Exception in validate_ilb: ", details
+ sys.exit(1)
+
def reset_schedmc():
''' Routine to reset sched_mc_power_savings to Zero level
'''
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2009-08-28 10:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-28 10:14 [LTP] [Patch 1/8] New testcase to validate Ideal Load Balancer Functionality Poornima Nayak
2009-08-28 10:14 ` [LTP] [Patch 2/8] Power management master script modified to integrate ILB testcase Poornima Nayak
2009-08-30 17:36 ` Subrata Modak
2009-08-28 10:14 ` [LTP] [Patch 3/8] Patch to integrate ILB testcase to LTP Poornima Nayak
2009-08-30 17:36 ` Subrata Modak
2009-08-28 10:15 ` Poornima Nayak [this message]
2009-08-30 17:36 ` [LTP] [Patch 4/8] Addional new reusable functions for ILB testing Subrata Modak
2009-08-28 10:15 ` [LTP] [Patch 5/8] Modified library functions based on review comments Poornima Nayak
2009-08-30 17:36 ` Subrata Modak
2009-08-28 10:15 ` [LTP] [Patch 6/8] Included new function to check feature versus kernel version Poornima Nayak
2009-08-30 17:36 ` Subrata Modak
2009-08-28 10:15 ` [LTP] [Patch 7/8] Patch for cpu_consolidation to incorporate changes in reusable function Poornima Nayak
2009-08-30 17:36 ` Subrata Modak
2009-08-28 10:15 ` [LTP] [Patch 8/8]Patch to modify Readme file as new functionality testcase is integrated Poornima Nayak
2009-08-30 17:37 ` Subrata Modak
2009-08-30 17:36 ` [LTP] [Patch 1/8] New testcase to validate Ideal Load Balancer Functionality Subrata Modak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090828101505.12177.78037.sendpatchset@localhost.localdomain \
--to=mpnayak@linux.vnet.ibm.com \
--cc=arun@linux.vnet.ibm.com \
--cc=ego@in.ibm.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=svaidy@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.