(Msg. 1) Posted: Thu May 28, 2009 9:20 pm
Post subject: How to measure time difference? Archived from groups: comp>os>linux>development>apps (more info?)
Hi, everyone
I wish to measure time gap between two point
in linux program by the millisec or below.
(Msg. 2) Posted: Thu May 28, 2009 9:20 pm
Post subject: Re: How to measure time difference? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
"J.H.Kim" <frog1120.DeleteThis@gmail.com> writes:
> Hi, everyone
>
> I wish to measure time gap between two point
> in linux program by the millisec or below.
>
> time() function uses too big unit(sec) to use.
>
> How can I measure the difference of time?
gettimeofday() will get you to the nearest microsecond.
(Msg. 3) Posted: Fri May 29, 2009 5:20 am
Post subject: Re: How to measure time difference? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
"J.H.Kim" <frog1120.RemoveThis@gmail.com> writes:
> I wish to measure time gap between two point
> in linux program by the millisec or below.
>
> time() function uses too big unit(sec) to use.
>
> How can I measure the difference of time?
Do you want to know the wallclock time or the CPU time consumed
while the program was actually executing the code in question?
If the first, the already mentioned gettimeofday would be a solution
with the additional benefit that this is an 'old' interface (4.2BSD,
according to the FreeBSD gettimeofday(2)) and therefore, basically
available everywhere. For the second, the newer clock_gettime could be
used (and also for the first, at the expense of portability to older
systems).
(Msg. 4) Posted: Sat May 30, 2009 4:46 am
Post subject: Re: How to measure time difference? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On May 29, 5:27 pm, Rainer Weikusat <rweiku....TakeThisOut@mssgmbh.com> wrote:
> "J.H.Kim" <frog1....TakeThisOut@gmail.com> writes:
> > I wish to measure time gap between two point
> > in linux program by the millisec or below.
>
> > time() function uses too big unit(sec) to use.
>
> > How can I measure the difference of time?
>
> Do you want to know the wallclock time or the CPU time consumed
> while the program was actually executing the code in question?
> If the first, the already mentioned gettimeofday would be a solution
> with the additional benefit that this is an 'old' interface (4.2BSD,
> according to the FreeBSD gettimeofday(2)) and therefore, basically
> available everywhere. For the second, the newer clock_gettime could be
> used (and also for the first, at the expense of portability to older
> systems).
The gettimeofday() function is provided for porting existing code. You
shouldn't use it in new code; use clock_gettime() instead.
All times are: Pacific Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum