Gianni Posted October 11, 2015 Share Posted October 11, 2015 (edited) Good morning,what I would to understand is:1) There are many processes that are running at the same time, they try to access the Labels located on a Gui belonging to another main process, and change the contents of various Labels.2) The process that holds the Labels, makes no processing, but should only passively receive the updates of the labels performed directly by the other processes running separately.3) Therefore, the "Main" script generates just 1,000 controls of type "Label" on his Gui, then it spawn several independent processes, passing to each one of them through the command line, references to his labels that it must manage, then it simply remains idle and on pause.4) On the other side, spawn processes performs separate updates to the Label controls located on the Gui of the main process.now the question is:The various processes running independently, will update the labels on the Gui of the Main process, one after one or in parallel?the system I've written here as test as a whole works, but how can I tell if the label controls are updated in parallel or in serial?and if it is updated in serial mode, then where is the bottleneck?Before you run the script Main, you have to compile the TX script As TX.exeMain script: (it generates a matrix of labels on his gui and then spawn other separate processes)expandcollapse popup#include <Array.au3> Local $Step = 200; number of "Label" reference passed to separate processes HotKeySet("{Esc}", "End") ; Create a GUI containing a matrix of little squares (made by "Label" controls) Local $hGui = GUICreate('Test', 810, 330) GUISetBkColor("0x9A9A9A", $hGui) ; create the "panel" of labels within the GUI. All IDs of the labels are returned in an Array Local $aGuiCtrlsMatrix = _GUICtrlsMatrix_Create(5, 5, 50, 20, 15, 15) GUISetState(@SW_SHOW) ; now spawn some "external" processes that should updete the labels Local $Parameters For $i = 0 To UBound($aGuiCtrlsMatrix) - 1 Step $Step ; generates the string containing the group of label's IDs to be passed as parameter to the spawn process $Parameters = StringStripWS(_ArrayToString($aGuiCtrlsMatrix, " ", $i, $i + $Step - 1), 7) $Parameters = $hGui & ' ' & $Parameters ; insert the handle of the Main window as a further parameter ConsoleWrite($Parameters & @CRLF) ; Debug: show the $parameters on console ; Run('.\TX.exe ' & $Parameters) ; ,"",@SW_MINIMIZE) ; Spawn processes and pass parameters Next Sleep(1000) WinActivate($hGui) MsgBox(0, "Pause", "Waiting for Godot...") ; just stay in pause and idle GUIDelete($hGui) Exit Func _GUICtrlsMatrix_Create($xPanelPos, $yPanelPos, $nrPerLine, $nrOfLines, $Width, $Height, $xSpace = 1, $ySpace = 1) Local $aGuiControls[$nrPerLine * $nrOfLines];,$aPanelParams[] For $i = 1 To $nrPerLine * $nrOfLines $row = Int($i / $nrPerLine) + Not (Not (Mod($i, $nrPerLine))) $col = $i - ($row * $nrPerLine - $nrPerLine) $left = $xPanelPos + (($Width + $xSpace) * $col) - ($Width + $xSpace) $top = $yPanelPos + (($Height + $ySpace) * $row) - ($Height + $ySpace) $aGuiControls[$i - 1] = GUICtrlCreateLabel("", $left, $top, $Width, $Height, 0x01) ; 0x01 -> center text in the label GUICtrlSetBkColor(-1, "0xFFFFFF") ; "0x757575") ; GUICtrlSetTip(-1, "Control " & $i & @LF & "Row:" & $row & " Col:" & $col & @LF & "Empty") Next Return $aGuiControls EndFunc ;==>_GUICtrlsMatrix_Create Func End() If WinActive($hGui) Then GUIDelete($hGui) Exit EndIf EndFunc ;==>End TX script (it will update labels located on the main process) it must be compiled as TX.exe before running the Main script.#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; ----------------------------------------------------------------------- ; riceves parameter (IDs references to labels on Main process) If Not $CmdLine[0] Then MsgBox(0, "Error", "Missing parameters" & @CRLF & "Exit in 5 seconds", 5) Exit EndIf ; ----------------------------------------------------------------------- ; _ArrayDisplay($CmdLine) ; Debug: Check received parameters SRandom(@MSEC) While 1 ; infinite loop to continuously update labels on Main process with random ascii chars For $i = 2 To $CmdLine[0] ; start from 2 to skip HWnd ControlSetText(HWnd($CmdLine[1]), "", "[ID:" & $CmdLine[$i] & "]", Chr(Random(33, 127, 1))) Next WEnd Thnks for answers Edited October 11, 2015 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
JohnOne Posted October 11, 2015 Share Posted October 11, 2015 TX.exe updates labels sequentially / serialEach of those updates at the same time / parallel Any bottle neck with be the main process handling its window message queue. Gianni 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Gianni Posted October 11, 2015 Author Share Posted October 11, 2015 Thanks JohnOne for the answer.Hmmm.... so, the message queue of the main process window is the bottle neck...(....as already pointed out by Melba23 in this previous Topic, but it was not very clear to me the cause of the bottle neck. (my fault))Well thanks JohnOne for clearing the point. Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now