Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > how to get the CPU time with VC++ (win)?

Reply
Thread Tools

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

 
 
_mario lat
Guest
Posts: n/a
 
      10-12-2004
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.


 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      10-12-2004
_mario lat wrote:
> 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
 
Reply With Quote
 
 
 
 
Peter van Merkerk
Guest
Posts: n/a
 
      10-12-2004
"_mario lat" <> wrote in message
news:vOTad.37689$...
> 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.

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl


 
Reply With Quote
 
Johnny Hansen
Guest
Posts: n/a
 
      10-13-2004
_mario lat wrote:
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
CPU time Vs WALL time, Sometimes Walltime lesser than Cputime ? anto.anish@gmail.com C++ 1 10-18-2008 06:29 AM
How to get a very accurate time when CPU does heavy tasks? lialie@gmail.com C Programming 9 03-10-2007 12:01 AM
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
hotshot profiler: how to distinguish between cpu time and wait (idle)time? Irmen de Jong Python 0 06-09-2004 01:33 PM



Advertisments