prashantp
asked on
CPU Usage and Memory Usage
Pl tell me how to get CPU usage and Memory usage (as show in the Task Manager) in my MFC
application
application
Check the VC Documentation for functions like GetProcess????. i.e. GetProcessHeap and GetProcessWorkingSetSize
ASKER
The GetProcessWorkingSetSize function obtains the minimum and maximum working set sizes of a specified process.
And I need the overall system's memory usage (physical + virtual )and cpu usage, as displayed by the Task Manager.
And I need the overall system's memory usage (physical + virtual )and cpu usage, as displayed by the Task Manager.
Heck, I'll try again...
Check out the WIN32 GlobalMemoryStatus function. It returns the following structure:
typedef struct _MEMORYSTATUS { // mst
DWORD dwLength; // sizeof(MEMORYSTATUS)
DWORD dwMemoryLoad; // percent of memory in use
DWORD dwTotalPhys; // bytes of physical memory
DWORD dwAvailPhys; // free physical memory bytes
DWORD dwTotalPageFile; // bytes of paging file
DWORD dwAvailPageFile; // free bytes of paging file
DWORD dwTotalVirtual; // user bytes of address space
DWORD dwAvailVirtual; // free user bytes
} MEMORYSTATUS, *LPMEMORYSTATUS;
Check out the WIN32 GlobalMemoryStatus function. It returns the following structure:
typedef struct _MEMORYSTATUS { // mst
DWORD dwLength; // sizeof(MEMORYSTATUS)
DWORD dwMemoryLoad; // percent of memory in use
DWORD dwTotalPhys; // bytes of physical memory
DWORD dwAvailPhys; // free physical memory bytes
DWORD dwTotalPageFile; // bytes of paging file
DWORD dwAvailPageFile; // free bytes of paging file
DWORD dwTotalVirtual; // user bytes of address space
DWORD dwAvailVirtual; // free user bytes
} MEMORYSTATUS, *LPMEMORYSTATUS;
ASKER
Well rayb,
i tried the GlobalMemoryStatus function but the value it returned is different from that of the memory usage shown in the Task Manager.
And how about the CPU usage ?
i tried the GlobalMemoryStatus function but the value it returned is different from that of the memory usage shown in the Task Manager.
And how about the CPU usage ?
Is this for NT or 95(98) ?
If its for NT, you can get all the information you need (performance counters) from the registry.
If its for NT, you can get all the information you need (performance counters) from the registry.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks piano_boxer
i got all i needed in that url.
thank you once again.