Solved

CPU Usage and Memory Usage

Posted on 1998-06-29
7
879 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

728 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