Home | History | Annotate | Download | only in ht_affinity
      1 #!/bin/sh
      2 ################################################################################
      3 ##                                                                            ##
      4 ## This program is free software;  you can redistribute it and#or modify      ##
      5 ## it under the terms of the GNU General Public License as published by       ##
      6 ## the Free Software Foundation; either version 2 of the License, or          ##
      7 ## (at your option) any later version.                                        ##
      8 ##                                                                            ##
      9 ## This program is distributed in the hope that it will be useful, but        ##
     10 ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
     11 ## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
     12 ## for more details.                                                          ##
     13 ##                                                                            ##
     14 ## You should have received a copy of the GNU General Public License          ##
     15 ## along with this program;  if not, write to the Free Software               ##
     16 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
     17 ##                                                                            ##
     18 ################################################################################
     19 #
     20 # File:          smt_smp_affinity.sh
     21 #
     22 # Description: This program tests the following:
     23 #		Set affinity through system call sched_setaffinity
     24 #		get affinity through system call sched_getaffinity
     25 #		Inheritance of Affinity
     26 #
     27 # Author:      Rohit Verma, rohit.170309 (at] gmail.com
     28 #
     29 # History:     May 21 2009 - Created. - Rohit Verma
     30 
     31 export TST_TOTAL=1
     32 export TCID=smt_smp_affinity
     33 export TST_COUNT=1
     34 TFAILCNT=0
     35 RC=0
     36 
     37 # check for HT/SMP System
     38 tst_resm TINFO "Begin: SMT/SMP Affinity"
     39 
     40 if [ -f ./ht_enabled ];then
     41 	./ht_enabled
     42 	ret_value=$?
     43 
     44 	if [ $ret_value -ne 0 ];then
     45 		tst_resm TCONF "SMT/SMP is not supported"
     46 		tst_resm TINFO "End: SMT/SMP Affinity"
     47 		exit 0
     48 	fi
     49 else
     50 	tst_resm TBROK "ht_enabled:File not found"
     51 	tst_resm TINFO "End: SMT/SMP Affinity"
     52 	TFAILCNT=$(( $TFAILCNT+1 ))
     53 	exit $TFAILCNT
     54 fi
     55 
     56 no_of_processor=`tst_ncpus`
     57 no_of_cpu=`tst_ncpus_conf`
     58 
     59 if [ $no_of_processor -lt $no_of_cpu ];then
     60 
     61 	tst_resm TCONF "cpuX:offline"
     62 	tst_resm TINFO "End: SMT/SMP Affinity"
     63 	TFAILCNT=$(( $TFAILCNT+1 ))
     64 	exit $TFAILCNT
     65 
     66 else
     67         cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | cut -f 2 -d ':'\
     68 			 | sed 's/ //' | uniq`
     69 
     70 	if [ $cpu_cores -ge 1 ];then
     71 		if [ -f ./ht_affinity ];then
     72 			./ht_affinity
     73 		else
     74 			tst_resm TBROK "ht_affinity:File not found"
     75 			tst_resm TINFO "End: SMT/SMP Affinity"
     76 			TFAILCNT=$(( $TFAILCNT+1 ))
     77 			exit $TFAILCNT
     78 		fi
     79 	else
     80 		tst_resm TINFO "TBD"
     81 	fi
     82 fi
     83 
     84 tst_resm TINFO "End: SMT/SMP Affinity"
     85 
     86 exit
     87