Granulate / gprofiler

gProfiler is a system-wide profiler, combining multiple sampling profilers to produce unified visualization of what your CPU is spending time on.
https://profiler.granulate.io
Apache License 2.0
745 stars 54 forks source link

perf: Remove perf.data & perf.inject intermediates output also when "perf inject/script" fail #671

Closed Jongy closed 1 year ago

Jongy commented 1 year ago

Robustness improvement. If those files are leaked due to "perf inject" / "perf script" unexpectedly failing/being killed, then this disk space is not freed.

Jongy commented 1 year ago

The logic looks like a classic use-case for a context manager. Python has the NamedTemporaryFile class that automatically deletes the file upon __exit__. It looks like a good fit. But not important.

Good point. I suppose many uses of remove_path can be replaced that way. I don't want to deal with it now so I'll open a ticket.