This commit is contained in:
zaccaria.majid
2023-05-17 12:27:31 +02:00
2 changed files with 581 additions and 388 deletions
+352 -287
View File
@@ -22,295 +22,355 @@ Partial Class ProcMan
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ProcMan))
Me.btnTestPing = New System.Windows.Forms.Button()
Me.lblpingTest = New System.Windows.Forms.Label()
Me.lblTestAlive = New System.Windows.Forms.Label()
Me.btnTestAlive = New System.Windows.Forms.Button()
Me.btnResetQueue = New System.Windows.Forms.Button()
Me.txtOut = New System.Windows.Forms.TextBox()
Me.btnQueueStatus = New System.Windows.Forms.Button()
Me.StartProcess = New System.Windows.Forms.Button()
Me.StopProcess = New System.Windows.Forms.Button()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tsProgBar = New System.Windows.Forms.ToolStripProgressBar()
Me.txtQueue = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtNumThread = New System.Windows.Forms.TextBox()
Me.lblRunning = New System.Windows.Forms.Label()
Me.TimerUI = New System.Windows.Forms.Timer(Me.components)
Me.TimerProgBar = New System.Windows.Forms.Timer(Me.components)
Me.LISTThreadStatus = New System.Windows.Forms.ListView()
Me.chThread = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.chTime = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.chOther = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.chkStatAggr = New System.Windows.Forms.CheckBox()
Me.btnExportStats = New System.Windows.Forms.Button()
Me.chkAutoRestart = New System.Windows.Forms.CheckBox()
Me.TimerCheck = New System.Windows.Forms.Timer(Me.components)
Me.StatusStrip1.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'btnTestPing
'
Me.btnTestPing.Location = New System.Drawing.Point(13, 13)
Me.btnTestPing.Name = "btnTestPing"
Me.btnTestPing.Size = New System.Drawing.Size(75, 23)
Me.btnTestPing.TabIndex = 0
Me.btnTestPing.Text = "Test Ping"
Me.btnTestPing.UseVisualStyleBackColor = True
'
'lblpingTest
'
Me.lblpingTest.AutoSize = True
Me.lblpingTest.Location = New System.Drawing.Point(115, 18)
Me.lblpingTest.Name = "lblpingTest"
Me.lblpingTest.Size = New System.Drawing.Size(25, 13)
Me.lblpingTest.TabIndex = 1
Me.lblpingTest.Text = "???"
'
'lblTestAlive
'
Me.lblTestAlive.AutoSize = True
Me.lblTestAlive.Location = New System.Drawing.Point(274, 18)
Me.lblTestAlive.Name = "lblTestAlive"
Me.lblTestAlive.Size = New System.Drawing.Size(25, 13)
Me.lblTestAlive.TabIndex = 3
Me.lblTestAlive.Text = "???"
'
'btnTestAlive
'
Me.btnTestAlive.Location = New System.Drawing.Point(172, 13)
Me.btnTestAlive.Name = "btnTestAlive"
Me.btnTestAlive.Size = New System.Drawing.Size(75, 23)
Me.btnTestAlive.TabIndex = 2
Me.btnTestAlive.Text = "Test Alive"
Me.btnTestAlive.UseVisualStyleBackColor = True
'
'btnResetQueue
'
Me.btnResetQueue.Location = New System.Drawing.Point(13, 163)
Me.btnResetQueue.Name = "btnResetQueue"
Me.btnResetQueue.Size = New System.Drawing.Size(75, 23)
Me.btnResetQueue.TabIndex = 6
Me.btnResetQueue.Text = "Reset Q"
Me.btnResetQueue.UseVisualStyleBackColor = True
'
'txtOut
'
Me.txtOut.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.txtOut.Font = New System.Drawing.Font("Roboto", 7.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtOut.ForeColor = System.Drawing.Color.Yellow
Me.txtOut.Location = New System.Drawing.Point(12, 195)
Me.txtOut.MinimumSize = New System.Drawing.Size(60, 120)
Me.txtOut.Multiline = True
Me.txtOut.Name = "txtOut"
Me.txtOut.Size = New System.Drawing.Size(75, 141)
Me.txtOut.TabIndex = 7
Me.txtOut.Text = "---"
'
'btnQueueStatus
'
Me.btnQueueStatus.Location = New System.Drawing.Point(13, 64)
Me.btnQueueStatus.Name = "btnQueueStatus"
Me.btnQueueStatus.Size = New System.Drawing.Size(75, 23)
Me.btnQueueStatus.TabIndex = 8
Me.btnQueueStatus.Text = "Stato Queue"
Me.btnQueueStatus.UseVisualStyleBackColor = True
'
'StartProcess
'
Me.StartProcess.Location = New System.Drawing.Point(13, 19)
Me.StartProcess.Name = "StartProcess"
Me.StartProcess.Size = New System.Drawing.Size(75, 23)
Me.StartProcess.TabIndex = 9
Me.StartProcess.Text = "Start"
Me.StartProcess.UseVisualStyleBackColor = True
'
'StopProcess
'
Me.StopProcess.Location = New System.Drawing.Point(244, 18)
Me.StopProcess.Name = "StopProcess"
Me.StopProcess.Size = New System.Drawing.Size(75, 23)
Me.StopProcess.TabIndex = 10
Me.StopProcess.Text = "Stop"
Me.StopProcess.UseVisualStyleBackColor = True
'
'StatusStrip1
'
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsProgBar})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 423)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Size = New System.Drawing.Size(552, 22)
Me.StatusStrip1.TabIndex = 11
Me.StatusStrip1.Text = "StatusStrip1"
'
'tsProgBar
'
Me.tsProgBar.Name = "tsProgBar"
Me.tsProgBar.Size = New System.Drawing.Size(100, 16)
Me.tsProgBar.Step = 1
'
'txtQueue
'
Me.txtQueue.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.txtQueue.Font = New System.Drawing.Font("Roboto", 7.0!)
Me.txtQueue.ForeColor = System.Drawing.SystemColors.Window
Me.txtQueue.Location = New System.Drawing.Point(13, 93)
Me.txtQueue.Multiline = True
Me.txtQueue.Name = "txtQueue"
Me.txtQueue.Size = New System.Drawing.Size(75, 64)
Me.txtQueue.TabIndex = 12
Me.txtQueue.Text = "Q Status:"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(99, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(30, 13)
Me.Label1.TabIndex = 13
Me.Label1.Text = "num:"
'
'txtNumThread
'
Me.txtNumThread.Location = New System.Drawing.Point(128, 21)
Me.txtNumThread.Name = "txtNumThread"
Me.txtNumThread.Size = New System.Drawing.Size(32, 20)
Me.txtNumThread.TabIndex = 14
Me.txtNumThread.Text = "1"
Me.txtNumThread.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'lblRunning
'
Me.lblRunning.AutoSize = True
Me.lblRunning.Location = New System.Drawing.Point(166, 24)
Me.lblRunning.MinimumSize = New System.Drawing.Size(75, 0)
Me.lblRunning.Name = "lblRunning"
Me.lblRunning.Size = New System.Drawing.Size(75, 13)
Me.lblRunning.TabIndex = 15
Me.lblRunning.Text = "running: -"
Me.lblRunning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TimerUI
'
Me.TimerUI.Interval = 300
'
'TimerProgBar
'
'
'LISTThreadStatus
'
Me.LISTThreadStatus.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.chThread, Me.chTime, Me.chOther})
Me.LISTThreadStatus.HideSelection = False
Me.LISTThreadStatus.Location = New System.Drawing.Point(13, 48)
Me.LISTThreadStatus.Name = "LISTThreadStatus"
Me.LISTThreadStatus.Size = New System.Drawing.Size(403, 302)
Me.LISTThreadStatus.TabIndex = 16
Me.LISTThreadStatus.UseCompatibleStateImageBehavior = False
Me.LISTThreadStatus.View = System.Windows.Forms.View.Details
'
'chThread
'
Me.chThread.Text = "Thread"
Me.chThread.Width = 100
'
'chTime
'
Me.chTime.Text = "Time"
Me.chTime.Width = 100
'
'chOther
'
Me.chOther.Text = "Other"
Me.chOther.Width = 100
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.chkStatAggr)
Me.GroupBox1.Controls.Add(Me.LISTThreadStatus)
Me.GroupBox1.Controls.Add(Me.lblRunning)
Me.GroupBox1.Controls.Add(Me.txtNumThread)
Me.GroupBox1.Controls.Add(Me.StopProcess)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.StartProcess)
Me.GroupBox1.Location = New System.Drawing.Point(118, 64)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(422, 356)
Me.GroupBox1.TabIndex = 17
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Threads"
'
'chkStatAggr
'
Me.chkStatAggr.AutoSize = True
Me.chkStatAggr.Checked = True
Me.chkStatAggr.CheckState = System.Windows.Forms.CheckState.Checked
Me.chkStatAggr.Location = New System.Drawing.Point(326, 21)
Me.chkStatAggr.Name = "chkStatAggr"
Me.chkStatAggr.Size = New System.Drawing.Size(75, 17)
Me.chkStatAggr.TabIndex = 17
Me.chkStatAggr.Text = "Aggr Stats"
Me.chkStatAggr.UseVisualStyleBackColor = True
'
'btnExportStats
'
Me.btnExportStats.Location = New System.Drawing.Point(459, 13)
Me.btnExportStats.Name = "btnExportStats"
Me.btnExportStats.Size = New System.Drawing.Size(75, 23)
Me.btnExportStats.TabIndex = 18
Me.btnExportStats.Text = "Export Stats"
Me.btnExportStats.UseVisualStyleBackColor = True
'
'chkAutoRestart
'
Me.chkAutoRestart.AutoSize = True
Me.chkAutoRestart.Checked = True
Me.chkAutoRestart.CheckState = System.Windows.Forms.CheckState.Checked
Me.chkAutoRestart.Location = New System.Drawing.Point(349, 17)
Me.chkAutoRestart.Name = "chkAutoRestart"
Me.chkAutoRestart.Size = New System.Drawing.Size(82, 17)
Me.chkAutoRestart.TabIndex = 19
Me.chkAutoRestart.Text = "AutoRestart"
Me.chkAutoRestart.UseVisualStyleBackColor = True
'
'TimerCheck
'
Me.TimerCheck.Interval = 30000
'
'ProcMan
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(552, 445)
Me.Controls.Add(Me.chkAutoRestart)
Me.Controls.Add(Me.btnExportStats)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.txtQueue)
Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.btnQueueStatus)
Me.Controls.Add(Me.txtOut)
Me.Controls.Add(Me.btnResetQueue)
Me.Controls.Add(Me.lblTestAlive)
Me.Controls.Add(Me.btnTestAlive)
Me.Controls.Add(Me.lblpingTest)
Me.Controls.Add(Me.btnTestPing)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "ProcMan"
Me.Text = "MainForm"
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ProcMan))
Me.btnTestPing = New System.Windows.Forms.Button()
Me.lblpingTest = New System.Windows.Forms.Label()
Me.lblTestAlive = New System.Windows.Forms.Label()
Me.btnTestAlive = New System.Windows.Forms.Button()
Me.btnResetQueue = New System.Windows.Forms.Button()
Me.txtOut = New System.Windows.Forms.TextBox()
Me.btnQueueStatus = New System.Windows.Forms.Button()
Me.StartProcess = New System.Windows.Forms.Button()
Me.StopProcess = New System.Windows.Forms.Button()
Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
Me.tsProgBar = New System.Windows.Forms.ToolStripProgressBar()
Me.txtQueue = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtNumThread = New System.Windows.Forms.TextBox()
Me.lblRunning = New System.Windows.Forms.Label()
Me.TimerUI = New System.Windows.Forms.Timer(Me.components)
Me.TimerProgBar = New System.Windows.Forms.Timer(Me.components)
Me.LISTThreadStatus = New System.Windows.Forms.ListView()
Me.chThread = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.chTime = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.chOther = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.ThreadCurrentStatusList = New System.Windows.Forms.ListView()
Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.chkStatAggr = New System.Windows.Forms.CheckBox()
Me.btnExportStats = New System.Windows.Forms.Button()
Me.chkAutoRestart = New System.Windows.Forms.CheckBox()
Me.TimerCheck = New System.Windows.Forms.Timer(Me.components)
Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ColumnHeader4 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.StatusStrip1.SuspendLayout()
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'btnTestPing
'
Me.btnTestPing.Location = New System.Drawing.Point(17, 16)
Me.btnTestPing.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnTestPing.Name = "btnTestPing"
Me.btnTestPing.Size = New System.Drawing.Size(100, 28)
Me.btnTestPing.TabIndex = 0
Me.btnTestPing.Text = "Test Ping"
Me.btnTestPing.UseVisualStyleBackColor = True
'
'lblpingTest
'
Me.lblpingTest.AutoSize = True
Me.lblpingTest.Location = New System.Drawing.Point(153, 22)
Me.lblpingTest.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblpingTest.Name = "lblpingTest"
Me.lblpingTest.Size = New System.Drawing.Size(28, 16)
Me.lblpingTest.TabIndex = 1
Me.lblpingTest.Text = "???"
'
'lblTestAlive
'
Me.lblTestAlive.AutoSize = True
Me.lblTestAlive.Location = New System.Drawing.Point(365, 22)
Me.lblTestAlive.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblTestAlive.Name = "lblTestAlive"
Me.lblTestAlive.Size = New System.Drawing.Size(28, 16)
Me.lblTestAlive.TabIndex = 3
Me.lblTestAlive.Text = "???"
'
'btnTestAlive
'
Me.btnTestAlive.Location = New System.Drawing.Point(229, 16)
Me.btnTestAlive.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnTestAlive.Name = "btnTestAlive"
Me.btnTestAlive.Size = New System.Drawing.Size(100, 28)
Me.btnTestAlive.TabIndex = 2
Me.btnTestAlive.Text = "Test Alive"
Me.btnTestAlive.UseVisualStyleBackColor = True
'
'btnResetQueue
'
Me.btnResetQueue.Location = New System.Drawing.Point(17, 201)
Me.btnResetQueue.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnResetQueue.Name = "btnResetQueue"
Me.btnResetQueue.Size = New System.Drawing.Size(100, 28)
Me.btnResetQueue.TabIndex = 6
Me.btnResetQueue.Text = "Reset Q"
Me.btnResetQueue.UseVisualStyleBackColor = True
'
'txtOut
'
Me.txtOut.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.txtOut.Font = New System.Drawing.Font("Microsoft Sans Serif", 7.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtOut.ForeColor = System.Drawing.Color.Yellow
Me.txtOut.Location = New System.Drawing.Point(16, 240)
Me.txtOut.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtOut.MinimumSize = New System.Drawing.Size(79, 147)
Me.txtOut.Multiline = True
Me.txtOut.Name = "txtOut"
Me.txtOut.Size = New System.Drawing.Size(99, 173)
Me.txtOut.TabIndex = 7
Me.txtOut.Text = "---"
'
'btnQueueStatus
'
Me.btnQueueStatus.Location = New System.Drawing.Point(17, 79)
Me.btnQueueStatus.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnQueueStatus.Name = "btnQueueStatus"
Me.btnQueueStatus.Size = New System.Drawing.Size(100, 28)
Me.btnQueueStatus.TabIndex = 8
Me.btnQueueStatus.Text = "Stato Queue"
Me.btnQueueStatus.UseVisualStyleBackColor = True
'
'StartProcess
'
Me.StartProcess.Location = New System.Drawing.Point(17, 23)
Me.StartProcess.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.StartProcess.Name = "StartProcess"
Me.StartProcess.Size = New System.Drawing.Size(100, 28)
Me.StartProcess.TabIndex = 9
Me.StartProcess.Text = "Start"
Me.StartProcess.UseVisualStyleBackColor = True
'
'StopProcess
'
Me.StopProcess.Location = New System.Drawing.Point(325, 22)
Me.StopProcess.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.StopProcess.Name = "StopProcess"
Me.StopProcess.Size = New System.Drawing.Size(100, 28)
Me.StopProcess.TabIndex = 10
Me.StopProcess.Text = "Stop"
Me.StopProcess.UseVisualStyleBackColor = True
'
'StatusStrip1
'
Me.StatusStrip1.ImageScalingSize = New System.Drawing.Size(20, 20)
Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsProgBar})
Me.StatusStrip1.Location = New System.Drawing.Point(0, 526)
Me.StatusStrip1.Name = "StatusStrip1"
Me.StatusStrip1.Padding = New System.Windows.Forms.Padding(1, 0, 19, 0)
Me.StatusStrip1.Size = New System.Drawing.Size(736, 22)
Me.StatusStrip1.TabIndex = 11
Me.StatusStrip1.Text = "StatusStrip1"
'
'tsProgBar
'
Me.tsProgBar.Name = "tsProgBar"
Me.tsProgBar.Size = New System.Drawing.Size(133, 14)
Me.tsProgBar.Step = 1
'
'txtQueue
'
Me.txtQueue.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.txtQueue.Font = New System.Drawing.Font("Microsoft Sans Serif", 7.0!)
Me.txtQueue.ForeColor = System.Drawing.SystemColors.Window
Me.txtQueue.Location = New System.Drawing.Point(17, 114)
Me.txtQueue.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtQueue.Multiline = True
Me.txtQueue.Name = "txtQueue"
Me.txtQueue.Size = New System.Drawing.Size(99, 78)
Me.txtQueue.TabIndex = 12
Me.txtQueue.Text = "Q Status:"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(132, 30)
Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(35, 16)
Me.Label1.TabIndex = 13
Me.Label1.Text = "num:"
'
'txtNumThread
'
Me.txtNumThread.Location = New System.Drawing.Point(171, 26)
Me.txtNumThread.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.txtNumThread.Name = "txtNumThread"
Me.txtNumThread.Size = New System.Drawing.Size(41, 22)
Me.txtNumThread.TabIndex = 14
Me.txtNumThread.Text = "1"
Me.txtNumThread.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'lblRunning
'
Me.lblRunning.AutoSize = True
Me.lblRunning.Location = New System.Drawing.Point(221, 30)
Me.lblRunning.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
Me.lblRunning.MinimumSize = New System.Drawing.Size(100, 0)
Me.lblRunning.Name = "lblRunning"
Me.lblRunning.Size = New System.Drawing.Size(100, 16)
Me.lblRunning.TabIndex = 15
Me.lblRunning.Text = "running: -"
Me.lblRunning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'TimerUI
'
Me.TimerUI.Interval = 800
'
'TimerProgBar
'
'
'LISTThreadStatus
'
Me.LISTThreadStatus.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.chThread, Me.chTime, Me.chOther})
Me.LISTThreadStatus.HideSelection = False
Me.LISTThreadStatus.Location = New System.Drawing.Point(17, 59)
Me.LISTThreadStatus.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.LISTThreadStatus.Name = "LISTThreadStatus"
Me.LISTThreadStatus.Size = New System.Drawing.Size(536, 173)
Me.LISTThreadStatus.TabIndex = 16
Me.LISTThreadStatus.UseCompatibleStateImageBehavior = False
Me.LISTThreadStatus.View = System.Windows.Forms.View.Details
'
'chThread
'
Me.chThread.Text = "Thread"
Me.chThread.Width = 100
'
'chTime
'
Me.chTime.Text = "Time"
Me.chTime.Width = 100
'
'chOther
'
Me.chOther.Text = "Other"
Me.chOther.Width = 100
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.ThreadCurrentStatusList)
Me.GroupBox1.Controls.Add(Me.chkStatAggr)
Me.GroupBox1.Controls.Add(Me.LISTThreadStatus)
Me.GroupBox1.Controls.Add(Me.lblRunning)
Me.GroupBox1.Controls.Add(Me.txtNumThread)
Me.GroupBox1.Controls.Add(Me.StopProcess)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.StartProcess)
Me.GroupBox1.Location = New System.Drawing.Point(157, 79)
Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.GroupBox1.Size = New System.Drawing.Size(563, 438)
Me.GroupBox1.TabIndex = 17
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Threads"
'
'ThreadCurrentStatusList
'
Me.ThreadCurrentStatusList.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2, Me.ColumnHeader4, Me.ColumnHeader3})
Me.ThreadCurrentStatusList.HideSelection = False
Me.ThreadCurrentStatusList.Location = New System.Drawing.Point(17, 257)
Me.ThreadCurrentStatusList.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.ThreadCurrentStatusList.Name = "ThreadCurrentStatusList"
Me.ThreadCurrentStatusList.Size = New System.Drawing.Size(536, 173)
Me.ThreadCurrentStatusList.TabIndex = 18
Me.ThreadCurrentStatusList.UseCompatibleStateImageBehavior = False
Me.ThreadCurrentStatusList.View = System.Windows.Forms.View.Details
'
'ColumnHeader1
'
Me.ColumnHeader1.Text = "Thread"
Me.ColumnHeader1.Width = 100
'
'ColumnHeader2
'
Me.ColumnHeader2.Text = "Thread Status"
Me.ColumnHeader2.Width = 100
'
'chkStatAggr
'
Me.chkStatAggr.AutoSize = True
Me.chkStatAggr.Checked = True
Me.chkStatAggr.CheckState = System.Windows.Forms.CheckState.Checked
Me.chkStatAggr.Location = New System.Drawing.Point(435, 26)
Me.chkStatAggr.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.chkStatAggr.Name = "chkStatAggr"
Me.chkStatAggr.Size = New System.Drawing.Size(91, 20)
Me.chkStatAggr.TabIndex = 17
Me.chkStatAggr.Text = "Aggr Stats"
Me.chkStatAggr.UseVisualStyleBackColor = True
'
'btnExportStats
'
Me.btnExportStats.Location = New System.Drawing.Point(612, 16)
Me.btnExportStats.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.btnExportStats.Name = "btnExportStats"
Me.btnExportStats.Size = New System.Drawing.Size(100, 28)
Me.btnExportStats.TabIndex = 18
Me.btnExportStats.Text = "Export Stats"
Me.btnExportStats.UseVisualStyleBackColor = True
'
'chkAutoRestart
'
Me.chkAutoRestart.AutoSize = True
Me.chkAutoRestart.Location = New System.Drawing.Point(465, 21)
Me.chkAutoRestart.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.chkAutoRestart.Name = "chkAutoRestart"
Me.chkAutoRestart.Size = New System.Drawing.Size(99, 20)
Me.chkAutoRestart.TabIndex = 19
Me.chkAutoRestart.Text = "AutoRestart"
Me.chkAutoRestart.UseVisualStyleBackColor = True
'
'TimerCheck
'
Me.TimerCheck.Interval = 30000
'
'ColumnHeader3
'
Me.ColumnHeader3.DisplayIndex = 2
Me.ColumnHeader3.Text = "Process Status"
Me.ColumnHeader3.Width = 100
'
'ColumnHeader4
'
Me.ColumnHeader4.DisplayIndex = 3
Me.ColumnHeader4.Text = "Thread Phase"
Me.ColumnHeader4.Width = 100
'
'ProcMan
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(736, 548)
Me.Controls.Add(Me.chkAutoRestart)
Me.Controls.Add(Me.btnExportStats)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.txtQueue)
Me.Controls.Add(Me.StatusStrip1)
Me.Controls.Add(Me.btnQueueStatus)
Me.Controls.Add(Me.txtOut)
Me.Controls.Add(Me.btnResetQueue)
Me.Controls.Add(Me.lblTestAlive)
Me.Controls.Add(Me.btnTestAlive)
Me.Controls.Add(Me.lblpingTest)
Me.Controls.Add(Me.btnTestPing)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.Name = "ProcMan"
Me.Text = "MainForm"
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
End Sub
Friend WithEvents btnTestPing As Button
Friend WithEvents btnTestPing As Button
Friend WithEvents lblpingTest As Label
Friend WithEvents lblTestAlive As Label
Friend WithEvents btnTestAlive As Button
@@ -336,4 +396,9 @@ Partial Class ProcMan
Friend WithEvents btnExportStats As Button
Friend WithEvents chkAutoRestart As CheckBox
Friend WithEvents TimerCheck As Timer
Friend WithEvents ThreadCurrentStatusList As ListView
Friend WithEvents ColumnHeader1 As ColumnHeader
Friend WithEvents ColumnHeader2 As ColumnHeader
Friend WithEvents ColumnHeader3 As ColumnHeader
Friend WithEvents ColumnHeader4 As ColumnHeader
End Class
+229 -101
View File
@@ -15,17 +15,19 @@ Public Class ProcMan
' Add any initialization after the InitializeComponent() call.
synchronizationContext = SynchronizationContext.Current
' preparo lista thread...
'Begin the update
LISTThreadStatus.BeginUpdate()
'clear the List
LISTThreadStatus.Items.Clear()
'Add init
LISTThreadStatus.Items.Add(New ListViewItem(New String() {"init", "waiting", "-"}))
'End the update
LISTThreadStatus.EndUpdate()
m_bStopProcess = True
SetMaxCamInstances(1)
StartUiThread()
startAllThreads()
' preparo lista thread...
LISTThreadStatus.BeginUpdate()
LISTThreadStatus.Items.Clear()
LISTThreadStatus.Items.Add(New ListViewItem(New String() {"init", "waiting", "-"}))
LISTThreadStatus.EndUpdate()
' verifico SE avviare
If chkAutoRestart.Checked Then
startAllThreads()
End If
CheckStartAutoRestart()
End Sub
@@ -62,10 +64,74 @@ Public Class ProcMan
Dim ThreadList As Thread()
Dim ThreadDataList As ThreadData()
#End Region
Enum ThreadOperations As Integer
WaitingData = 1
FoundRequest = 2
WritingDdf = 3
ProcessingDdf = 4
ReadingSvg = 5
SendResult = 6
Closed = 10
End Enum
Private Class ThreadData
Private m_ThreadOperation As ThreadOperations
Public ReadOnly Property ThreadOperation As ThreadOperations
Get
Return m_ThreadOperation
End Get
End Property
Friend Sub SetThreadOperation(value As ThreadOperations)
m_ThreadOperation = value
End Sub
Private m_Process As Process
Public ReadOnly Property Process As Process
Get
Return m_Process
End Get
End Property
Friend Sub SetProcess(value As Process)
m_Process = value
End Sub
End Class
#Region "Private Methods"
Private Sub UpdateThreadCurrentStatus()
synchronizationContext.Post(New SendOrPostCallback(
Sub(o)
ThreadCurrentStatusList.BeginUpdate()
ThreadCurrentStatusList.Items.Clear()
If Not IsNothing(ThreadList) Then
For ThreadIndex = 0 To ThreadList.Count - 1
If Not IsNothing(ThreadList(ThreadIndex)) Then
Dim ThreadProcessState As String = "Nothing"
'If Not IsNothing(ThreadDataList(ThreadIndex)) AndAlso Not IsNothing(ThreadDataList(ThreadIndex).Process) AndAlso
'Not IsNothing(ThreadDataList(ThreadIndex).Process.HasExited) Then
' ThreadProcessState = ThreadDataList(ThreadIndex).Process.HasExited
'End If
ThreadCurrentStatusList.Items.Add(New ListViewItem(New String() {ThreadIndex,
ThreadList(ThreadIndex).ThreadState.ToString(),
ThreadProcessState,
ThreadDataList(ThreadIndex).ThreadOperation.ToString()}))
Else
ThreadCurrentStatusList.Items.Add(New ListViewItem(New String() {ThreadIndex,
"nothing"}))
End If
Next
End If
ThreadCurrentStatusList.EndUpdate()
End Sub), "")
End Sub
Private Sub btnQueueStatus_Click(sender As Object, e As EventArgs) Handles btnQueueStatus.Click
DisplayQueueStatus()
End Sub
@@ -157,10 +223,12 @@ Public Class ProcMan
End While
If bOk AndAlso (IsNothing(ThreadList) OrElse ThreadList.Count = 0 OrElse IsNothing(ThreadList(0))) Then
ThreadList = New Thread(m_MaxCamInstances) {}
ThreadList = New Thread(m_MaxCamInstances - 1) {}
ThreadDataList = New ThreadData(m_MaxCamInstances - 1) {}
For nThreadIndex = 0 To m_MaxCamInstances - 1
Dim ThreadId As Integer = nThreadIndex
ThreadList(nThreadIndex) = New Thread(Sub()
ThreadFunction()
ThreadFunction(ThreadId)
End Sub)
ThreadList(nThreadIndex).SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
@@ -168,6 +236,17 @@ Public Class ProcMan
Thread.Sleep(10)
Next
End If
' se qualche processo in stop, lo faccio ripartire
For ThreadIndex = 0 To ThreadList.Count - 1
Dim Thread = ThreadList(ThreadIndex)
If Thread.ThreadState = ThreadState.Stopped Then
Thread.Abort()
Dim ThreadId As Integer = ThreadIndex
Thread = New Thread(Sub()
ThreadFunction(ThreadId)
End Sub)
End If
Next
If n30SecCounter <= 30 Then
n30SecCounter += 1
Else
@@ -195,45 +274,45 @@ Public Class ProcMan
Private Sub performBarAdvance()
synchronizationContext.Post(New SendOrPostCallback(
Sub(o)
tsProgBar.PerformStep()
If tsProgBar.Value >= tsProgBar.Maximum Then
tsProgBar.Value = 0
End If
Sub(o)
tsProgBar.PerformStep()
If tsProgBar.Value >= tsProgBar.Maximum Then
tsProgBar.Value = 0
End If
tsProgBar.Invalidate()
End Sub
), "")
tsProgBar.Invalidate()
End Sub
), "")
End Sub
Private Sub performUpdateUI()
synchronizationContext.Post(New SendOrPostCallback(
Sub(o)
'verifico thread attivi e se calano --> riavvia..
If ThreadCount() <> m_MaxCamInstances And Not m_bStopProcess Then
stopAllThreads()
Thread.Sleep(100)
startAllThreads()
End If
Sub(o)
'verifico thread attivi e se calano --> riavvia..
If ThreadCount() <> m_MaxCamInstances And Not m_bStopProcess Then
stopAllThreads()
Thread.Sleep(100)
startAllThreads()
End If
lblRunning.Text = $"threads: {ThreadCount()}/{m_MaxCamInstances}"
lblRunning.Invalidate()
DisplayQueueStatus()
' colore btn start / stop...
If m_bStopProcess Then
lblRunning.Text = $"threads: {ThreadCount()}/{m_MaxCamInstances}"
lblRunning.Invalidate()
DisplayQueueStatus()
' colore btn start / stop...
If m_bStopProcess Then
StartProcess.BackColor = ButtonBase.DefaultBackColor
StartProcess.ForeColor = ButtonBase.DefaultForeColor
StopProcess.BackColor = Color.Green
StopProcess.ForeColor = Color.White
Else
StartProcess.BackColor = Color.Green
StartProcess.ForeColor = Color.White
StopProcess.BackColor = ButtonBase.DefaultBackColor
StopProcess.ForeColor = ButtonBase.DefaultForeColor
End If
End Sub
), "")
StartProcess.BackColor = ButtonBase.DefaultBackColor
StartProcess.ForeColor = ButtonBase.DefaultForeColor
StopProcess.BackColor = Color.Green
StopProcess.ForeColor = Color.White
Else
StartProcess.BackColor = Color.Green
StartProcess.ForeColor = Color.White
StopProcess.BackColor = ButtonBase.DefaultBackColor
StopProcess.ForeColor = ButtonBase.DefaultForeColor
End If
End Sub
), "")
End Sub
Private Sub SetMaxCamInstances(value As Integer)
@@ -244,10 +323,6 @@ Public Class ProcMan
Private Sub startAllThreads()
m_bStopProcess = False
'' fix colori
'StartProcess.BackColor = Color.Green
'StartProcess.ForeColor = Color.White
m_ExecutionThread = New Thread(Sub()
ExecutionProcess()
End Sub)
@@ -255,10 +330,6 @@ Public Class ProcMan
m_ExecutionThread.SetApartmentState(ApartmentState.STA)
' avvio thread di gestione della macchina che avvia la connessione
m_ExecutionThread.Start()
' avvio il timer di refresh
TimerProgBar.Enabled = True
TimerProgBar.Start()
#If False Then
'' recupero Id dei DDF
'Dim sDdfRoot As String = "c:\EgtData\WebDoor\Ddf"
@@ -497,6 +568,10 @@ Public Class ProcMan
' avvio timer progBar
TimerUI.Enabled = True
TimerUI.Start()
' avvio il timer di refresh
TimerProgBar.Enabled = True
TimerProgBar.Start()
End Sub
Private Sub stopAllThreads()
@@ -529,8 +604,9 @@ Public Class ProcMan
Return numCount
End Function
Private Sub ThreadFunction()
Private Sub ThreadFunction(ThreadIndex As Integer)
Dim MyThreadData As New ThreadData
ThreadDataList(ThreadIndex) = MyThreadData
Dim sExePath As String = "c:\EgtProg\EgtEngine\EgtEngineR32.exe"
Dim sCurrDdfDir As String = "c:\EgtData\WebDoor\Ddf"
Dim stopWatch As New Stopwatch()
@@ -538,12 +614,12 @@ Public Class ProcMan
Dim lOtherTime As Long = 0
While Not m_bStopProcess
MyThreadData.SetThreadOperation(ThreadOperations.WaitingData)
' se c'e' qualcosa da processare
If currWDC.numTask2proc > 0 Then
Dim LastRequest As Dictionary(Of String, String) = currWDC.queueList(1)
If LastRequest.Count > 0 Then
MyThreadData.SetThreadOperation(ThreadOperations.FoundRequest)
Dim Item As KeyValuePair(Of String, String) = LastRequest.First()
Dim bOk As Boolean = Not IsNothing(Item)
If bOk Then
@@ -561,6 +637,7 @@ Public Class ProcMan
End If
' scrivo ddf
MyThreadData.SetThreadOperation(ThreadOperations.WritingDdf)
Dim sDdfPath As String = sCurrDdfDir & "\" & Item.Key & ".ddf"
Try
File.WriteAllText(sDdfPath, Item.Value)
@@ -569,9 +646,11 @@ Public Class ProcMan
End Try
If bOk Then
MyThreadData.SetThreadOperation(ThreadOperations.ProcessingDdf)
' eseguo calcolo
Dim Proc As New Process()
Dim Proc As Process = New Process()
MyThreadData.SetProcess(Proc)
Proc.StartInfo.FileName = sExePath
Proc.StartInfo.Arguments = """C:\EgtData\WebDoor\Main.lua""" & " """ & sDdfPath & """"
Proc.StartInfo.UseShellExecute = False
@@ -581,6 +660,7 @@ Public Class ProcMan
While Not Proc.HasExited
Thread.Sleep(1)
End While
MyThreadData.SetProcess(Nothing)
' salvo exe time...
stopWatch.Stop()
lExeTime = stopWatch.ElapsedMilliseconds
@@ -588,6 +668,7 @@ Public Class ProcMan
Dim procResults As New List(Of CalcResultDTO)
Dim currRes As New CalcResultDTO
Dim fContent As String = ""
MyThreadData.SetThreadOperation(ThreadOperations.ReadingSvg)
' verifico esistenza file svg e lo carico
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "svg"), fContent)
' invio risposta
@@ -600,6 +681,7 @@ Public Class ProcMan
bOk = GetFileContent(Path.ChangeExtension(sDdfPath, "txt"), fContent)
currRes.ErrorMsg = fContent
End If
MyThreadData.SetThreadOperation(ThreadOperations.SendResult)
procResults.Add(currRes)
Dim respPut As String = currWDC.SendProcResults(procResults)
@@ -608,14 +690,57 @@ Public Class ProcMan
lOtherTime = stopWatch.ElapsedMilliseconds
' aggiorno thread display...
UpdateThreadList(Item.Key, lExeTime, lOtherTime)
' cambio nomi file generati in old
Dim OldSvg As String = Path.ChangeExtension(sDdfPath, "svg")
Dim NewSvg As String = Path.GetDirectoryName(sDdfPath) & "\" & Path.GetFileNameWithoutExtension(sDdfPath) & "_old.svg"
Try
File.Delete(NewSvg)
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "txt"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "log"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "nge"))
Catch ex As Exception
End Try
Try
File.Delete(Path.ChangeExtension(NewSvg, "ddf"))
Catch ex As Exception
End Try
Try
File.Move(OldSvg, NewSvg)
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "txt"), Path.ChangeExtension(NewSvg, "txt"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "log"), Path.ChangeExtension(NewSvg, "log"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "nge"), Path.ChangeExtension(NewSvg, "nge"))
Catch ex As Exception
End Try
Try
File.Move(Path.ChangeExtension(OldSvg, "ddf"), Path.ChangeExtension(NewSvg, "ddf"))
Catch ex As Exception
End Try
End If
stopWatch.Stop()
End If
End If
End If
End If
End While
MyThreadData.SetThreadOperation(ThreadOperations.Closed)
End Sub
@@ -627,6 +752,7 @@ Public Class ProcMan
Private Sub TimerUI_Tick(sender As Object, e As EventArgs) Handles TimerUI.Tick
' effettuo refresh code e status thread
performUpdateUI()
UpdateThreadCurrentStatus()
End Sub
Private Sub txtNumThread_TextChanged(sender As Object, e As EventArgs) Handles txtNumThread.TextChanged
@@ -634,9 +760,11 @@ Public Class ProcMan
Integer.TryParse(txtNumThread.Text, numReq)
' controllo se cambiato il num thread
If numReq <> m_MaxCamInstances Then
stopAllThreads()
If m_bStopProcess = False Then
stopAllThreads()
End If
' imposto
SetMaxCamInstances(numReq)
'startAllThreads()
End If
End Sub
@@ -647,52 +775,52 @@ Public Class ProcMan
''' </summary>
Private Sub UpdateThreadList(tId As String, tExeCam As Long, tOther As Long)
synchronizationContext.Post(New SendOrPostCallback(
Sub(o)
If Not isUpdatingThreads Then
isUpdatingThreads = True
ProcStats.RecordData(m_MaxCamInstances, tExeCam, tOther)
ProcStats.RecordList.Enqueue((tId, tExeCam, tOther))
'Begin the update
LISTThreadStatus.BeginUpdate()
LISTThreadStatus.Items.Clear()
Sub(o)
If Not isUpdatingThreads Then
isUpdatingThreads = True
ProcStats.RecordData(m_MaxCamInstances, tExeCam, tOther)
ProcStats.RecordList.Enqueue((tId, tExeCam, tOther))
'Begin the update
LISTThreadStatus.BeginUpdate()
LISTThreadStatus.Items.Clear()
' compilo in base al tipo di stat richiesta
If (chkStatAggr.Checked) Then
' statistiche di sintesi
Dim sorted = From pair In ProcStats.ExeCumSum
Order By pair.Key
For Each item In sorted
LISTThreadStatus.Items.Add(
New ListViewItem(New String() {item.Key,
$"{item.Value.NumRec} x {item.Value.ExeTime / item.Value.NumRec:N2} ms",
$"{item.Value.NumRec} x {item.Value.OthTime / item.Value.NumRec:N2} ms"
}))
Next
Else
' formato log
Dim maxItems As Integer = 15
While ProcStats.RecordList.Count > maxItems
Dim oldItem As (String, Long, Long) = ("", 0, 0)
ProcStats.RecordList.TryDequeue(oldItem)
End While
' compilo in base al tipo di stat richiesta
If (chkStatAggr.Checked) Then
' statistiche di sintesi
Dim sorted = From pair In ProcStats.ExeCumSum
Order By pair.Key
For Each item In sorted
LISTThreadStatus.Items.Add(
New ListViewItem(New String() {item.Key,
$"{item.Value.NumRec} x {item.Value.ExeTime / item.Value.NumRec:N2} ms",
$"{item.Value.NumRec} x {item.Value.OthTime / item.Value.NumRec:N2} ms"
}))
Next
Else
' formato log
Dim maxItems As Integer = 15
While ProcStats.RecordList.Count > maxItems
Dim oldItem As (String, Long, Long) = ("", 0, 0)
ProcStats.RecordList.TryDequeue(oldItem)
End While
For Each item As (String, Long, Long) In ProcStats.RecordList.Reverse
LISTThreadStatus.Items.Add(New ListViewItem(New String() {
item.Item1,
$"{item.Item2} ms",
$"{item.Item3} ms"
}))
Next
For Each item As (String, Long, Long) In ProcStats.RecordList.Reverse
LISTThreadStatus.Items.Add(New ListViewItem(New String() {
item.Item1,
$"{item.Item2} ms",
$"{item.Item3} ms"
}))
Next
End If
End If
'End the update
LISTThreadStatus.EndUpdate()
isUpdatingThreads = False
End If
End Sub
), "")
'End the update
LISTThreadStatus.EndUpdate()
isUpdatingThreads = False
End If
End Sub
), "")
End Sub