-
-
Notifications
You must be signed in to change notification settings - Fork 417
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
The Hashlink profiler does not work with OpenFL #2685
Comments
Instructions here: https://lime.openfl.org/docs/advanced-setup/hashlink/ |
Thank you for the quick reply, and sorry for missing that information in the documentation! I now setup my local Hashlink version using I wanted to test the profiler also with the bundled Hashlink, but I can't seem to be able to switch back to it. The problem is that when running |
Try running |
Thanks, that works for resetting the Hashlink path! I wanted to test the profiler with both the bundled and external Hashlink, but I first ran into some issues of the generated BunnyMark executable (the renamed Hashlink interpreter) remaining the wrong Hashlink version despite setting HL_PATH. It seems that the build tool doesn't recopy the interpreter when HL_PATH changes if the interpreter has already been copied to the output directory, but deleting the Export subdirectory before re-running the openfl build tool solved this. I tried both with and without the
|
Looking more into this, it seems that the issue with the profiler crash is not directly related to OpenFL, it just appears in OpenFL programs when The issue appears to be caused by the Hashlink profiler somehow interacting with |
Describe the bug
The Hashlink profiler can be used to profile HL bytecode applications. It can be started by running Hashlink with the
--profile
switch. However, trying to run the profiler crashes OpenFL applications inhaxe.io.Input.readLine
.The profiler is supposed to run in its own thread and not affect the rest of the program it samples, so it's not clear why the program runs differently (and fails) with the profiler enabled. The profiler works without issues when using it with Heaps programs with the same Hashlink, OS etc. versions.
To Reproduce
Steps to reproduce the behavior:
openfl create BunnyMark
openfl test hl -debug
cd Export/hl/bin
./Bunnymark
./Bunnymark --profile 1000
The last example starts but immediately fails with the following output:
The output about "writing profiling data" is probably not related to the exception. Rather, the exception happens somewhere else in the program, and while closing, the Hashlink virtual machine first writes out the profiling data (like it always does when a profiled program closes) and then shows the exception that happened somewhere else.
OpenFL Targets
The problem is related to the Hashlink bytecode target. The following program versions were used:
Additional context
1) How to define a custom Hashlink version for use with OpenFL?
A tangentially related issue is that the Hashlink version bundled with OpenFL can sometimes be out of date. For example, the profiler requires a newer Hashlink version than the one bundled with OpenFL. To use a more recent Hashlink version with OpenFL I have copied the newer Hashlink files over the ones in the Lime haxelib directory by replacing the files at e.g.
haxelib/lime/8,0,2/templates/bin/hl/Linux64
.This appears to work fine but feels like a bit of a hack. Is there any official way to point OpenFL/Lime to use a user-defined Hashlink install instead of the bundled one?
2) How to pass Hashlink command line parameters to "openfl test"?
When compiling and running an OpenFL program with Hashlink, it is possible to pass arguments to the program with
openfl test -args -arg value
. However, these arguments are passed to the program itself, but the Hashlink virtual machine can also receive its own arguments, such as the--profile
option.Is there any way to pass Hashlink command line arguments via either the OpenFL command line interface or the OpenFL project.xml file?
3) How to start the Hashlink profiler without the command line argument?
This part is not really an OpenFL question, but I thought I would put it here in case someone with more experience with the Hashlink profiler can help. The profiler can be started with the
--profile
command line option, but it should also be possible to start it from within the program by callinghl.Profile.event(-7)
. However, this doesn't seem to have any effect.The text was updated successfully, but these errors were encountered: