?
Solved

How to get process cpu time ?

Posted on 2002-07-11
19
Medium Priority
?
1,039 Views
Last Modified: 2012-06-27
Hi to all,
how can I do to get the cpu time of a process ?
(I mean the one I can see on TaskBar for that process)

Regards,
Christian
0
Comment
Question by:cbonjovi
[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
19 Comments
 
LVL 11

Expert Comment

by:joekendall
ID: 7146180
Which windows version?
0
 
LVL 1

Expert Comment

by:mammouth
ID: 7146185
Go to this page (http://www.fastlib.net) and download the ocx package, in the sample code who come with the package, you will find an example

0
 

Author Comment

by:cbonjovi
ID: 7146268
Win2K or XP
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!

 
LVL 3

Expert Comment

by:Elmo_
ID: 7146490
cbonjovi,

This should have what you are looking for.  It retrieves all info about processes.  I have used this under NT and it works fine.

I do not know about Xp of 2K but I think it should be fine.

http://www.allapi.net/apilist/example.php?example=Enumerate%20Processes

Cheers,

Ed.
0
 

Author Comment

by:cbonjovi
ID: 7146542
No Elmo,
I can't find info about cpu resources used by a process.
Regards
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7146625
sorry about that - My Bad!
0
 

Author Comment

by:cbonjovi
ID: 7149059
I'd like to get the cpu resources used by a process with a simple api or something like this
Any idea?
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7149134
http://www.allapi.net/apilist/apifunction.php?apifunction=GetProcessMemoryInfo

This API will allow you to get the Memory usage.  Is that the kinda thing you are looking for?

Ed,
0
 

Author Comment

by:cbonjovi
ID: 7149311
No Sorry,
no memory info, but cpu usage for process
0
 

Author Comment

by:cbonjovi
ID: 7152306
Is there any API or RegistryKey to get the CPU resources used by a process (I mean the one I see on Task Manager)
Regards
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7153650
cbonjovi,

There are a number of different API's for interacting with the Process list, there are probably others but these are the main ones:

1. GetProcessHeap
2. GetProcessMemoryInfo
3. GetProcessTimes
4. GetProcessWindowStation
5. GetCurrentProcess

The API you will need is GetProcessTimes:

http://www.allapi.net/apilist/apifunction.php?apifunction=GetProcessTimes

This Link will explain the Code API for you and the following link will give you an example:

http://www.allapi.net/apilist/example.php?example=ProcessTimes

I hope this helps because I am running out of Ideas,

Good luck,

Ed.
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7159798
cbonjovi,

Any Update here.  Did it work for you?

Cheers,

Ed.
0
 

Author Comment

by:cbonjovi
ID: 7168787
No Elmo,
sorry for the later.
The GetProcessTimes API returns the time and date a process started...
What I need is:
any API or RegistryKey to get the CPU resources used by a process (I mean the one I see on Task Manager)
Regards
Chris
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7168818
CBonjovi,

Maybe I am still unclear as to what you are looking for.

Is it the Image Name of the Process (Well a list of them)?

I am running under NT so When I look at the Task manager I see three tabs
1. Applications (List of apps currently running)
2. Processes (List of Process currently running)
    - Image Name
    - PID
    - CPU
    - CPU Time
    - Mem Usage
3. Performance (Shows CPU usage + mem usage)


Are you looking for any of these things?

Cheers,

Ed.
0
 

Author Comment

by:cbonjovi
ID: 7168908
OK Elmo,
I'm looking for Processes->CPU info
Cheers,
Chris
0
 
LVL 3

Accepted Solution

by:
Elmo_ earned 140 total points
ID: 7168990
Chris,

This is not exactly what you are looking for but I think that it should help.

http://support.microsoft.com/default.aspx?scid=KB;EN-US;q187913&

This link has code that will allow you to show all the processes listed in memory.  It works under NT or 95+.

Cheers,
Ed.
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7208964
Chris,

Any luck?  Could you give me an update?

Cheers,

Ed.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8002339
Hi cbonjovi,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept Elmo_'s comment(s) as an answer.

cbonjovi, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8095333
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

718 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