1

How can I get the number of threads in the kernel at specific sampling rate? I need to measure the utilization of the system directly by myself.

1
  • Use top and switch the view with H, that will show you the count.
    – ott--
    Jul 5 '15 at 23:43
3
ps -eL|wc -l

gives total number of lwp/thread count at any point of time

2

Even though, @VenkatC's answer is correct, more optimal would be to get info from /proc/loadavg file:

awk '{split($4,a,"/");print a[2]}' /proc/loadavg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.