Leon
Leon

Reputation: 2077

Does std::steady_clock::now() make a syscall in Linux?

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:

  1. Does steady_clock::now() make a syscall potentially? Would it result my program to be blocked irregularly for a long time(exceed 1ms)?
  2. Is there any better alternative method?

Upvotes: 3

Views: 269

Answers (0)

Related Questions