[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: clock(3) non-functional?



Svante Signell, le Tue 01 Jul 2014 12:41:47 +0200, a écrit :
> On Sun, 2014-06-29 at 22:56 +0200, Samuel Thibault wrote:
> > Hello,
> > 
> > Svante Signell, le Sun 29 Jun 2014 16:35:42 +0200, a écrit :
> > > Looking at libsamplerate test problems, I found that clock(3) used
> > > there is not reliable. Strange results are obtained on too Linux with a
> > > simple test program.
> > 
> > What do you mean by "strange"? The output I get
> > 
> > $ ./test
> > start = 3870
> > end = 3910
> > cpu_time_used = 0.000040
> 
> I get:
> gcc -g -Wall test_clock.c
> ./a.out
> start = 0
> end = 0
> cpu_time_used = 0.000000

Well, yes, as I said sleep() doesn't consume CPU while sleeping, so
clock() would only account the small overhead for starting the sleep,
which is very small. Since the granularity is 1/100th second on the
Hurd, that eventually amounts to zero.

Samuel


Reply to: