Solved

CPU Usage and Memory Usage

Posted on 1998-06-29
7
872 Views
Last Modified: 2013-11-20
Pl tell me how to get CPU usage and Memory usage (as show in the Task Manager) in my MFC
application
0
Comment
Question by:prashantp
  • 3
  • 2
  • 2
7 Comments
 
LVL 2

Expert Comment

by:rayb
ID: 1318498
Check the VC Documentation for functions like GetProcess????.  i.e. GetProcessHeap and GetProcessWorkingSetSize



0
 

Author Comment

by:prashantp
ID: 1318499
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.
0
 
LVL 2

Expert Comment

by:rayb
ID: 1318500
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;

0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:prashantp
ID: 1318501
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 ?
0
 
LVL 4

Expert Comment

by:piano_boxer
ID: 1318502
Is this for NT or 95(98) ?

If its for NT, you can get all the information you need (performance counters) from the registry.
0
 
LVL 4

Accepted Solution

by:
piano_boxer earned 50 total points
ID: 1318503
Heres complete articles and source code about performance counters in windows NT:

http://www.eu.microsoft.com/msj/0598/hood0598.htm
0
 

Author Comment

by:prashantp
ID: 1318504

thanks piano_boxer

i got all i needed in that url.

thank you once again.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 108
Process filename extension 3 185
Change owner from userA to server Local Administrators 7 62
if loop in java 3 142
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question