This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Implement NanoTime() on Darwin
ClosedPublic

Authored by kubamracek on Nov 30 2017, 12:01 PM.

Details

Summary

Currently NanoTime() on Darwin is unimplemented and always returns 0. Looks like there's quite a few things broken because of that (TSan periodic memory flush, ASan allocator releasing pages back to the OS). Let's fix that.

Diff Detail

Event Timeline

kubamracek created this revision.Nov 30 2017, 12:01 PM
Herald added a subscriber: Restricted Project. · View Herald TranscriptNov 30 2017, 12:01 PM
kubamracek added inline comments.Nov 30 2017, 12:07 PM
lib/sanitizer_common/sanitizer_mac.cc
367

Actually, this is racy unless we guarantee NanoTime is called during initialization...

dvyukov accepted this revision.Nov 30 2017, 12:08 PM
This revision is now accepted and ready to land.Nov 30 2017, 12:08 PM

FYI, D40679 adds MonotonicNanoTime() for that NanoTime() is too expensive for the allocator's purposes.

I've updated the patch to provide both NanoTime and MonotonicNanoTime.

Hey @kubamracek, checking in to see if you are planning on committing this, we could use the functions. Thanks!

kubamracek closed this revision.Feb 11 2018, 11:29 AM

Landed in r324847.