3

I am trying to understand how time is measured by the Linux kernel. I tried to go through the kernel code, but I miss the big picture to understand the code that I'm reading, even if this article helped a lot. In particular, I would like to understand how the following functions are related:

My questions are:

  • Do they depend on each other? Is gettimeofday implemented in terms of clock_gettime or vice-versa? Is getrusage implemented in terms of clock_gettime or vice-versa?
  • If they depend on each other then, what is the most fundamental one (lower level)?
  • If they do not depend on each other, is there an internal mechanism on which they all depend? A lower-level function of the kernel that they all call?
  • If they do not depend on each other and there is no common underlying mechanism, what is the reason for that?

Note: links to linux kernel code are very welcome to help to understand how all that works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.