I wrote a program with Python and it uses multi-threads, i want to know how many threads were executed with the timing and all of the statistics, is there a way to use the debugger to have those results ?
PS: i am using PyCharm.
Assuming you are using the threading
module rather than bare thread
s, you can use threading.activeCount()
as follows:
num_threads = threading.activeCount()
to get the amount of threads. To get the threads themselves, use threading.enumerate()
:
for th in threading.enumerate():
# do whatever.
As far as timing and other statistics, you may have to track these manually, it looks like Thread
objects are fairly scant of meta-data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.