Commit graph

5 commits

Author SHA1 Message Date
Elliott Hughes
09e394f92a clock: buff our coverage numbers slightly.
clock_gettime() with known arguments can't fail (and we ignore its
return value in most other places already).

Test: treehugger
Change-Id: I2374ae5ba1598a01d4c4f689b9c75c4e7dc926b6
2020-05-29 15:36:16 -07:00
Josh Gao
8c8ef5965d Move <sys/sysconf.h> to <bits/sysconf.h>.
Also remove unneeded declaration of sysconf in <unistd.h>.

Bug: http://b/28067717
Change-Id: Ife4692e48ca97480e422db0686c61133e1d619aa
2016-04-07 18:02:00 -07:00
Alex Van Brunt
8d0b2dbf21 Reimplement clock(3) using clock_gettime(3)
Unlike times(), clock_gettime() is implemented as a vDSO on many architectures.
So, using clock_gettime() will return a more accurate time and do so with less
overhead because it does have the overhead of calling into the kernel.

It is also significantly more accurate because it measures the actual time in
nanoseconds rather than the number of ticks (typically 1 millisecond or more).

Bug: 17814435
Change-Id: Id4945d9f387330518f78669809639952e9227ed9
2014-10-03 18:54:28 -07:00
Elliott Hughes
f83c208b82 Explain why clock(3) isn't broken.
Bug: 17441123
Change-Id: I6ee9b7f54bab55b1a8760ce9bcaaa6eab1dcc492
2014-09-12 16:33:37 -07:00
Elliott Hughes
cccfe1e17c Reimplement clock(3) and switch to OpenBSD time(3).
The new implementation is a better approximation to the processor time used
by the process because it's actually based on resource usage rather than just
elapsed wall clock time.

Change-Id: I9e13b69c1d3048cadf0eb9dec1e3ebc78225596a
2014-03-11 13:37:11 -07:00