Thread: calcualte the execution time of a function

  1. #1
    Registered User
    Join Date
    May 2006

    calcualte the execution time of a function

    Hello everyone,

    What is the convenient way to calculate the execution time of a function? The function may be not a long and time consuming function -- only 10 lines in some situation.

    thanks in advance,

  2. #2
    Registered User
    Join Date
    Jun 2006
    use gettimeofday() - which can return time in microseconds, before the start and the end of function.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Which OS and compiler are you using George2 ?
    Also, which processor is your final program running on (if it's not your host machine)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  2. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  3. What is the best way to record a process execution time?
    By hanash in forum Linux Programming
    Replies: 7
    Last Post: 03-15-2006, 07:17 AM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  5. The space time continueimnms mm... (rant)
    By Jeremy G in forum A Brief History of
    Replies: 32
    Last Post: 06-27-2004, 01:21 PM