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.

132 lines
2.7 KiB

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