Does profile profile profile run inside threads?

I ran cprofile on some code that, among other things, spawns multiple threads that do most of the work. When I looked at the result of profiling, I do not see the registration of all functions that were called inside the threads. I am sure they were called because they do things that are easy to see, such as writing to a database, etc.

Does cProfile create thread profiling? Did I miss something?

+4
source share
1 answer

Found the answer here: link

It is worth noting that using the profiler works (by default) in the main thread, and you will not get any information from other threads if you use them. This may be a little useful as it is not completely mentioned in the profiler documentation. If you also want to profile threads, you need to look at the threading.setprofile () function in the documents.

+6
source

Source: https://habr.com/ru/post/1305202/


All Articles