Skip to main content

Timeline for answer to Getting an accurate execution time in C++ (micro seconds) by parrowdice

Current License: CC BY-SA 3.0

Post Revisions

9 events
when toggle format what by license comment
Jul 16, 2024 at 14:25 comment added bgura On your example of uint64_t time_sec = 1;. There is a value to having some type safety when converting between the different units
Feb 24, 2014 at 10:49 vote accept user3323616
Feb 24, 2014 at 10:52
Feb 18, 2014 at 22:54 comment added R. Martinho Fernandes Boost.Chrono has a decent high resolution clock on Windows.
Feb 18, 2014 at 16:02 history edited parrowdice CC BY-SA 3.0
added 168 characters in body
Feb 18, 2014 at 15:56 comment added qdii @parrowdice good point, if you change your answer to include that I will turn my downvote into an upvote
Feb 18, 2014 at 15:25 comment added stefan +1, although being platform dependent. Why? Easy: on several compilers for this platform, either std::chrono::high_resolution_clock is not available or is set to a not-as-high-as-possible timer. This specific solution is necessary.
Feb 18, 2014 at 15:22 comment added parrowdice @qdii: He can put it around a call to CreateProcess(...) and WaitForSingleObject(...) for the entire process lifetime, otherwise around his main function. It's a reasonable solution, I don't think it really deserves downvotes though...
Feb 18, 2014 at 14:51 comment added qdii But he wants the execution time of the program, not a function. This includes the set-up part that you can’t typically access.
Feb 18, 2014 at 14:09 history answered parrowdice CC BY-SA 3.0