pidstat详解

pidstat详解pidstat Reportstatis 显示进程 任务 的相关的统计 pidstat 主要用于监控全部或指定进程占用系统资源的情况 如 CPU 内存 设备 IO 任务切换 线程等 pidstat 首次运行时显示自系统启动开始的各项统计信息 之后运行 pidstat 将显示自上次运行该命令以后的统计信息 用户可以通过指定统计的次数和时间来获得所需的统计信息

pidstat - Report statistics for Linux tasks(显示进程(任务)的相关的统计)
pidstat主要用于监控全部或指定进程占用系统资源的情况,如CPU,内存、设备IO、任务切换、线程等。pidstat首次运行时显示自系统启动开始的各项统计信息,之后运行pidstat将显示自上次运行该命令以后的统计信息。用户可以通过指定统计的次数和时间来获得所需的统计信息。
用法:
pidstat [ -C comm ] [ -d ] [ -h ] [ -I ] [ -l ] [ -p { pid [,...] | SELF | ALL } ] [ -r ] [ -s ] [ -t ] [ -T { TASK | CHILD | ALL } ] [ -u ] [ -V ] [ -w ] [ interval [ count ] ]
描述:
 The pidstat command is used for monitoring individual tasks currently being managed by the Linux kernel. It writes to standard output activities for every task selected with option -p or for every task managed by the Linux kernel if option -p ALL has been used. Not selecting any tasks is equivalent to specifying -p ALL but only active tasks (tasks with non-zero statistics values) will appear in the report.
 The pidstat command can also be used for monitoring the child processes of selected tasks. Read about option -T below.
 The interval parameter specifies the amount of time in seconds between each report. A value of 0 (or no parameters at all) indicates that tasks statistics are to be reported for the time since system startup (boot). The count parameter can be specified in conjunction with the interval parameter if this one is not set to zero. The value of count determines the number of reports generated at interval seconds apart. If the interval parameter is specified without the count parameter, the pidstat command generates reports continuously.
 You can select information about specific task activities using flags. Not specifying any flags selects only CPU activity.
选项:
 -C comm #只显示那些包含字符串(可是正则表达式)comm的命令的名字 -d #显示I/O统计信息(须内核2.6.20及以后) PID #进程号 kB_rd/s #每秒此进程从磁盘读取的千字节数 kB_wr/s #此进程已经或者将要写入磁盘的每秒千字节数 kB_ccwr/s #由任务取消的写入磁盘的千字节数 Command #命令的名字 -h #显示所有的活动的任务 -I #在SMP环境,指出任务的CPU使用(等同于选项-u)应该被除于cpu的总数 -l #显示进程的命令名和它的参数 -p { pid [,...] | SELF | ALL } #指定线程显示其报告 -r #显示分页错误的内存利用率 When reporting statistics for individual tasks, the following values are displayed: PID #进程号 minflt/s #每秒次缺页错误次数(minor page faults),次缺页错误次数意即虚拟内存地址映射成物理内存地址产生的page fault次数 majflt/s #每秒主缺页错误次数(major page faults),当虚拟内存地址映射成物理内存地址时,相应的page在swap中,这样的page fault为major page fault,一般在内存使用紧张时产生 VSZ #该进程使用的虚拟内存(以kB为单位) RSS #该进程使用的物理内存(以kB为单位) %MEM #当前任务使用的有效内存的百分比 Command #任务的命令名 When reporting global statistics for tasks and all their children, the following values are displayed: PID #PID号 minflt-nr #在指定的时间间隔内收集的进程和其子进程的次缺页错误次数 majflt-nr #在指定的时间间隔内收集的进程和其子进程的主缺页错误次数 Command #命令名 -s #堆栈的使用 -t #显示与所选任务相关的线程的统计数据 -T { TASK | CHILD | ALL } #指定必须监测的内容:TASK是默认的,单个任务的报告;CHILD:指定的进程和他们的子进程的全局报告,ALL:相当于TASK和CHILD -u #报告CPU使用 When reporting statistics for individual tasks, the following values are displayed: PID %usr #用户层任务正在使用的CPU百分比(with or without nice priority ,NOT include time spent running a virtual processor) %system #系统层正在执行的任务的CPU使用百分比 %guest #运行虚拟机的CPU占用百分比 %CPU #所有的使用的CPU的时间百分比 CPU #处理器数量 Command #命令 When reporting global statistics for tasks and all their children, the following values are displayed: PID #PID号 usr-ms #在指定时间内收集的在用户层执行的进程和它的子进程占用的CPU时间(毫秒){with or without nice priority,NOT include time spent running a virtual processor) system-ms #在指定时间内收集的在系统层执行的进程和它的子进程占用的CPU时间(毫秒) guest-ms #花在虚拟机上的时间 Command #命令 -V #版本号 -w #报告任务切换情况 PID #PID号 cswch/s #每秒自动上下文切换 nvcswch/s #每秒非自愿的上下文切换 Command #命令
示例:
 $ pidstat 2 5 #Display five reports of CPU statistics for every active task in the system at two second intervals. $ pidstat -r -p 1643 2 5 #Display five reports of page faults and memory statistics for PID 1643 at two second intervals. $ pidstat -C "fox|bird" -r -p ALL #Display global page faults and memory statistics for all the processes whose command name includes the string "fox" or "bird". $ pidstat -T CHILD -r 2 5 #Display five reports of page faults statistics at two second intervals for the child processes of all tasks in the system. Only child processes with non-zero statistics values are displayed.
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/212188.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 下午8:37
下一篇 2026年3月18日 下午8:37


相关推荐

  • 学生选课管理系统 选课信息管理系统管理端「建议收藏」

    学生选课管理系统 选课信息管理系统管理端「建议收藏」学生选课信息管理系统管理端面向对象程序设计——课程设计(c++)必须使用vs,因为devc++会报错。程序详情见下面代码块或访问https://download.csdn.net/download/zhanjuex/12733258一、项目名称:学生选课信息管理系统管理端二、项目功能:(一)实现课程信息打印、查询、录入、删除、修改功能。(二)实现学生信息打印、查询、录入、删除、修改功能。(三)课程信息、学生信息交互,实现选课管理端根据学生已有学分进行选课。(包括帮助学生选课或删除学生已选课

    2022年10月9日
    5
  • navicatformysql15永久激活码【在线破解激活】

    navicatformysql15永久激活码【在线破解激活】,https://javaforall.net/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

    2022年3月16日
    59
  • vue字符串转换成日期格式_vue时间戳转换日期格式

    vue字符串转换成日期格式_vue时间戳转换日期格式字符串转date例如(202003)转成标准时间letstr=row.startdate.slice(0,4)+”-“+row.startdate.slice(4,6);letdate=newDate(str);console.log(date);注意这里的str必须是XXXX-XX-XX形式row.startdate.slice(0,4)+“-”+row.startdate.slice(4,6);这个是处理成这样的形式。将

    2022年10月3日
    4
  • Kimi 国际版使用 Nano Banana Pro 生成 PPT 要点指南(2025⽁⽂ 更新)

    Kimi 国际版使用 Nano Banana Pro 生成 PPT 要点指南(2025⽁⽂ 更新)

    2026年3月13日
    2
  • linux下keras安装教程_keras安装及使用

    linux下keras安装教程_keras安装及使用安装全称参考 https keras cn readthedocs io en latest for beginners keras linux 环境中已配置 cuda8 0 cudnn5 0 ubuntu16 04 安装的 tensorflow gpu 版本安装完成后进行测试 importtensor 问题 ImportError libcublas so 9 0 cannotopens

    2026年3月18日
    3
  • Postman安装与入门简单教程[通俗易懂]

    Postman安装与入门简单教程[通俗易懂]在测试技术中,接口测试是最基础、最重要,也是收益最高的测试技术,作为接口测试工具中的No.1,一起来看看Postman是怎么入门的吧。目录1.安装Postman2.注册Postman账号并登录3.创建Collections4.创建Request5.简单的Demo测试1.安装PostmanPostman下载地址:https://app.getpostman.com/app/download/win64点开后机会自动下载最新版的Postman,如果链接打不开或者很慢也可以上百度去下载,版本旧一点没关系,

    2026年1月16日
    6

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号