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

Discussion in 'C++' started by _mario lat, Oct 12, 2004.

  1. _mario lat

    _mario lat Guest

    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.
     
    _mario lat, Oct 12, 2004
    #1
    1. Advertising

  2. _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
     
    Victor Bazarov, Oct 12, 2004
    #2
    1. Advertising

  3. "_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
     
    Peter van Merkerk, Oct 12, 2004
    #3
  4. _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.
     
    Johnny Hansen, Oct 13, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Irmen de Jong
    Replies:
    0
    Views:
    460
    Irmen de Jong
    Jun 9, 2004
  2. pavunkumar

    How , system cpu and user cpu times calculates

    pavunkumar, Feb 27, 2009, in forum: C Programming
    Replies:
    1
    Views:
    359
  3. Krist
    Replies:
    6
    Views:
    756
    Arne Vajhøj
    May 7, 2010
  4. Finding CPU stats on Win?

    , Apr 15, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    80
    guice666
    Apr 15, 2005
  5. Replies:
    5
    Views:
    132
    Peter J. Holzer
    Oct 11, 2008
Loading...

Share This Page