Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Process CPU and memory usage

94 views
Skip to first unread message

Sergey Karpov

unread,
Nov 11, 2002, 11:50:31 AM11/11/02
to
Simple API:
Look for:
GetProcessTimes(...)
VirtualQueryEx(...) /* This call is expensive */

About WMI API and
Performance Monitor Counters
You can read
Programming Server-Side Applications for Microsoft Windows 2000
-- Jeffrey Richter, Jason D. Clark

Good luck.
Sergey Kaprov.

"Fernando Marotta" <f.ma...@NOSPAM.itsoftware.it> wrote in message
news:OMctctZiCHA.2340@tkmsftngp08...
> Hi everybody
>
> I need to write a code to monitor CPU and memory usage for a process
> (similar to the info given by task manager) in win2000.
>
> I really can't find how to do this... any idea?
>
>
> TIA
>
> Cheers
>
> Fernando
>
>
>


Fernando Marotta

unread,
Nov 11, 2002, 11:00:48 AM11/11/02
to

shura

unread,
Nov 11, 2002, 12:48:59 PM11/11/02
to Fernando Marotta
For NT/Win2K/XP there are very simple way:

- For CPU usage:
SYSTEM_PROCESSOR_TIMES SysTime;
NtQuerySystemInformation( SystemProcessorTimes,
&SysTime, sizeof(SysTime), NULL );

- For Memory usage:
VM_COUNTERS VmCounters;
NtQueryInformationProcess( NtCurrentProcess(),
ProcessVmCounters,
&VmCounters, sizeof(VmCounters), NULL );


Unfortunatly I dont know exactly how to get such info for Win9x.

Andrey A. Belkin

unread,
Nov 12, 2002, 4:54:52 AM11/12/02
to
For memory:
GlobalMemoryStatus(...)

It works in
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.


--
Andrey A. Belkin
belk...@hotmail.com


"shura" <remove-s...@paragon.ru> wrote in message
news:3DCFED8B...@paragon.ru...

arkadyf

unread,
Nov 13, 2002, 4:50:42 AM11/13/02
to
Look at "
Finding Leaks and Bottlenecks with a Windows NT PerfMon COM Object"
in MSDN how to use PHD for that.
Arkady

"Fernando Marotta" <f.ma...@NOSPAM.itsoftware.it> wrote in message
news:OMctctZiCHA.2340@tkmsftngp08...

0 new messages