Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lblprof/custom_sysmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,14 @@ def _handle_return(self, code, instruction_offset, retval):
def start_tracing(self) -> None:
# Reset state
self.__init__()
sys.monitoring.use_tool_id(self.tool_id, "lblprof-monitor")
if not sys.monitoring.get_tool(self.tool_id):
sys.monitoring.use_tool_id(self.tool_id, "lblprof-monitor")
else:
# if the tool already assigned is not ours, we need to raise an error
if sys.monitoring.get_tool(self.tool_id) != "lblprof-monitor":
raise RuntimeError(
"A tool with the id lblprof-monitor is already assigned, please stop it before starting a new tracing"
)

# Register our callback functions
sys.monitoring.register_callback(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "lblprof"
version = "0.1.7"
version = "0.1.8"
description = "Line by line terminal based profiler"
authors = [
{ name="le-codeur-rapide", email="paul.vezia@gmail.com" }
Expand Down