Cleanup profiler and make is as a context manager
Description
This transforms the profiling to be a context manager.
Currently, we needed to call start then stop on profiling. This can add errors where we would be stopping incorrect profilers.
Moving to a context manager allows us to not have this problem and makes it clearer which part of the code is getting profiled.
I also remove unused topics for profiling.
We can now use the context manager as a decorator.
Changes proposed in this merge request:
- Use a context manager for profiling
- Remove unused profiling topics
Fixes #876 (closed) #877 (closed)
Edited by Benjamin Schubert