[英]Finding usage of resources (CPU and memory) by threads of a process in unix (solaris/linux)
I have a multi-threaded application(C++ and pthread library) and I will like to know how much resources(CPU and memory) each thread uses. 我有一个多线程应用程序(C ++和pthread库),我想知道每个线程使用多少资源(CPU和内存)。 Is there a way to find out these details on Solaris and Linux both or on either of them.
有没有办法在Solaris和Linux或两者中找到这些详细信息。
You could use the ps command with some option: 您可以将ps命令与某些选项一起使用:
ps -eLo pid,ppid,lwp,nlwp,osz,rss,ruser,pcpu,stime,etime,args | more PID PPID LWP NLWP SZ RSS RUSER %CPU STIME ELAPSED COMMAND 0 0 1 1 0 0 root 0.0 Oct_02 4-02:13:37 sched 1 0 1 1 298 528 root 0.0 Oct_02 4-02:13:36 /sbin/init 2 0 1 1 0 0 root 0.0 Oct_02 4-02:13:36 pageout
Have a look at the ps man's page to get some information (LWP (light weight process)) 查看ps手册页以获取一些信息(LWP(轻量级过程))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.