Python 3.10+threadingfunction
threading.getprofile()
tracing and profiling
Returns the profiling function set with threading.setprofile() for new threads, or None if there is none.
Syntax
threading.getprofile()
It returns exactly what was passed to threading.setprofile(), not the current thread's profiler: sys.getprofile() reads that, and the two can differ. Use it to install your own function temporarily and restore the previous one later. setprofile_all_threads() changes this value as well.
Examples
import sys
import threading
print(threading.getprofile()) # → None
def prof(frame, event, arg):
pass
threading.setprofile(prof)
print(threading.getprofile() is prof, sys.getprofile()) # → True None
threading.setprofile(None)
See also
Open in the full glossarydocs.python.orgReport an inaccuracy