davidmarkclements / 0x

🔥 single-command flamegraph profiling 🔥
MIT License
3.23k stars 106 forks source link

feat: add source map support and relative paths #185

Closed pimlie closed 5 years ago

pimlie commented 6 years ago

This PR adds support for displaying file names and line numbers from source maps instead of dist packages. This can help to create a better understanding of what is when happening.

As I was working on that, I also noticed the file names can become quite long (at least in my environment). Therefore I also added a relative-path option so absolute file names will be displayed relative to that path.

I have added an example for the source-map.

BridgeAR commented 6 years ago

@pimlie this is great! Thanks a lot for doing this. I just had a glimpse at the code and will look at it in more depth later on.

pimlie commented 6 years ago

Btw, just noticed that minimist doesnt play well with using string arguments as booleans as well. With the above implementation you cant do eg 0x --source-maps <program_to_profile> as minimist will treat the program name as the argument of --source-maps.

For source-maps I would suggest to split it in source-maps and source-maps-file and for relative-paths we could maybe make this a boolean (so its always relative to the working dir). Let me know what you think?

pimlie commented 5 years ago

@davidmarkclements Sorry for the delay in working on this, but I finally had some time to implement your requested changes. Let me know if you have any remarks! :champagne:

pimlie commented 5 years ago

As this issue has become quite stale I am closing it