Skip to content

Conversation

@juj
Copy link
Collaborator

@juj juj commented Feb 10, 2021

Simplify the use of emprofile and fix issue with empty generated profiles.

Add top level emprofile shortcut to avoid needing to use awkward python $EMSCRIPTEN/tools/emprofile.py string on command line.

@juj
Copy link
Collaborator Author

juj commented Feb 10, 2021

CI is going sideways on unrelated change:

embuilder:INFO: building and verifying sdl2-ttf
system_libs:INFO: retrieving port: sdl2_ttf from https://hg.libsdl.org/SDL_ttf/archive/703ebc7c66fd.zip
embuilder: error: Unexpected hash: 850b7cc261087e0f78ac27eb47ef777cb70c3c71238d470a487f53428373295abc136d6e9684a926aa923c8c6919969183965bcbca9a124f3787c8061e14fad8
If you are updating the port, please update the hash in the port module.

@juj
Copy link
Collaborator Author

juj commented Feb 11, 2021

Updated this PR to rename EM_PROFILE_TOOLCHAIN environment variable, which is hard to remember, to just simple EMPROFILE. That way users only need to remember a single word to profile:

set EMPROFILE=1
emcc -c ...
emcc -c ...
...
emcc ...
emprofile
(open generated .html file)

@juj juj force-pushed the improve_emprofile branch from 74bef23 to 65c618f Compare February 13, 2021 07:02
@juj juj mentioned this pull request Feb 13, 2021
@juj
Copy link
Collaborator Author

juj commented Feb 13, 2021

Ping, this could use a review.

@juj juj force-pushed the improve_emprofile branch from 65c618f to 2b01b2d Compare February 13, 2021 16:53
@juj juj force-pushed the improve_emprofile branch from ed80112 to 5ea463e Compare February 14, 2021 11:12
@kripken
Copy link
Member

kripken commented Feb 16, 2021

@sbc100 you recently worked on this, I think, maybe you want to take a look? If you don't have time I can try to.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shit, that is bad timing.

I'm trying reland this change that got booted out that looks like its going to conflict pretty badly with this: #13416

Nobody has touched this in 5 years and now both do a big re-write :-(

cd path/to/emscripten
tools/emprofile.py --reset
export EM_PROFILE_TOOLCHAIN=1
export EMPROFILE=1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the name of this environment variable?

I myself only know of one user out there but there maybe be others.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,29 @@
#!/bin/sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can create these while keeping the tool under tool if you like?

You can just add tools/embuilder to tools/create_entry_points.py ad then re-run it.

These scripts will then get created in the tools directory, which I think it probably fine.

If you really want to make it so that folks don't have to type ./tools/empofile but just ./emprofile I think there are a few other places in the docs that will need updating.

I think it might be simple to leave it there myself but I don't have strong feelings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do want the users to be able to run just emprofile and not $EMSCRIPTEN/tools/emprofile, the earlier pattern to enable was too complex, and I had to always look at the doc page after a few months had passed since I used this tool. Now after this enabling the profiler should be much simpler.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK sounds reasonable. Perhaps we need to modify create_entry_points.py to handle creating wrappers at the top level to tools in the tools directory. I can take a look at this if you like?

Copy link
Collaborator

@sbc100 sbc100 Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it looks like this would make the bat/sh run_python scripts way less trivial. Would you mind if we land this change without moving emprofille out of the tools directory.

We can then followup with a plan to enable tools like emdump emprofile and file_packager to be moved to the top level at some point in the future? It seems like we should have a generic solution here.

lgtm with create_entry_points.py usage and keeping launchers under tools. (for now)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have that other PR for ccache that already rewrites parts of the scripts creation, I'd prefer not to have to manage conflicts here. Hoping this could land as-is..?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at solution for the create_entry_points.py problem: #13679
Hopefully it will make this change easier.

sbc100 added a commit that referenced this pull request Mar 16, 2021
As and example the python code for the emdump tool lives in
tools/emdump.py, but we want the entey point to be at the top
level of emscripten.

Hopefully this will help with #13464
sbc100 added a commit that referenced this pull request Mar 16, 2021
As and example the python code for the emdump tool lives in
tools/emdump.py, but we want the entey point to be at the top
level of emscripten.

Hopefully this will help with #13464
@juj
Copy link
Collaborator Author

juj commented Mar 16, 2021

I'll land this as-is, we can iterate on the format later.

@juj juj merged commit 04f41b8 into emscripten-core:main Mar 16, 2021
sbc100 added a commit that referenced this pull request Mar 16, 2021
As and example the python code for the emdump tool lives in
tools/emdump.py, but we want the entey point to be at the top
level of emscripten.

Hopefully this will help with #13464
sbc100 added a commit that referenced this pull request Mar 16, 2021
As and example the python code for the emdump tool lives in
tools/emdump.py, but we want the entey point to be at the top
level of emscripten.

Hopefully this will help with #13464
sbc100 added a commit that referenced this pull request Mar 17, 2021
As and example the python code for the emdump tool lives in
tools/emdump.py, but we want the entey point to be at the top
level of emscripten.

Hopefully this will help with #13464
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants