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

Re: precision timer?



Well, what I really care about is the time between system calls as long as the
measurement is relatively accurate.  I don't care if the CPU goes off and does
other things some times as long as the time keeps ticking away.

Am I correct in understanding that the bit of the kernel that supplies the time
keeps ticking away (is this based on a hardware timer?), it's just when the CPU
actually deals with the system call that changes?

thanks,

	Kevin

Johan.Adolfsson@xxxxxxx.com wrote:
>
> 
> Actually gettimeofday has 1 us resolution nowadays, but the time to
> make that syscall is typically 6-7 us.
> 
> Below is the result of a small testprogram I have, it simply checks the
> time between calls to gettimeofday().
> As you see it's normally 6-7 us but occasioanlly a lot more.
> (Priorities not changed during this test)
> 
> Best regards
> /Johan
> 
> # timetest
>    6 us 5784
> #################################################################
>    7 us 1325 ##############
>    8 us  605 ######
>    9 us  259 ##
>   10 us  117 #
>   11 us   38
>   12 us   18
>   13 us   20
>   15 us    2
>   16 us    1
>   18 us    1
>   19 us    7
>  147 us    1
>  155 us    1
>  156 us    1
>  167 us    1
>  169 us    1
>  290 us    1
>  442 us    1
>  457 us    1
>  461 us    1
>  465 us    1
>  485 us    1
>  487 us    2
>  488 us    1
> zero_diff_count: 0
> min_diff: 6 us
> max_diff: 488 us
> mean_diff: 58267/8192 = 7 us
> Clock going backwords: 0
> #