Solved

find a C++ program to get information that is shown in a 'Task Manager' performance window

Posted on 2010-09-08
6
382 Views
Last Modified: 2013-12-04
I need to write a C++ program to monitor what is currently available memory, how much cpu time is used and other information shown in Windows 'Task Manager'. Any clue?
0
Comment
Question by:Ziren
6 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 33632057
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33635093
GlobalMemoryStatus/GlobalMemoryStatusEx to detect the memory:
http://msdn.microsoft.com/en-us/library/aa366589(VS.85).asp
There is an example.

GetProcessTimes gives a time information about processes - how long the process is running:
http://msdn.microsoft.com/en-us/library/ms683223(VS.85).asp

If you need to collect the performance data, you may use PdhOpenQuery,etc. Here is an example:
MSDN. Writing Performance Data to a Log File
http://msdn.microsoft.com/en-us/library/aa373228(VS.85).asp

You can find a lot in MSDN:
Performance Monitoring
http://msdn.microsoft.com/en-us/library/ee663292(v=VS.85).asp
You can download Process Explorer from Microsoft SysInternals:
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Check this CodeProject article: Process viewer
http://www.codeproject.com/KB/cpp/processviewer.aspx
Maybe, here is everything you are looking for.
0
 
LVL 1

Expert Comment

by:XMarshall10
ID: 33635777
To get you started, you can start your project by Enumerating all the process running in your local system by using Win32 API's like EnumProcesses. List all the process in a window.

Then refer to the above links provided by the other experts for gathering further information's like memory, cpu time, etc.

--XM
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Accepted Solution

by:
Ziren earned 0 total points
ID: 33638816
thanks very much for you guy's inputs, now I have one question solved on how to get memory usage information. I tried the method at 'http://www.codeproject.com/KB/system/MultiCPUUsage.aspx' to get cpu usage but failed, When run the program, there is no error message, but cpu usage is always 0. Is there other way to get this information?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33639694
try this http://www.cplusplus.com/forum/windows/14580/ - tweaked version after initial post
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33758990
So what did you do to solve it?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

706 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now