天天看点

pidstat 统计进程、线程、进程组的资源消耗

postgresql , linux , pidstat

如果我们要查看linux下面进程、进程组、线程的资源消耗的统计信息,可以使用pidstat,它可以收集并报告进程的统计信息。

pidstat实际上也是将/proc/pid下的统计信息统筹后展现给用户。

1. 列出io统计信息:-d

2. 列出内存使用统计,page fault:-r

3. cpu统计信息:-u

4. 上下文切换统计信息:-w

5. 指定输出的维度

指定命令: -c command

指定进程号:-p { pid [,...] | self | all }

将所有列输出到单行、便于导入单张表中:-h

按每个cpu核的统计:-i

按所有cpu核统计:默认

列出命令的完整内容,包括参数:-l

列出线程统计信息:-t

按进程维度单独统计、按进程全局+子进程单独统计、按进程全局、单独统计同时按子任务单独统计:-t { task | child | all }

实例,统计5秒的值并输出

man pidstat

<a href="http://linoxide.com/linux-command/linux-pidstat-monitor-statistics-procesess/">http://linoxide.com/linux-command/linux-pidstat-monitor-statistics-procesess/</a>

<a href="http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858874.html">http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858874.html</a>

<a href="http://www.2cto.com/os/201306/217190.html">http://www.2cto.com/os/201306/217190.html</a>

继续阅读