Method: LinuxStat::ProcessInfo.threads

Defined in:
lib/linux_stat/process_info.rb

.threads(pid = $$) ⇒ Object

threads(pid = $$)

Where pid is the process ID.

By default it is the id of the current process ($$)

It retuns the threads for the current process in Integer.

For example:

LinuxStat::ProcessInfo.threads

=> 2

But if the info isn’t available, it will return nil.

This method is way more efficient than running LinuxStat::ProcessInfo.cpu_stat()



395
396
397
# File 'lib/linux_stat/process_info.rb', line 395

def threads(pid = $$)
	LinuxStat::ProcFS.ps_stat(pid)[16]
end