Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.ruby Subject: Re: get number of threads from a running process Date: Tue, 11 Dec 2012 23:34:21 +0100 Lines: 16 Message-ID: References: <99e74dc8-2056-4b1f-9b0d-9d2ce03dcddc@r10g2000pbd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net rOVYXbIMJ5OZ4PFQ57qq8QBStXUu98nKJQGNqMFOYlP/ApCikyAb//TnAXTZmf/sM= Cancel-Lock: sha1:WU8fNAtuw8TWZBGZ0xZwZODfP3w= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <99e74dc8-2056-4b1f-9b0d-9d2ce03dcddc@r10g2000pbd.googlegroups.com> Xref: csiph.com comp.lang.ruby:6695 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