OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
2.7 KiB

  1. #!/bin/sh
  2. #
  3. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  4. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  5. #
  6. # T2 SDE: package/.../cpuburn/cpuburn.sh
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- T2-COPYRIGHT-NOTE-END ---
  17. errors=`mktemp -t cpuburn.XXXX`
  18. start=`date "+%s"` ; command="" ; jobs=1
  19. help() {
  20. cat << 'EOT'
  21. Usage: $0 [ -j Jobs ] { -k6 | -k7 | -p5 | -p6 | -bx | -mmx } [ -mem Mem ]
  22. The -mem option is only available for the bx and mmx tests. Possible values
  23. for Mem are: 2kb, 4kb, 8kb, 16kb, 32kb, 64kb, 128kb, 256kb, 512kb, 1MB, 2MB,
  24. 4MB, 8MB, 16MB, 32MB and 64MB.
  25. EOT
  26. rm $errors
  27. exit 1
  28. }
  29. while [ "$#" != 0 ]
  30. do
  31. case "$1" in
  32. -j)
  33. jobs=$2 ; shift ;;
  34. -bx)
  35. command="burnBX" ;;
  36. -k6)
  37. command="burnK6" ;;
  38. -k7)
  39. command="burnK7" ;;
  40. -mmx)
  41. command="burnMMX" ;;
  42. -p5)
  43. command="burnP5" ;;
  44. -p6)
  45. command="burnP6" ;;
  46. -mem)
  47. [ "$command" != burnBX -a "$command" != burnMMX ] && help
  48. case "$2" in
  49. 2kb)
  50. command="$command A" ;;
  51. 4kb)
  52. command="$command B" ;;
  53. 8kb)
  54. command="$command C" ;;
  55. 16kb)
  56. command="$command D" ;;
  57. 32kb)
  58. command="$command E" ;;
  59. 64kb)
  60. command="$command F" ;;
  61. 128kb)
  62. command="$command G" ;;
  63. 256kb)
  64. command="$command H" ;;
  65. 512kb)
  66. command="$command I" ;;
  67. 1MB)
  68. command="$command J" ;;
  69. 2MB)
  70. command="$command K" ;;
  71. 4MB)
  72. command="$command L" ;;
  73. 8MB)
  74. command="$command M" ;;
  75. 16MB)
  76. command="$command N" ;;
  77. 32MB)
  78. command="$command O" ;;
  79. 64MB)
  80. command="$command P" ;;
  81. *)
  82. help ;;
  83. esac
  84. shift
  85. ;;
  86. *)
  87. help ;;
  88. esac
  89. shift
  90. done
  91. [ "$command" = "" ] && help
  92. desc="${jobs}x ${command#burn}"
  93. while [ $jobs -gt 0 ] ; do
  94. (
  95. PATH=".:$PATH"
  96. while true ; do
  97. eval "$command"
  98. date "+%T - $?" >> $errors
  99. done
  100. ) &
  101. jobs=$(( $jobs - 1 ))
  102. done &> /dev/null
  103. trap "fuser -9 -k $errors > /dev/null ; rm $errors ; exit 0" INT TERM
  104. echo "Using temp file $errors ..."
  105. while true
  106. do
  107. tm=$(( `date +%s` - $start ))
  108. tm=$( printf '%02d:%02d:%02d:%02d' \
  109. $(( ($tm / (60*60*24)) )) \
  110. $(( ($tm / (60*60)) % 24 )) \
  111. $(( ($tm / 60) % 60 )) \
  112. $(( $tm % 60 )) )
  113. echo `date "+%T ($tm)"` " [$desc] " Load average: \
  114. `uptime | sed "s,.*average: ,,"`, "" `wc -l < $errors` Errors.
  115. sleep 5
  116. done