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.

  • Use top and switch the view with H, that will show you the count.
    – ott--
    Commented Jul 5, 2015 at 23:43

2 Answers 2

ps -eL|wc -l

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


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .