2

Manpage for gethrtime() mentions another flavor of this call, which is gethrvtime(), and explains that this is the virtual time of a LWP. I am trying to understand the use case that would require gethrvtime() and make gethrtime() inapplicable and vice versa.

Thank you!

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
evolvah
  • 625
  • 4
  • 15

1 Answers1

3

This page on High Resolution Timers seems to have a good description of gethvrtime:

gethrvtime() and Light Weight Processes virtual time

The gethrvtime() function is similar to gethrtime() except that it returns the current high resolution Light Weight Process virtual time. Light Weight Processes (LWPs) are in Solaris parlance the equivalent of threads (LWPs were first implemented in Solaris. Later, they were later adopted by Linux and other POSIX systems). The LWP virtual time is the total number of nanoseconds of execution time. This function requires that micro state accounting be enabled with the ptime utility. Without getting too technical, using microstate accounting enables reproducible precision of time measurements.


It sounds to me like gethrtime is elapsed, "wall clock" time, whereas gethvrtime is CPU time.

tomlogic
  • 11,489
  • 3
  • 33
  • 59
  • Thank you for the answer! I interpret this explanation the same way. I wish I found the referenced article earlier. – evolvah Jul 13 '11 at 20:51