diff options
author | Nathan Scott <nathans@redhat.com> | 2021-03-30 15:55:48 +1100 |
---|---|---|
committer | Sohaib <sohaib.amhmd@gmail.com> | 2021-04-05 23:41:07 +0200 |
commit | 356488aa53e8c0bedeb7641685d931c8900098c5 (patch) | |
tree | c09f2df8264cc4075b72a55409ae261c021cda55 /dragonflybsd | |
parent | 421bdeec603b4fb1a4edec0e802c437fbe47fca0 (diff) |
Request the realtime and monotonic clock times once per sample
Refactor the sample time code to make one call to gettimeofday
(aka the realtime clock in clock_gettime, when available) and
one to the monotonic clock. Stores each in more appropriately
named ProcessList fields for ready access when needed. Every
platform gets the opportunity to provide their own clock code,
and the existing Mac OS X specific code is moved below darwin
instead of in Compat.
A couple of leftover time(2) calls are converted to use these
ProcessList fields as well, instead of yet again sampling the
system clock.
Related to https://github.com/htop-dev/htop/pull/574
Diffstat (limited to 'dragonflybsd')
-rw-r--r-- | dragonflybsd/Platform.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/dragonflybsd/Platform.h b/dragonflybsd/Platform.h index 993768be..87c124d9 100644 --- a/dragonflybsd/Platform.h +++ b/dragonflybsd/Platform.h @@ -17,6 +17,7 @@ in the source distribution for its full text. #include "NetworkIOMeter.h" #include "ProcessLocksScreen.h" #include "SignalsPanel.h" +#include "generic/gettime.h" #include "generic/hostname.h" #include "generic/uname.h" @@ -75,4 +76,12 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a return false; } +static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) { + Generic_gettime_realtime(tv, msec); +} + +static inline void Platform_gettime_monotonic(uint64_t* msec) { + Generic_gettime_monotonic(msec); +} + #endif |