mirror of
https://github.com/ARM-software/devlib.git
synced 2025-09-09 13:31:53 +01:00
ftrace: Turn TraceCollector into a context manager
This allows using an TraceCollector instance as a context manager, so tracing will stop even if the devlib application is interrupted, or if an exception is raised.
This commit is contained in:
committed by
Marc Bonnici
parent
fbf0875357
commit
22a5945460
@@ -31,5 +31,13 @@ class TraceCollector(object):
|
||||
def stop(self):
|
||||
pass
|
||||
|
||||
def __enter__(self):
|
||||
self.reset()
|
||||
self.start()
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.stop()
|
||||
|
||||
def get_trace(self, outfile):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user