Python Standard Library includes two deterministic profilers as described in the Python documentation.
I have also found pprofile to be useful. It can produce the output in callgrind profile format. There is a good tool to visualise and explore this information, called QCacheGrind. It is a Windows build of a KDE tool KCachegrind.
— Oliver Frolovs, 2020