Solved

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

Posted on 2010-09-08
6
388 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSIS 2010 Convert to SSIS 2013 On Different Box 3 63
C++ question 3 74
How do ASP.NET and MVC work together? 4 70
Where does legacy ASP.NET initialize language? 2 56
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

735 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