打印当前进程线程的名称和数量

import multiprocessing
import threading
process_info = multiprocessing.current_process()
print(f"当前进程数量: {multiprocessing.cpu_count()}")
print(f"当前进程编号: {process_info.name}")

# 打印当前线程数量和编号
thread_info = threading.current_thread()
print(f"当前线程数量: {threading.active_count()}")
print(f"当前线程编号: {thread_info.name}")

你可能感兴趣的:(python,java,前端)