smt_smp_enabled.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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., 59 Tiemple Place, Suite 330, Boston, MA 02111-1307 USA ##
  17. ## ##
  18. ################################################################################
  19. #
  20. # File: smt_smp_enabled.sh
  21. #
  22. # Description: This program tests whether HT/SMP is supported or not.
  23. #
  24. # Author: Rohit Verma, rohit.170309@gmail.com
  25. #
  26. # History: May 21 2009 - Created. - Rohit Verma
  27. export TST_TOTAL=1
  28. export TCID=smt_smp_enabled
  29. export TST_COUNT=1
  30. TFAILCNT=0
  31. RC=0
  32. # check for SMT/SMP System
  33. tst_resm TINFO "Begin: SMT/SMP Enabled"
  34. if [ -f ./ht_enabled ];then
  35. ./ht_enabled
  36. ret_value=$?
  37. if [ $ret_value -ne 0 ];then
  38. tst_resm TCONF "SMT/SMP is not supported"
  39. tst_resm TINFO "End: SMT/SMP Enabled"
  40. exit 0
  41. fi
  42. else
  43. tst_resm TBROK "ht_enabled:File not found"
  44. tst_resm TINFO "End: SMT/SMP Enabled"
  45. TFAILCNT=$(( $TFAILCNT+1 ))
  46. exit $TFAILCNT
  47. fi
  48. no_of_processor=`tst_ncpus`
  49. no_of_cpu=`tst_ncpus_conf`
  50. if [ $no_of_processor -lt $no_of_cpu ];then
  51. test_op="Enable:/sys/devices/system/cpu/cpuX/online"
  52. tst_resm TCONF "$test_op"
  53. tst_resm TINFO "End: SMT/SMP Enabled"
  54. TFAILCNT=$(( $TFAILCNT+1 ))
  55. exit $TFAILCNT
  56. else
  57. cpu_cores=`cat /proc/cpuinfo | grep "cpu cores" | cut -f 2 -d ':'\
  58. | sed 's/ //' | uniq`
  59. if [ $cpu_cores -eq 1 ];then
  60. tst_resm TPASS "SMT is enable"
  61. elif [ $cpu_cores -ge 2 ];then
  62. tst_resm TPASS "SMP System"
  63. else
  64. tst_resm TCONF "TBD"
  65. fi
  66. fi
  67. tst_resm TINFO "End: SMT/SMP Enabled"
  68. exit