Advertisement
Guest User

SC2 Starter/Tuning/Benchmark Script

a guest
Sep 11th, 2012
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 20.50 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # USAGE:
  4. # start without parameters: (normal SC2-start with usual tweaks)
  5. #   creates Variables.txt-backup, starts SC2, changes kernel parameters/modules, changes process priority/affinity/... and undoes all the changes afterwards.
  6. #
  7. # start with "-b" flag: (benchmark-mode. SC2-start with tweaks, gathers performance information)
  8. #   only gathers performance information in the background and prints the results in "$sc_appdata_path"bench-logs/bench-result when SC2 is terminated.
  9. #
  10. # start with "-b -t" flag: (automated benchmark-mode. SC2-start, gathers performance information, automatically starts a replay and quits SC2 to have a reproducible workload)
  11. #
  12. #
  13. # ADJUSTMENTS:
  14. # (text-search for the listed things and you will find the right place to edit. there might be several of it.)
  15. # things, you should check/adjust in order to make make a normal SC2-start:
  16. #   - path variables - to: wine-prefix, SC2-executable, SC2-appdata-folder
  17. #   - SC2-executable (+commands)
  18. #   - cpu-governor settings
  19. #   - cpu core number
  20. #   - cpu core affinity
  21. #
  22. # further things you could customize: (the script should work fine without adjusting these)
  23. #   - kernel parameters - these were my initial reason to write this script. i highly recommend you, to find out on your own if you want to use my values because they are still very experimental.
  24. #   - kernel-modules - these modules will be removed before and added back after SC2.
  25. #   - process attributes - if you are unhappy with my settings (nice, schedule policy ...).
  26. #
  27. # things you need to adjust for the benchmark-mode: (if "-b" is passed)
  28. #   - probed benchmark data - but, by changing this, you will for sure break the benchmark data analysis.
  29. #   -- NOTE: right now, this script will only handle "bench-sample_fps" files, the parts that calculate the average cpu-/gpu-load are missing but gathering the data is possible.
  30. #
  31. # things you need to adjust for the automated benchmark-mode: (if "-b -t" is passed)
  32. #   - install the package "xautomation". it ("xte") makes automated key-inputs and clicks from enter password over start replay to set player-camera.
  33. #   - click-coordinates - you need to change the x- and  y- coordinates several times for a variety of buttons. (xte 'mousemove X Y')
  34. #   -- im running SC2 with a resolution of 1024x768. if you use a different one, you must adjust the coordinates.
  35. #   - battle.net account-password - you save your password in this script so you dont need to enter it manually all the time.
  36. #   - the script starts the first replay in folder "vs AI" folder. make sure its the desired "BENCHMARK.SC2Replay".
  37. #
  38. # this script is not finished yet. there are quite some possibilies to improve it.
  39. # e.g. the benchmark results will always the saved in $sc_appdata_path/bench-logs/bench-result
  40.  
  41. clear
  42. sudo -v # gets the preemptive super user privileges to execute only certain commands later on. dont panic, it wont start SC2 with sudo.
  43. sleep 2s # this also gives you the opportunity to kill the script with CTRL + C
  44.  
  45. # --- VARIABLES:
  46. declare -i i; i=0
  47. declare -i j; j=0
  48. # --- following 4 lines randomly set k/l to 1/2 or 2/1 to assign the SC2/wineserver process randomly to cpu core number 1/2 or 2/1. i wanted to have some rotation in that. if you want a static core assignment or you have more than 2 cores (so randomly k!=l & k/l = [1-4]), you might adjust this.
  49. declare -i k; k=$RANDOM
  50. let "k %= 2","k += 1"
  51. declare -i l; if [ $k -eq 1 ]; then
  52. l=2; else l=1; fi
  53. declare sc_date; sc_date=`date +%Y-%m-%d_%H-%M-%S`
  54. # --- these 3 path variables ($sc_wine_pref, $sc_exec_path, $sc_appdata_path) point to the folders of ... just look at them.
  55. # ---- note: there are no " or ' quotes around them. i dont know why quotes break the script neither do i why it runs without them :) - just stay with the syntax ("space" = "\ ").
  56. declare sc_wine_pref; sc_wine_pref=~/.wine/
  57. declare sc_exec_path; sc_exec_path=~/.wine/drive_c/Program\ Files/StarCraft\ II/Support/SC2Switcher.exe
  58. declare sc_appdata_path; sc_appdata_path=~/StarCraft\ II/
  59.  
  60. # --- following array defines the kernel parameters and the new values, to which the script will change them before SC2-start and set them back to default afterwards.
  61. : ' <--- commented out, just delete this and the last line of this chapter to enable it.
  62. declare -a kp_var
  63. declare -a kp_var_bak
  64. kp_var=(
  65. # --- scheduler parameters
  66. kernel.sched_child_runs_first=1
  67. kernel.sched_time_avg=250
  68. kernel.sched_rt_period_us=957500
  69. kernel.sched_rt_runtime_us=-1
  70. kernel.sched_nr_migrate=48
  71. kernel.sched_latency_ns=8000000
  72. kernel.yama.ptrace_scope=0
  73. kernel.sched_wakeup_granularity_ns=25000000
  74. kernel.sched_min_granularity_ns=4000000
  75. vm.overcommit_memory=2
  76. vm.overcommit_ratio=50
  77. kernel.ftrace_enabled=0
  78. kernel.perf_event_paranoid=-1
  79. kernel.io_delay_type=3
  80. kernel.watchdog=0
  81. kernel.nmi_watchdog=0
  82. # --- network parameters
  83. net.core.rmem_max=67108864
  84. net.core.wmem_max=67108864
  85. "net.ipv4.tcp_rmem=4096 3932160 62914560"
  86. "net.ipv4.tcp_wmem=4096 196608 3145728"
  87. net.ipv4.tcp_mtu_probing=1
  88. net.ipv4.tcp_timestamps=0
  89. )
  90. ' #<--- remove this line to enable this chapter.
  91.  
  92. # --- these are the the kernel-modules that will be remove and added back again after SC2 is terminated.
  93. #: ' <--- commented out, just delete this and the last line of this chapter to enable it.
  94. declare -a km_var
  95. km_var=(
  96. rfcomm
  97. bnep
  98. bluetooth
  99. psmouse
  100. joydev
  101. ppdev
  102. sparse_keymap
  103. uvcvideo
  104. videodev
  105. v4l2_compat_ioctl32
  106. serio_raw
  107. video
  108. acer_wmi
  109. mxm_wmi
  110. wmi
  111. sdhci_pci
  112. sdhci
  113. iwlwifi
  114. mac80211
  115. cfg80211
  116. snd_seq_midi
  117. snd_rawmidi
  118. snd_seq_midi_event
  119. 'lp'
  120. parport_pc
  121. parport
  122. pcmcia
  123. yenta_socket
  124. pcmcia_rsrc
  125. pcmcia_core
  126. )
  127. #' #<--- remove this line to enable this chapter.
  128.  
  129. # --- this part stores the battle.net account-password for the automatic login. if you like, you can save your password in this file.
  130. if [ "$1" == "-b" ] && [ "$2" == "-t" ]; then
  131.     #declare acc_pw; acc_pw="mengWEg3n" # <- save your pw here and remove the "#" at the beginning of the line
  132.     if [ ! $acc_pw ]; then
  133.         declare acc_pw
  134.         echo "Please enter Battle.net Account Password:"
  135.         read acc_pw
  136.         history -c; reset
  137.     fi
  138. fi
  139.  
  140. # --- "if" declares the all needed vars when benchmark mode is enabled.
  141. if [ "$1" == "-b" ]; then
  142.     declare bv_line; bv_line=0
  143.     declare -a bv_clean_data
  144.     declare bv_results; bv_results=0
  145.     # --- "if" checks if a "bench-log" directory exists in $sc_appdata_path and creates one if not.
  146.     if [ ! -d "$sc_appdata_path"bench-logs ]; then
  147.         echo "BENCH-LOG DIR DOESNT EXIST ... CREATING NEW ONE"; sleep 2s
  148.         mkdir "$sc_appdata_path"bench-logs
  149.     fi
  150.     mkdir "$sc_appdata_path"bench-logs/bench-data.$sc_date
  151. fi
  152.  
  153. # --- "if" checks if the SC2 settings has been changed and creates new backup if so.
  154. if diff "$sc_appdata_path"Variables.txt "`ls -r "$sc_appdata_path"Variables.txt.bak.* | head -n1 | sed 's_ _\\ _g'`" >/dev/null; then
  155.     echo "VARIABLES MATCHING BACKUP"
  156. else
  157.     echo "VARIABLES ALTERED ... CREATING NEW BACKUP"
  158.     cp "$sc_appdata_path"Variables.txt "$sc_appdata_path"Variables.txt.bak.$sc_date; sleep 2s
  159. fi
  160.  
  161. chmod -w "$sc_appdata_path"Variables.txt # write-protect the SC2 settings to prevent any unintended changes by SC2. changed back to writable when SC2 is closed.
  162. # --- you can ignore the following lines. used to be an experiment what i never removed.
  163. sudo atieventsd --nosyslog
  164. sudo sync; sleep 2s
  165. echo "CACHE CLEARED"
  166.  
  167. # --- this loop changes the kernel-parameters to the defined values in $kp_var and saves the original values in $kp_var_bak
  168. if [ ${#kp_var[@]} -gt 0 ]; then
  169.     echo "CHANGING KERNEL PARAMETERS"
  170.     for ((i=0; i<=${#kp_var[@]} - 1; i++)); do
  171.         kp_var_bak[$i]=`sysctl -n $(echo ${kp_var[$i]:0:\`expr index "${kp_var[$i]}" "="\`} | sed -e 's_\=__g')`
  172.         sudo sysctl -w "${kp_var[$i]}"
  173.     done
  174. else
  175.     unset kp_var kp_var_bak
  176. fi
  177.  
  178. # --- this loop checks if the listed kernel-modules exist and if not, removes them from the array. after that, the selected modules will be removed
  179. if [ ${#km_var[@]} -gt 0 ]; then
  180.     echo "REMOVING KERNEL MODULES"
  181.     for ((i=0; i<=${#km_var[@]} - 1; i++)); do
  182.         if ! lsmod | grep "${km_var[$i]} " >/dev/null; then
  183.             echo "${km_var[$i]} kernel-module is not loaded"
  184.             unset km_var[$i]
  185.         fi
  186.     done
  187.     sudo modprobe -r ${km_var[@]}
  188. fi
  189.  
  190. # --- cpu-governor settings to max performance (for my 2 cpu cores). "man cpufreq-set" for details.
  191. echo "SETTING CPU GOVERNOR: PERFORMANCE"
  192. sudo cpufreq-set -c 0 -g performance -d 2000000 -u 2000000
  193. sudo cpufreq-set -c 1 -g performance -d 2000000 -u 2000000
  194.  
  195. # --- starts SC2-executable (+commands). notice the arguments i pass to SC2 and change it if desired.
  196. echo -e "\nSTARTING SC2 NOW"
  197. wine --version; sleep 1s
  198. sleep 1s; xrandr -s 1024x768; sleep 1s
  199. if [ "$1" == "-b" ]; then
  200.     echo "----------------"; echo "-BENCHMARK MODE-"; echo "----------------";
  201.     > "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_fps.$sc_date
  202.     WINEDEBUG="-all,+fps" wine "$sc_exec_path" -opengl -fullproc -skipopenal -confinecursor -Leaks &> "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_fps.$sc_date
  203.     chmod -w "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_fps.$sc_date # this creates the bench-sample_fps file and locks it until the replay starts.
  204. else
  205.     WINEDEBUG="-all" wine "$sc_exec_path" -opengl -fullproc -skipopenal -confinecursor -Leaks
  206. fi
  207. sleep 15s
  208.  
  209. # --- these commands change some process attributes.
  210. sudo renice -n -19 `pidof SC2.exe` # increases the priority of SC2 and wineserver process.
  211. sudo renice -n -19 `pidof wineserver`
  212. sudo taskset -p $k `pidof SC2.exe` # sets SC2 to one of my cpu cores and wineserver to the other one, cpu core affinity might need to be adjusted.
  213. sudo taskset -p $l `pidof wineserver`
  214. sudo chrt -f -p 80 `pidof SC2.exe` # changes the scheduler priority and policy to FIFO (First in First out) for SC2 and wineserver.
  215. sudo chrt -f -p 70 `pidof wineserver`
  216. chrt -p `pidof SC2.exe`
  217. chrt -p `pidof wineserver`
  218. sudo ionice -c2 -n0 -p`pidof SC2.exe` # increases IO priority of SC2 and wineserver.
  219. sudo ionice -c2 -n0 -p`pidof wineserver`
  220. echo -e "ionice: $(pidof SC2.exe): $(sudo ionice -p `pidof SC2.exe`)\nionice: $(pidof wineserver): $(sudo ionice -p `pidof wineserver`)\n"
  221. #sudo schedtool -1 -p 90
  222.  
  223. # --- this part enters the $acc_pw, starts the "BENCHMARK.SC2Replay" and sets player-camera.
  224. # --- its a very ugly solution though, you need to adjust the click-coordinates and and put a replay in the "vs AI" replay-folder. the first one in the list will be started.
  225. if [ "$1" == "-b" ] && [ "$2" == "-t" ]; then
  226.     sleep 20s # wait for SC2 login screen
  227.     xte "str $acc_pw"; sleep 1s; xte 'key Return' # enters password
  228.     unset acc_pw
  229.     sleep 20s # wait for SC2 menu
  230.     xte 'mousemove 320 120'; xte 'mouseclick 1'; sleep 3s # click on replay-button --- adjust the click-coordinates to the Buttons.
  231.     xte 'mousemove 150 370'; xte 'mouseclick 1'; sleep 3s # click on "VS AI"-button --- below is an identical part which needs the coordinates.
  232.     xte 'mousemove 380 665'; xte 'mouseclick 1'; sleep 35s # starts replay and waits for the loading
  233.     xte 'key 1'; sleep 1s; xte 'mousemove 100 100' # sets player2-camera
  234.     chmod +w "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_fps.$sc_date
  235. fi
  236.  
  237. # --- this loop runs as long as SC2 runs
  238. i=0
  239. j=1
  240. k=0
  241. l=0
  242. while [ $(pidof SC2.exe) ]; do
  243.     let "i += 1"
  244.  
  245.     # --- this "if" renews the sudo and stuff so in the end, you dont need to give your password again to revert e.g. the kernel-parameters.
  246.     if [ $i -eq 6 ]; then
  247.         sudo -v; echo -n "-$j- "; let "j += 1"; i=0
  248.     fi
  249.  
  250.     # --- this "if" collects the benchmark data. 1 sample per second
  251.     if [ "$1" == "-b" ]; then
  252.         for ((k=0; k<=10; k++)); do
  253.             if [ $(pidof SC2.exe) ]; then
  254.                 aticonfig --od-getclocks | grep "GPU load" >> "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_gpuload.$sc_date
  255.                 ps -o pcpu=,pmem= --pid `pidof SC2.exe` >> "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_cpuload.$sc_date
  256.                 sleep 1s
  257.             fi
  258.             xte 'key 1' # every second, player1-camera is pressed to prevent user-interference and my screensaver :)
  259.         done
  260.         if [ "$1" == "-b" ] && [ "$2" == "-t" ] && [ $j -eq 10 ]; then # end condition of the benchmark: after 10 minutes ,the following part will close the replay and restart it for [ $l -ne X ] times.
  261.             chmod -w "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_fps.$sc_date # this "chmod" locks the bench-sample_fps file to exclude everything outside of the replay.
  262.             xte 'key F10'; sleep 1s; xte 'key v'; sleep 10s # quits the replay
  263.             if [ $l -ne 4 ]; then # this restarts the replay 4 times and quits SC2 after it
  264.                 xte 'mousemove 320 120'; xte 'mouseclick 1'; sleep 3s # click on replay-button --- adjust the click-coordinates to the Buttons.
  265.                 xte 'mousemove 150 370'; xte 'mouseclick 1'; sleep 3s # click on "VS AI"-button
  266.                 xte 'mousemove 380 665'; xte 'mouseclick 1'; sleep 35s # starts replay and waits for the loading
  267.                 xte 'key 1'; sleep 1s; xte 'mousemove 100 100' # sets player2-camera
  268.                 chmod +w "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_fps.$sc_date
  269.             else
  270.                 xte 'key Escape'; sleep 2s; xte 'mousemove 500 460'; xte 'mouseclick 1'; sleep 5s # adjust the click-coordinates to "Quit Starcraft"-Button in the Mainmenu.
  271.             fi
  272.             j=1; let "l += 1"
  273.         fi
  274.     else
  275.         sleep 10s
  276.     fi
  277.  
  278. done
  279.  
  280. sleep 1s; xrandr -s 1280x800; sleep 1s
  281. echo -e "\nTERMINATED\nYOU PLAYED $j MINUTES\n"
  282. wineserver -k
  283. chmod +w "$sc_appdata_path"Variables.txt # makes the Variables.txt writable again.
  284. sensors -A # this just put the temperature of your cpu out.
  285.  
  286. # --- reverts the cpu-governor settings to ondemand (my default).
  287. echo "SETTING CPU GOVERNOR: ONDEMAND"
  288. sudo cpufreq-set -c 0 -g ondemand -d 800000 -u 2000000
  289. sudo cpufreq-set -c 1 -g ondemand -d 800000 -u 2000000
  290.  
  291. # --- this loop changes the kernel-params back to default
  292. if [ ${#kp_var[@]} -gt 0 ]; then
  293.     echo "RESTORING KERNEL PARAMETERS"
  294.     for ((i=0; i<=${#kp_var[@]} - 1; i++)); do
  295.         sudo sysctl -w "${kp_var[$i]:0:`expr index "${kp_var[$i]}" "="`}${kp_var_bak[$i]}"
  296.     done
  297. fi
  298.  
  299. # --- loads the deactivated kernel-modules again
  300. if [ ${#km_var[@]} -gt 0 ]; then
  301.     echo "RESTORING KERNEL MODULES"
  302.     sudo modprobe -a ${km_var[@]}
  303.     sleep 2s
  304. fi
  305. sudo -K
  306.  
  307. #
  308. # --- bechmark-data processing
  309. #
  310. if [ "$1" == "-b" ]; then
  311.  
  312.     # --- this chapter prints the header of/to the bench-result file. consisting of used SC2 configurations, "Direct3D"-Registrykey, xorg.conf options, used kernel-parameters and modules.
  313.     echo "WRITING BENCH-RESULT FILE"
  314.     echo -e "\n-------------------------------------------\n---- bench-result.$sc_date -----\n-------------------------------------------\n" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  315.     echo -e "Used SC2-Settings:\n$(ls -r "$sc_appdata_path"Variables.txt.bak.* | head -n1)" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  316.     #ls -r "$sc_appdata_path"Variables.txt.bak.* | head -n1 >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  317.     echo -e "\n\nDirect3D Registrykey:" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  318.     while read bv_line; do # this "while" prints the Direct3D-Registry key to bench-result
  319.         if [ "$(echo $bv_line | grep Direct3D)" ]; then
  320.             i=1
  321.         elif [ $i -eq 1 ] && [ "$(echo $bv_line | grep Software)" ]; then
  322.             i=0
  323.         elif [ $i -eq 1 ]; then
  324.             echo $bv_line >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  325.         fi
  326.     done < "$sc_wine_pref"user.reg
  327.     echo -e "\nxorg.conf Section \"Device\":\n" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  328.     while read bv_line; do # this "while" prints the xorg.conf settings to bench-result
  329.         if [ "$bv_line" == 'Section "Device"' ]; then
  330.             i=1
  331.         elif [ $i -eq 1 ] && [ "$bv_line" == "EndSection" ]; then
  332.             i=0
  333.         elif [ $i -eq 1 ]; then
  334.             echo $bv_line  >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  335.         fi
  336.     done < /etc/X11/xorg.conf
  337.     if [ ${#kp_var[@]} -gt 0 ]; then # prints the custom kernel params to bench-result
  338.         echo -e "\n\nCustom kernel settings:\n" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  339.         for ((j=0; j<=${#kp_var[@]} - 1; j++)); do
  340.             echo "${kp_var[$j]}" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  341.         done
  342.     fi
  343.     if [ ${#km_var[@]} -gt 0 ]; then # prints the removed kernel mods to bench-result
  344.         echo -e "\n\nRemoved kernel modules:" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  345.         echo -e "${km_var[@]}\n" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  346.     fi
  347.  
  348.     echo -e "\nPROCESSING BENCHMAK SAMPLES"
  349.  
  350.     # ---this part reads "bench-sample_fps" line by line and modifies these and puts the clean numbers in bv_clean_data.
  351.     sleep 3s
  352.     while read bv_line; do
  353.         echo -n "."
  354.         if `echo $bv_line | grep "swapchain_gl_present" 1>/dev/null 2>&1`; then
  355.             bv_clean_data[${#bv_clean_data[@]}]=$(echo ${bv_line:`expr index "$bv_line" "@"` + 7} | sed -e 's/[A-Za-z]*//g')
  356.         fi
  357.     done < "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_fps.$sc_date
  358.     # this loop calculates the average fps
  359.     bv_results=0
  360.     for ((i=0; i<=${#bv_clean_data[@]} - 1; i++)); do
  361.         echo -n "."
  362.         bv_results=$(echo "$bv_results + ${bv_clean_data[$i]}" | bc)
  363.     done
  364.     echo -e "\nAverage FPS:" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  365.     echo "scale=10;$bv_results/${#bv_clean_data[@]}" | bc >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  366.     echo "done"
  367.  
  368.     # ---this part reads "bench-sample_cpuload" line by line, modifies these and puts the clean numbers in bv_clean_data.
  369.     sleep 3s
  370.     unset bv_clean_data; declare -a bv_clean_data
  371.     while read bv_line; do
  372.         echo -n "."
  373.         bv_clean_data[${#bv_clean_data[@]}]=${bv_line:0:`expr index "$bv_line" "\ "`}
  374.         bv_clean_data[${#bv_clean_data[@]}]=${bv_line:`expr index "$bv_line" "\ "`}
  375.     done < "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_cpuload.$sc_date
  376.     # this loop calculates the average cpu-usage
  377.     bv_results=0
  378.     for ((i=0; i<=${#bv_clean_data[@]} - 1; i+=2)); do
  379.         echo -n "."
  380.         bv_results=$(echo "$bv_results + ${bv_clean_data[$i]}" | bc)
  381.     done
  382.     echo -e "\nAverage CPU %:" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  383.     echo "scale=10;$bv_results/${#bv_clean_data[@]}*2" | bc >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  384.     # this loop calculates the average memory-usage
  385.     bv_results=0
  386.     for ((i=1; i<=${#bv_clean_data[@]} - 1; i+=2)); do
  387.         echo -n "."
  388.         bv_results=$(echo "$bv_results + ${bv_clean_data[$i]}" | bc)
  389.     done
  390.     echo -e "\nAverage Memory %:" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  391.     echo "scale=10;$bv_results/${#bv_clean_data[@]}*2" | bc >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  392.     echo "done"
  393.  
  394.     # ---this part reads "bench-sample_gpuload" line by line, modifies these and puts the clean numbers in bv_clean_data.
  395.     sleep 3s
  396.     unset bv_clean_data; declare -a bv_clean_data
  397.     while read bv_line; do
  398.         echo -n "."
  399.         bv_clean_data[${#bv_clean_data[@]}]=`echo $bv_line | sed -e 's/[A-Za-z]*//g' -e 's/://g' -e 's/%//g' -e 's/ //g'`
  400.     done < "$sc_appdata_path"bench-logs/bench-data.$sc_date/bench-sample_gpuload.$sc_date
  401.     # this loop calculates the average memory-usage
  402.     bv_results=0
  403.     for ((i=1; i<=${#bv_clean_data[@]} - 1; i++)); do
  404.         echo -n "."
  405.         bv_results=$(echo "$bv_results + ${bv_clean_data[$i]}" | bc)
  406.     done
  407.     echo -e "\nAverage GPU %:" >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  408.     echo "scale=10;$bv_results/${#bv_clean_data[@]}" | bc >> "$sc_appdata_path"bench-logs/bench-result.$sc_date
  409.     echo "done"
  410.  
  411.  
  412.  
  413.     cat "$sc_appdata_path"bench-logs/bench-result.$sc_date # prints the bench-result on terminal
  414. fi
  415.  
  416. unset i j k l o sc_date bv_line bv_clean_data bv_results kp_var kp_var_bak km_var sc_wine_pref sc_exec_path sc_appdata_path
  417. echo -e "\nFINISH"
  418.  
  419.  
  420. #NOTES
  421. : '
  422. INSTALLATION: mount commands
  423. mount -l
  424. sudo mount -o remount,unhide /dev/sr0/ /media/SC2*
  425. ##sudo umount /media/SC2*
  426. ##sudo mount -t udf -o ro,unhide,uid=$(id -u) /dev/cdrom /media/cdrom
  427. #
  428. #
  429. #xinit /usr/bin/chrt -f 1 su -l ddder -c 'WINEDEBUG="-all" wine ~/.wine/drive_c/Programme/StarCraft\ II/StarCraft\ II.exe -opengl -fullproc -skipopenal -nocpubinding -confinecursor -Leaks' -- /usr/bin/Xorg :1 -nolisten tcp
  430. #wineserver --debug=0
  431. excluded sc2.exe params: -opengl -fullproc -skipopenal -nocpubinding -confinecursor
  432. exclusions: --overlay-type=opengl --overlay-on=1
  433. sudo aticonfig --tv-overscan=off --sync-vsync=off --pseudo-color=off --sync-video=off --xinerama=off --tls=0 --overlay-type=disable --overlay-on=0
  434. "MaxFragmentUniform"="512"
  435. "MaxVaryings"="52"
  436. "MaxVertexUniforms"="512"
  437. buildcaches pagedPoolLimit pagedPoolLeeway VertexMain PixelMain MultiSampleType=%d MultiSampleQuality=%d verticalFOV textureQuality BackgroundModel (1024x640) DisabledAlpha Alpha
  438. ps aux | grep SC2.exe
  439.  
  440. "DefaultBitsPerSample"="8"
  441. "DefaultSampleRate"="22100"
  442. "HardwareAcceleration"="Full"
  443. "MaxShadowSize"="0"
  444. "SndQueueMax"="3"
  445. '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement