lkml.org 
[lkml]   [2003]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: timing an application
Date
Maciej Soltysiak <solt@dns.toxicfilms.tv> writes:

> being inspired by some book about optimizing c++ code i decided to do
> timing of functions i wrote. I am using gettimeofday to set
> two timeval structs and calculate the time between them.
> But the results depend heavily on the load, also i reckon that this
> is an innacurate timing.

You will get elapsed time, which is usually not the same as used cpu
time.

> Any ideas on timing a function, or a block of code? Maybe some kernel
> timers or something.

If you're timing/pofiling some user space functions, gprof should be
sufficient. If you want to profile kernel and module functions as
well, try oprofile at <http://oprofile.sourceforge.net/>. It is part
of the kernel since 2.5.43.

Regards, Olaf.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.083 / U:15.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site