The Bytecode Club - Reverse Engineering Forum
Suggestion - CPU usage high with bot sitting idle - Printable Version

+- The Bytecode Club - Reverse Engineering Forum (https://the.bytecode.club)
+-- Forum: Lobby (https://the.bytecode.club/forumdisplay.php?fid=1)
+--- Forum: Game Cheating, Botting & Reverse Engineering (https://the.bytecode.club/forumdisplay.php?fid=97)
+--- Thread: Suggestion - CPU usage high with bot sitting idle (/showthread.php?tid=259)



Suggestion - CPU usage high with bot sitting idle - Revial - 01-07-2015

Hey, I noticed the CPU usage of the 5.3.4 version (only one I use right now) was about 50% (laptop has 2x CPU so it consumes 1x CPU).  I tested and reduced the consumption by adding a sleep() function to while loop of the the GUI input.

Code:
While 1
GUIGetMsg()
If _GUICtrlComboBox_GetCurSel($cmbTroopComp) <> $icmbTroopComp Then
$icmbTroopComp = _GUICtrlComboBox_GetCurSel($cmbTroopComp)
SetComboTroopComp()
   EndIf
Sleep(100) ;Reduce the CPU consumption by 90+%
WEnd

Hope this is useful.

Cheers!


RE: Suggestion - CPU usage high with bot sitting idle - Kaz - 01-08-2015

Good catch, Revial. I'll include this.

Can this be the hang issue source? Somehow the code exits out one of the loops and ends up in this one which never seems to break out of it.


RE: Suggestion - CPU usage high with bot sitting idle - GkevinOD - 01-08-2015

This is due to _sleep function, I found.. I fixed it see v5.4.1 to see how