-
Notifications
You must be signed in to change notification settings - Fork 2
Use gettime
on Lua.
#20
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
Conversation
common.sh
Outdated
@@ -26,7 +26,9 @@ setup() { | |||
|
|||
# Build yklua with JIT support. | |||
git clone https://github.com/ykjit/yklua | |||
cd yklua | |||
cd yklua/src | |||
patch < ../../../../patches/clua_gettime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I've learned about patch: always specify a patch level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works in this case. Do you have a suggested change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add a -p
.
The problem is, if you don't give patch a -p
it starts guessing where to apply the diff and if files of the same name exist in different places, it occasionally gets it wrong. It's bitten me a few times.
Although it works ok now, an future "sync with upstream lua" could cause fun!
I didn't have to search for long to find an example in the wild:
conda/conda-build#4241
In this case I'd cd
to the top level dir and use -p0
.
LGTM, just one small comment. |
Point taken. Try that force push. |
Welp, I needed |
It turns out that |
harness.lua uses Lua's `os.clock` which -- though it's not precisely specified AFAICT -- seems to measure 'user+sys' time rather than the expected wall-clock time. This gives misleading measurements if a process is doing anything other than just running the VM (e.g. it ends up measuring compilation in yklua in threads). This commit introduces a patch to the normal C Lua VM that introduces a function `os.gettime` which uses the normal `gettime` clock. Imperfect though that clock may be, it's a lot better than `clock`. That patch is applied to both "normal" Lua and yklua.
I got another path wrong. Fixed in the force push. |
harness.lua uses Lua's
os.clock
which -- though it's not precisely specified AFAICT -- seems to measure 'user+sys' time rather than the expected wall-clock time. This gives misleading measurements if a process is doing anything other than just running the VM (e.g. it ends up measuring compilation in yklua in threads).This commit introduces a patch to the normal C Lua VM that introduces a function
os.gettime
which uses the normalgettime
clock. Imperfect though that clock may be, it's a lot better thanclock
. That patch is applied to both "normal" Lua and yklua.