mirror of the now-defunct rocklinux.org
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.

138 lines
3.0 KiB

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