Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Process Info Form Remote Computer
Message
 
To
11/01/2008 14:20:51
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01281190
Message ID:
01281227
Views:
6
>This is good but how do I get the cpu usage value?

Ah, I thought you wanted to know the process that were running. Wait me a second.

[Update]
Oops! Doh, now I understand the question, you want the CPU usage for each of the processes... I need to think that one

[Update 2]

Well, I can not continue looking for this, it seems as if I can get the Percentaje of CPU at a given time but not the actual value, I think you should use the Performance classes of WMI for this, but I never used them other that to see them, never looked into them, see if this helps
lparameters tcComputer, tcProcess
local lcComputer, loWMI, loProcess, loProcesses, lcProcess

lcComputer			= Iif(Vartype(tcComputer) = 'C' and not Empty(tcComputer), tcComputer, '.')
lcProcess			= Iif(Vartype(tcProcess) = 'C', tcProcess, '')
loLocator			= CREATEOBJECT('WBEMScripting.SWBEMLocator')
loWMI				= loLocator.ConnectServer(lcComputer)
loPerfDataCol			= loWMI.ExecQuery('Select * from Win32_PerfFormattedData_PerfProc_Process')
for each loPerfData in loPerfDataCol
	with loPerfData
			? .Caption, .CreatingProcessID, .Description, .PercentProcessorTime, .ElapsedTime, .Name
	endwith
endfor
To see more properties for this class go to http://msdn2.microsoft.com/en-us/library/aa394277.aspx

Also take a look at all the Win32_PerfFormatted* and Win32_PerfRaw* classes, you might find there what you need, it might even be that I am completely off mark
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform