[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: timing a function
On Sat, Dec 08, 2001 at 03:41:23AM -0500, D Cleveland wrote:
> Im looking to check the relative time it takes to call a function and then
> return. does anyone know how i can do this easily? heres what im hoping
> i can do...
>
> int len;
>
> len = check_timer();
> function_to_time();
> len = check_timer() - len;
>
> and have this return some number telling me the relative time to execute
> the function. if this isnt clear let me know and ill clarify. thank you
> in advance!
try rdtscll() (With long long's). It measures cycles taken.
--
Mark Zealey (aka JALH on irc.openprojects.net: #zealos and many more)
mark@zealos.org
mark@itsolve.co.uk
UL++++>$ G!>(GCM/GCS/GS/GM) dpu? s:-@ a16! C++++>$ P++++>+++++$ L+++>+++++$
!E---? W+++>$ N- !o? !w--- O? !M? !V? !PS !PE--@ PGP+? r++ !t---?@ !X---?
!R- b+ !tv b+ DI+ D+? G+++ e>+++++ !h++* r!-- y--
(www.geekcode.com)
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/