Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
do while .t.
enddo
you were talking about measuring cpu usage with the help of the VB dll. Measuring the cpu usage of your App.exe, which may have several long running queries or loops within.Hannes214 said:..and the programm always shows 100 % ...
Local loCPUMonitorTimer
loCPUMonitorTimer = Createobject("CpuMonitorTimer")
loCPUMonitorTimer.Enabled = .t.
On Shutdown Clear Events
Read Events
loCPUMonitorTimer = .null.
Define Class CpuMonitorTimer As Timer
Interval = 2000
nCountDown = 5 && work for 5 intervals
Procedure Init()
This.AddProperty("oCPUMon",CreateObject("cpumon.cpuuse"))
Endproc
Procedure Timer()
? This.oCPUMon.cpuuse()
This.nCountDown = This.nCountDown -1
If This.nCountDown = 0
Clear Events
EndIf
Endproc
Enddefine
#Define ccMonitoredProcess "vfp6"
#Define ccMonitoredComputer "."
#Define ccAdminUsername ""
#Define ccAdminPassword ""
Local loCPUMonitorTimer
loCPUMonitorTimer = Createobject("CpuMonitorTimer",;
ccMonitoredProcess,ccMonitoredComputer,ccAdminUsername,ccAdminPassword)
On Shutdown Clear Events
Read Events
On Shutdown
loCPUMonitorTimer = .Null.
Define Class CpuMonitorTimer As Timer
Interval = 1000
*#Define cnIntervals 5
#IfDef cnIntervals
nCountDown = cnIntervals && work for several intervals only
#Endif
Procedure Init()
Lparameters tcMonitoredProcess, tcMonitoredComputer, tcAdminUsername, tcAdminPassword
If Vartype(tcMonitoredProcess)#"C"
Return .f.
EndIf
tcMonitoredComputer = IIf(Empty(tcMonitoredComputer), ".", tcMonitoredComputer)
tcAdminUsername = IIf(Empty(tcAdminUsername) , "" , tcAdminUsername)
tcAdminPassword = IIf(Empty(tcAdminPassword) , "" , tcAdminPassword)
Local loSWbemLocator, loSWbemServices
loSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
loSWbemServices = loSWbemLocator.ConnectServer(tcMonitoredComputer,"root\cimv2",;
tcAdminUsername, tcAdminPassword)
With This
.AddProperty([oPerfProcess],loSWbemServices.Get(;
[Win32_PerfFormattedData_PerfProc_Process.Name=']+tcMonitoredProcess+[']))
.oPerfProcess.Refresh_
EndWith
Endproc
Procedure Timer()
With This
.oPerfProcess.Refresh_
Set Message To "CPU usage: "+Transform(.oPerfProcess.PercentProcessorTime)+"%"
#IfDef cnIntervals
.nCountDown = .nCountDown -1
If .nCountDown = 0
Clear Events
EndIf
#Endif
Endwith
Endproc
Procedure Destroy()
This.oPerfProcess = .null.
Endproc
Enddefine