how to get the CPU time with VC++ (win)?

M

_mario lat

I try to fing on google but I have not find someting.
How can I get the CPU time ?
How can I know the true time my code spend?
Thank you in advance, Mario.
 
V

Victor Bazarov

_mario lat said:
I try to fing on google but I have not find someting.
How can I get the CPU time ?
How can I know the true time my code spend?

Look at 'clock' function. It works incorrectly on MS Windows, tho.
Then look at MS-Windows-specific process functions (GetProcessTimes).

Then if you still have C++ _language_ questions, post here. If you
have Visual C++ questions, post in microsoft.public.vc.language, and
if you have MS Windows questions, comp.os.ms-windows.programmer.

V
 
P

Peter van Merkerk

_mario lat said:
I try to fing on google but I have not find someting.
How can I get the CPU time ?
How can I know the true time my code spend?
Thank you in advance, Mario.

You could use the clock() function for this.

Alternatively you might consider using a profiler. Some versions of VC++
come with a profiler which can tell you how long your program takes to
execute and in which functions most time is spend. There are also third
party profilers from for example Numega and AutomatedQA which are more
sophisticated than the profiler that comes with VC++. Questions about tools
specific for
your development environment are best asked in one of the
microsoft.public.vc.* groups or comp.os.ms-windows.programmer.
 
J

Johnny Hansen

_mario lat said:
I try to fing on google but I have not find someting.
How can I get the CPU time ?
How can I know the true time my code spend?
Thank you in advance, Mario.

I don't think this is quite within the bounds of this group, but look at
the timeGetTime() function. It returns time elapsed since boot in
milliseconds.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top