Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
70
rated 0 times [  70] [ 0]  / answers: 1 / hits: 151364  / 1 Year ago, fri, february 24, 2023, 11:02:45

I tried googling it, but I can't find it. I am looking for:




  1. number of threads in process X


  2. total number of threads running currently



More From » system-info

 Answers
2

To get the number of threads for a given pid:



ps -o nlwp <pid>


To the get the sum of all threads running in the system:



ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'

[#41382] Saturday, February 25, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tresein

Total Points: 197
Total Questions: 113
Total Answers: 112

Location: Hungary
Member since Wed, Nov 9, 2022
2 Years ago
;