AC_DEFUN([ZFS_AC_KERNEL_KTIME_GET_COARSE_REAL_TS64],[ AC_MSG_CHECKING([whether ktime_get_coarse_real_ts64() exists]) ZFS_LINUX_TEST_RESULT([ktime_get_coarse_real_ts64],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64,1, ...
ZFS_LINUX_TEST_RESULT([ktime_get_coarse_real_ts64],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_KTIME_GET_COARSE_REAL_TS64,1, [ktime_get_coarse_real_ts64() exists]) ],[ AC_MSG_RESULT(no) ]) ]) dnl# dnl# 4.18: ktime_get_raw_ts64() replaces getrawmonotonic64(). ...
ktime_get_real_ts64 ktime_get_real_ts64函数诞生于linux v3.17,当时是一个宏定义如下: externvoidgetnstimeofday64(structtimespec64*tv);#define ktime_get_real_ts64(ts) getnstimeofday64(ts) 在linux v5.0中,也就是do_gettimeofday正式退役时,我们看看ktime_get_real_ts64的样子。其在kernel/time/ti...
ktime_get_real_ts64于linux v3.17版本面世,最初以宏定义形式存在。在linux v5.0版本中,随着do_gettimeofday的退役,ktime_get_real_ts64正式登场。其定义位于kernel/time/timekeeping.c,声明则在include/linux/timekeeping.h。具体实现和使用详情,需查阅相关源代码和文档。
至linux v2.0版本,正式升级为外部接口。其定义位于arch/i386/kernel/time.c。然而,随着linux v5.0的更新,do_gettimeofday退出历史舞台。原因在于struct timeval在32bit机器上面临2038问题。替代函数为ktime_get_real_ts64。这一替代被官方文档明确指出,详细信息可参考"linux kernel documentation"中的...
void getnstimeofday(struct timespec *ts) { *ts = xtime; nsecs = timekeeping_get_ns(); timespec_add_ns(ts, nsecs); } 最终的时间是xtime加上当前时刻距离上次中断的偏移。 xtime的更新速度以HZ为基准,若在两个tick之间调用了gettimeofday,则timekeeping_get_ns可以算出当前时刻距上次中断过了多长时间(精...
timespec_add_ns(ts, nsecs); } 最终的时间是xtime加上当前时刻距离上次中断的偏移。 xtime的更新速度以HZ为基准,若在两个tick之间调用了gettimeofday,则timekeeping_get_ns可以算出当前时刻距上次中断过了多长时间(精 确到时钟源,而不是时钟tick),再加到xtime里去,得到精确的时间。
void getnstimeofday(struct timespec *ts) { *ts = xtime; nsecs = timekeeping_get_ns(); timespec_add_ns(ts, nsecs); } 最终的时间是xtime加上当前时刻距离上次中断的偏移。 xtime的更新速度以HZ为基准,若在两个tick之间调用了gettimeofday,则timekeeping_get_ns可以算出当前时刻距上次中断过了多长时间(精...
timespec_add_ns(ts, nsecs); } 最终的时间是xtime加上当前时刻距离上次中断的偏移。 xtime的更新速度以HZ为基准,若在两个tick之间调用了gettimeofday,则timekeeping_get_ns可以算出当前时刻距上次中断过了多长时间(精 确到时钟源,而不是时钟tick),再加到xtime里去,得到精确的时间。
ktime_get_coarse_ns等函数用于纳秒级时间获取。ktime_mono_to_real将单调时间转换为真实时间。ktime_get_ns等函数用于系统时间、真实时间等纳秒级获取。ktime_get_boottime_ts64和ktime_get_coarse_boottime_ts64用于获取启动时间。ktime_get_boottime_seconds获取秒级启动时间。ktime_get_clocktai_...