plasma-umass / scalene

Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python with AI-powered optimization proposals
Apache License 2.0
12.23k stars 399 forks source link

Add ability to control whether `profile.html` is generated #819

Open volovikariel opened 7 months ago

volovikariel commented 7 months ago

Is your feature request related to a problem? Please describe. As I only use the scalene viewer (because it supports local LLMs, it also allows for hovering over numbers the bars to view the percentages), I'd like to be able to opt out of outputting a profile.html file.

Even if those features were available locally, I'd still rather have only one HTML/JSON be outputted - so as to not have to deal with more files than I need to.

Describe the solution you'd like I'd like to be able to opt out of it just like I'm able to opt out of opening a browser. So something like no_html.

Describe alternatives you've considered Alternatively, we can do something like --html False.

Alternatively, being able to specify the location of the JSON file separately would also work. As then I'd be able to set --outfile to /dev/null, which would nuke the html file, and then I'd be able to set --json profile.json.

Additional context I tried setting --outfile to /dev/null to nuke the profile.html file currently, but it seems that the .json filepath is relative to --outfile (1 2 3 4 )

D-VR commented 4 months ago

Running scalene like:

scalene --cli --json --outfile output.json <my python file> will only output the json and no profile.html