Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #6695
| From | Robert Klemme <shortcutter@googlemail.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: get number of threads from a running process |
| Date | 2012-12-11 23:34 +0100 |
| Message-ID | <aipqndF3rhpU1@mid.individual.net> (permalink) |
| References | <99e74dc8-2056-4b1f-9b0d-9d2ce03dcddc@r10g2000pbd.googlegroups.com> |
On 12/11/2012 05:49 PM, Skellington wrote:
> is it possible to get a count on the number of threads a process is
> using? For example lets say I have Apache "httpd" and it has 66
> threads running according to top. Is there a way to get the number
> using ruby?
On Linux
def thread_count(pid)
Dir["/proc/#{pid}/task/*"].size
end
Kind regards
robert
Back to comp.lang.ruby | Previous | Next — Previous in thread | Find similar
get number of threads from a running process Skellington <ceh329@gmail.com> - 2012-12-11 08:49 -0800 Re: get number of threads from a running process Robert Klemme <shortcutter@googlemail.com> - 2012-12-11 23:34 +0100
csiph-web