Use ps in linux to get the number of running threads and thread start time

Source: Internet
Author: User
Linux processes have been running for a long time. in addition to reading/proc information, how can we get the number of all threads of a process and their startup time. Psmax-olstart, lwp, pid, nlwp, cmdlstartSTARTEDtimethe...

 

Linux processes have been running for a long time. in addition to reading/proc information, how can we get the number of all threads of a process and their startup time.

Ps max-o lstart, lwp, pid, nlwp, cmd

 

Lstart STARTED time the command started.

Nlwp NLWP number of lwps (threads) in the process. (alias thcount ).

Lwp LWP lwp (light weight process, or thread) ID of the lwp being reported.

(Alias spid, tid ).

 

BONO11-0-0-1:/root-# ps max-o % mem, lstart, lwp, pid, nlwp, cmd

% MEM STARTED LWP PID NLWP CMD

0.0 Fri Nov 11 13:25:29 2011-1 1 init [3]

-Fri Nov 11 13:25:29 2011 1 ---

0.0 Fri Nov 11 13:25:29 2011-2 1 [migration/0]

-Fri Nov 11 13:25:29 2011 2 ---

0.0 Fri Nov 11 13:25:29 2011-3 1 [ksoftirqd/0]

-Fri Nov 11 13:25:29 2011 3 ---

...

 

0.0 Fri Nov 11 13:50:46 2011-31012 8/opt/proxy/bin/http_stack Http Stack benchHttp _ asr_1_h-Fri Nov 11 13:50:46 2011 31012 ---

-Fri Nov 11 13:50:46 2011 31016 ---

-Fri Nov 11 13:50:46 2011 31018 ---

-Fri Nov 11 13:50:46 2011 31019 ---

-Fri Nov 11 13:50:47 2011 31855 ---

-Fri Nov 11 13:50:47 2011 31856 ---

-Fri Nov 11 13:50:47 2011 31857 ---

-Fri Nov 11 13:50:47 2011 31926 ---

0.0 Fri Nov 11 17:14:19 2011-31272 1 sshd: root @ notty

-Fri Nov 11 17:14:19 2011 31272 ---

 

We can verify that there are exactly eight tasks.

BONO11-0-0-1:/root-# ls/proc/31012/task/

31012 31016 31018 31019 31855 31856 31857

From licanhua's column

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.