nanotime 在 MacOS 上有什么作用?
What does nanotime do on MacOS?
我目前正在尝试了解如何在 Go 中为 MacOS 实现 nanotime
。
在 Linux
上(参见 link 实现 here),它似乎调用 clock_gettime
.
在 Windows
上(参见 link 实现 here),它似乎调用 QueryPerformanceCounter
。
但是我找不到它在 MacOS
上做了什么,也找不到它调用了什么样的等效系统函数。它在 MacOS
上有什么作用?
注:link欢迎提供源码
Here is the nanotime
implementation for Darwin. It calls into nanotime_trampoline
, implemented in Go assembly which in turns seems to call mach_absolute_time
, defined in macOS's libSystem
我目前正在尝试了解如何在 Go 中为 MacOS 实现 nanotime
。
在 Linux
上(参见 link 实现 here),它似乎调用 clock_gettime
.
在 Windows
上(参见 link 实现 here),它似乎调用 QueryPerformanceCounter
。
但是我找不到它在 MacOS
上做了什么,也找不到它调用了什么样的等效系统函数。它在 MacOS
上有什么作用?
注:link欢迎提供源码
Here is the nanotime
implementation for Darwin. It calls into nanotime_trampoline
, implemented in Go assembly which in turns seems to call mach_absolute_time
, defined in macOS's libSystem