Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. stopwatch, timer....

stopwatch, timer....

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marcomars
    wrote on last edited by
    #1

    Hello, my mfc application is performing a time consuming operation. Before this I want to prompt the user with an approximate estimate of the execution time. For this my idea was to execute some (eg 100) cycles, get the elapsed time and multiply this for the number of total needed executions. In MATLAB (for MATLAB users) it would be a simple tic - toc command. Is there something similar for VC++? Or do you have an idea for another approach? Thanks, Marco.

    N D 2 Replies Last reply
    0
    • M marcomars

      Hello, my mfc application is performing a time consuming operation. Before this I want to prompt the user with an approximate estimate of the execution time. For this my idea was to execute some (eg 100) cycles, get the elapsed time and multiply this for the number of total needed executions. In MATLAB (for MATLAB users) it would be a simple tic - toc command. Is there something similar for VC++? Or do you have an idea for another approach? Thanks, Marco.

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #2

      Have a look at the CRT function clock(). A quick Google located: http://msdn.microsoft.com/msdnmag/issues/04/09/CQA/default.aspx[^] which should head you in the right direction. Also search CP for performance monitoring code. And maybe profile you code to speed it up as much as possible.:) Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com

      1 Reply Last reply
      0
      • M marcomars

        Hello, my mfc application is performing a time consuming operation. Before this I want to prompt the user with an approximate estimate of the execution time. For this my idea was to execute some (eg 100) cycles, get the elapsed time and multiply this for the number of total needed executions. In MATLAB (for MATLAB users) it would be a simple tic - toc command. Is there something similar for VC++? Or do you have an idea for another approach? Thanks, Marco.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        marcomars wrote: my mfc application is performing a time consuming operation. Estimations aside, can you put this time-consuming operation in a separate thread? That way, no matter how long it takes or how off your estimations are, your main UI thread is not being blocked and remains responsive.


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups