Skip to content

Commit 673a638

Browse files
committed
add threading trace_callback
1 parent 5728661 commit 673a638

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

codeflash/tracer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from copy import copy
2727
from io import StringIO
2828
from pathlib import Path
29+
import threading
2930
from types import FrameType
3031
from typing import Any, ClassVar, List
3132

@@ -143,11 +144,13 @@ def __enter__(self) -> None:
143144
self.dispatch["call"](self, frame, 0)
144145
self.start_time = time.time()
145146
sys.setprofile(self.trace_callback)
147+
threading.setprofile(self.trace_callback)
146148

147149
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
148150
if self.disable:
149151
return
150152
sys.setprofile(None)
153+
threading.setprofile(None)
151154
self.con.commit()
152155

153156
self.create_stats()

0 commit comments

Comments
 (0)