ur Posted December 15, 2017 Posted December 15, 2017 with the below code, I am keeping waiting for a particular file and waiting in the background. While $i <> 10 Sleep(60000) If FileExists(@ScriptDir&"\Binaries.ini") then --some processing-- $i = 10 endif WEnd I thought keeping the Sleep will freeze the process from resources but the CPU being uilized.But it is taking 47%. How to free this CPU usage also.?
RTFC Posted December 15, 2017 Posted December 15, 2017 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O
careca Posted December 15, 2017 Posted December 15, 2017 There must be more to that script, to cause that cpu usage. The code you have there shouldn't use that much cpu. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
ur Posted December 15, 2017 Author Posted December 15, 2017 1 hour ago, careca said: There must be more to that script, to cause that cpu usage. The code you have there shouldn't use that much cpu. But it should release the resources atleast during the Sleep time right. But it isn't.
Earthshine Posted December 15, 2017 Posted December 15, 2017 it depends but we can't tell because we can't see it My resources are limited. You must ask the right questions
careca Posted December 15, 2017 Posted December 15, 2017 51 minutes ago, ur said: But it should release the resources resources, now ur talking RAM usage. Cpu is all about processing stuff. is there any adlib funcs for instance? Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
ur Posted December 15, 2017 Author Posted December 15, 2017 THis is my script. Local $i = 0 While $i <> 10 Sleep(60000);1min If FileExists(@ScriptDir&"\Binaries.ini") then WaitForINICompletion(@ScriptDir&"\Binaries.ini") SendMail("Binaries copied to Installshield machine","Got Binaries.ini: Will initmate once Install creation started") Sleep(5000) ;MsgBox($MB_SYSTEMMODAL, "", "Value of $i is: " & $i) ChangeWin32(@ScriptDir&"\Binaries.ini") CheckZip(@ScriptDir&"\Binaries.ini") AppendBinaries(@ScriptDir&"\Binaries.ini",@ScriptDir&"\BinaryDetails.ini") if(FileExists(@ScriptDir&"\copy.exe")) then Local $iReturn = Runwait(@ScriptDir&"\copy.exe", "", @SW_MAXIMIZE) if not @error Then ;Logging("execution completed successfully with Return Code: " & $iReturn,4) Else ;Logging("execution failed with Return Code: " & $iReturn,4) EndIf ;FileMove(@ScriptDir&"\BinaryDetails.ini", @ScriptDir&"\BinaryDetails_old.ini", 0) ;MsgBox($MB_SYSTEMMODAL, "", "The return code from CreateSetup was: " & $iReturn) EndIf if(FileExists(@ScriptDir&"\CreateSetup.exe")) then Local $iReturn = Runwait(@ScriptDir&"\CreateSetup.exe", "", @SW_MAXIMIZE) if not @error Then ;Logging("execution completed successfully with Return Code: " & $iReturn,4) Else ;Logging("execution failed with Return Code: " & $iReturn,4) EndIf ;FileMove(@ScriptDir&"\BinaryDetails.ini", @ScriptDir&"\BinaryDetails_old.ini", 0) ;MsgBox($MB_SYSTEMMODAL, "", "The return code from CreateSetup was: " & $iReturn) EndIf EndIf WEnd Func Logging($sMessage,$sLogFile=@ScriptDir&"\Logging.log") If $sMessage = "" Then FileWriteLine($sLogFile, "") Else FileWrite($sLogFile,_NowCalc() & " :: " & $sMessage&@CRLF) EndIf EndFunc
Moderators JLogan3o13 Posted December 15, 2017 Moderators Posted December 15, 2017 (edited) @ur as usual it is like pulling teeth with you. How are we supposed to help you narrow down the problem when you have, by my count, 5 custom functions (WaitForINICompletion, SendMail, ChangeWin32, CheckZip, AppendBinaries) in there that you are not sharing with us? Edited December 15, 2017 by JLogan3o13 Earthshine 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Earthshine Posted December 15, 2017 Posted December 15, 2017 (edited) did you miss the CreateSetup.exe stuff? lol InstallShield comes with isbuild, you can automate your builds that. Edited December 15, 2017 by Earthshine My resources are limited. You must ask the right questions
ur Posted December 15, 2017 Author Posted December 15, 2017 Sorry @JLogan3o13 These are the au3 files.And the dependent library.au3 Createsetup.exe and copy.exe are tirdparty ones and we don't have source code with us. But anyway, the issue is before entering the if blocks. BackroundforBinaries.au3 Library.au3
careca Posted December 15, 2017 Posted December 15, 2017 (edited) copy and createsetup exe's running in background? I was late, but what do you mean before entering the if blocks? a sleep inside a loop doesnt use cpu at all. Edited December 15, 2017 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
ur Posted December 15, 2017 Author Posted December 15, 2017 No, I kept wait for the Binaries.ini file in the background. Only when the file appears or copied from another machine in the network to this folder, then the createsetup and copy exe file will run. But the CPU is 97% when it is still waiting
Earthshine Posted December 15, 2017 Posted December 15, 2017 (edited) that's probably not the whole script either. i'm done. have fun. i would look at it using ProcessViewer and see what resources it is using. That will probably answer your question. Edited December 15, 2017 by Earthshine My resources are limited. You must ask the right questions
ur Posted December 15, 2017 Author Posted December 15, 2017 (edited) Sorry @Earthshine, these are the main scripts. Are you getting any error during compilation? If it is for .ps1 files, just keep some dummy files, I don't have them also, they need for other fumctions in the library.au3 which we are not using here. Edited December 15, 2017 by ur
Earthshine Posted December 15, 2017 Posted December 15, 2017 (edited) ProcessExplorer from SysInternals is your friend. click on your running process that you think is sleeping and look at the dlls and other resources it uses. I do not believe that sleeping should release allocated resources. https://live.sysinternals.com/procexp64.exe https://live.sysinternals.com/procexp.exe you could also use ProcMon to see what's getting hit, registry, file system, etc.. https://live.sysinternals.com/Procmon.exe Edited December 15, 2017 by Earthshine My resources are limited. You must ask the right questions
careca Posted December 15, 2017 Posted December 15, 2017 Yea, this is not going anywhere. Comment functions one by one until you see a reduction in cpu usage, then you can focus on that specific function to see what's up. Good luck Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Developers Jos Posted December 15, 2017 Developers Posted December 15, 2017 1 hour ago, ur said: Sorry @JLogan3o13 These are the au3 files.And the dependent library.au3 Createsetup.exe and copy.exe are tirdparty ones and we don't have source code with us. But anyway, the issue is before entering the if blocks. BackroundforBinaries.au3 Library.au3 Unlike the others shooting from the hip at your lack of info provided: What did your debugging reveal? You can't come in here posting constantly these questions without having done some basic debugging yourself. (I am pretty sure I am repeating myself to you now!) You should know how to do this debugging by now, so start thinking for a change and doing the work yourself! Come back when you have more to show for. Jos Earthshine 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
careca Posted December 15, 2017 Posted December 15, 2017 2 hours ago, Jos said: ...shooting from the hip nice analogy Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe
Earthshine Posted December 15, 2017 Posted December 15, 2017 (edited) Yeah. Never post results from the console even. My current hypothesis is that us, he isn’t sleeping it’s doing something and he’s not aware of it because there’s no logging and he doesn’t know what the he k is going on Edited December 15, 2017 by Earthshine My resources are limited. You must ask the right questions
Developers Jos Posted December 15, 2017 Developers Posted December 15, 2017 You are just guessing while it is VERY simple to debug with the options available and a little effort. Earthshine 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts