Skip to content

lisa.trace: Make Trace a context manager

Douglas Raillard requested to merge douglas-raillard-arm/lisa:_home_pr90496 into main

FEATURE

lisa.trace.Trace objects have to manage some cache-related resources, which can require orderly cleanup in some situations (e.g. if the caller intends on removing the trace.dat folder after it is done with the Trace). Relying on del for that does not work as cyclic references to the Trace instance make del execute at an unknown point in the future.

Fix that by providing a context manager API to Trace, which can be used in this sort of situation. The cleanup code will still attempt to run on del if it has not run yet for backward compatibility and simpler situations.

Merge request reports