Use Mach built-ins in lieu of clock_gettime(3) and friends.
authorPeter Griess <pgriess@fb.com>
Mon, 23 Sep 2013 21:22:58 +0000 (16:22 -0500)
committerSara Golemon <sgolemon@fb.com>
Thu, 24 Oct 2013 21:53:41 +0000 (14:53 -0700)
commit1342be122f3d7bdaa33880851786716b810591b8
tree8a9318f9e1479c878668a2bed9a23f85d547639d
parentd7562b8c3378fedc0434a89d5000438675b56d0a
Use Mach built-ins in lieu of clock_gettime(3) and friends.

Summary:
- Mach doesn't support clock_getres(3) or clock_gettime(3). Provide our
own implementations by wrapping mach_timebase_info() and
mach_absolute_time().
- Detect availability of of -lrt at configure time and don't link with
it if it's not available. On Linux, this is what provides
clock_gettime(3) and friends.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: meyering@fb.com

FB internal diff: D999131
folly/Benchmark.h
folly/Makefile.am
folly/Portability.h
folly/configure.ac
folly/detail/Clock.cpp [new file with mode: 0644]
folly/detail/Clock.h [new file with mode: 0644]
folly/test/Makefile.am