-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make os.clock
use clock_gettime
on FreeBSD
#1364
Make os.clock
use clock_gettime
on FreeBSD
#1364
Conversation
Luau doesn't specify that is has to be either of those.
Note that this is different from how PUC Lua defines But if your change is mainly about improving precision of the value, that's a good improvement to have.
Given that we already have timestamps taken as Finally, the file you modified is actually used for 'time trace' profiling file recording, not for the |
@vegorov-rbx I made the change to lperf.cpp, thanks.
My original phrasing was bad. I understand the baseline isn't defined, my intent was to make FreeBSD's increasing of the value not ignore time spent during context switches, and not tick faster with parallelism, since it doesn't on other major platforms. This avoids Lua's mistake. I don't think it increases precision because FreeBSD does not comply with the requirement that I think for benchmarking there could be another |
Doesn't that mean the exact opposite? |
You're right, it should increase precision. |
I checked multiple language runtimes and everyone uses |
I should mention I'm assuming |
I don't know what you're talking about. Luau already has code under |
Thank you! |
I think
clock()
is processor time used by the program on FreeBSD (that's what it is in Linux). On Linux, Apple, and Windows,os.clock()
isn't specific to the program.Would
CLOCK_MONOTONIC_RAW
be better or worse here, since it doesn't slew time for adjustments like NTP?QueryPerformanceCounter
on Windows isn't slewed for NTP, I don't know ifmach_absolute_time
is. It's only supported since Linux 2.6.28 though.