calcualte the execution time of a function

This is a discussion on calcualte the execution time of a function within the C Programming forums, part of the General Programming Boards category; Hello everyone, What is the convenient way to calculate the execution time of a function? The function may be not ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    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,
    George

  2. #2
    Registered User
    Join Date
    Jun 2006
    Posts
    3
    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
    Location
    The edge of the known universe
    Posts
    32,855
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  2. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 09: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-30-2005, 12:21 AM
  5. The space time continueimnms mm... (rant)
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 06-27-2004, 02:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21