StanfordLegion / prof-viewer

Legion Prof Viewer
Apache License 2.0
0 stars 5 forks source link

Optionally include application source with profiles #67

Open syamajala opened 1 week ago

syamajala commented 1 week ago

It would be nice if we had a way to optionally include application source with profiles.

Maybe when generating an archive profile you can optionally pass as many --source-dir arguments as you want to paths of source. Then when you click on a box and you get the popup with the provenance you can have a go to source button and a frame that popups at the bottom with tabs showing you the actual application source.

This would be useful for being able to share profiles without having to commit code changes to git when you are just testing things out.

If we include application source in profiles we should encrypt it and the first time you click on this go to source button it asks for a password that you can supply when generating the profile so that the source is not publicly viewable by anyone.

Additionally if we could tie this source code view back to the profile that would be cool. Maybe highlight hotspots in the source view, give us statistics about the amount of overall time being spent on certain lines in the profile, show me which lines of code are allocating large instances? Or clicking on a line of code highlights the boxes, sort of as another way to do search by provenance?

syamajala commented 5 days ago

I did not realize the provenance string was the full path to the code so we could just use that instead of --source-dir arguments. Maybe just make a single --include-source which flips this on.

@elliottslaughter egui has a textedit widget: https://docs.rs/egui/latest/egui/widgets/text_edit/struct.TextEdit.html#method.multiline

Heres a solution for showing line numbers: https://github.com/emilk/egui/issues/1534#issuecomment-1110070591

There is also this library if you want to make the text fancy: https://github.com/trishume/syntect