My project is a long time daemon service and need to busy check some conditions and take actions as soon as possible.
I want to use std::steady_clock to account the responsing time of my service and the busy/free duty proportion.
Everytime the service runs about in 20~100 microseconds, while the designing requirement is less than 160us. So I'm afraid that it would waste too much time to call steady_clock::now() frequently.
My question:
- Does
steady_clock::now()make a syscall potentially? Would it result my program to be blocked irregularly for a long time(exceed 1ms)? - Is there any better alternative method?
gettimeofdayor similar syscall would be called using thevdso, so would stay entirely in userspace - but that's just a guess.