Solved

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

Posted on 2010-09-08
6
387 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SignTool Error with Windows 10 5 175
White board coding practice 3 90
No module found pypyodbc, 3 32
FMX TEdit KeyUp handler detecting  "enter" key 4 13
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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

808 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