CPU and Memory Usage

CPU and Memory Usage

Post by pgi.. » Sat, 14 Oct 2000 04:00:00



Hi,

I'm trying to write a C Process which runs on a NT server and retreive
actual memory and CPU usage.

Can someone suggest me which API to use or if there is somewhere a
source code for this.

Thanks
Paolo

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

CPU and Memory Usage

Post by Luc Kump » Sat, 14 Oct 2000 04:00:00


Quote:> I'm trying to write a C Process which runs on a NT server and retreive
> actual memory and CPU usage.
> Can someone suggest me which API to use or if there is somewhere a
> source code for this.

EnumProcesses
OpenProcess(PROCERSS_QUERY_INFORMATION, PROCESS_VM_READ, FALSE, processID)
eventually EnumProcessModules and GetModuleBaseName to get name
GetProcessMemoryInfo
GetProcessTimes

Luc

 
 
 

CPU and Memory Usage

Post by gu » Sat, 14 Oct 2000 04:00:00


Hi Paolo,

the function GlobalMemoryStatus() gives you total size and available size of
memory.

Getting the CPU usage is different on Win9x and NT. You'll find it as trick
20 and trick 21 at

   http://www.codepile.com/

gu