使用pidstat命令監視某程式的資源使用
NAME
pidstat - Report statistics for Linux tasks.SYNOPSIS
pidstat [ -C comm ] [ -d ] [ -h ] [ -I ] [ -l ] [ -p { pid [,...] | SELF | ALL } ] [ -r ] [ -t ] [ -T { TASK | CHILD | ALL } ] [ -u ] [ -V ] [ -w ] [ interval [ count ] ]DESCRIPTION
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.
OPTIONS
-C comm
Display only tasks whose command name includes the string comm.-d
Report I/O statistics (kernels 2.6.20 and later only). The following values are displayed:PID
The identification number of the task being monitored.kB_rd/s
Number of kilobytes the task has caused to be read from disk per second.kB_wr/s
Number of kilobytes the task has caused, or shall cause to be written to disk per second.kB_ccwr/s
Number of kilobytes whose writing to disk has been cancelled by the task. This may occur when the task truncates some dirty pagecache. In this case, some IO which another task has been accounted for will not be happening.Command
The command name of the task.-h
Display all activities horizontally on a single line. This is intended to make it easier to be parsed by other programs.-I
In an SMP environment, indicate that tasks CPU usage (as displayed by option -u ) should be divided by the total number of processors.-l
Display the process command name and all its arguments.-p { pid [,...] | SELF | ALL }
Select tasks (processes) for which statistics are to be reported. pid is the process identification number. The SELF keyword indicates that statistics are to be reported for the pidstat process itself, whereas the ALL keyword indicates that statistics are to be reported for all the tasks managed by the system.-r
Report page faults and memory utilization.When reporting statistics for individual tasks, the following values are displayed:
PID
The identification number of the task being monitored.minflt/s
Total number of minor faults the task has made per second, those which have not required loading a memory page from disk.majflt/s
Total number of major faults the task has made per second, those which have required loading a memory page from disk.VSZ
Virtual Size: The virtual memory usage of entire task in kilobytes.RSS
Resident Set Size: The non-swapped physical memory used by the task in kilobytes.Command
The command name of the task.When reporting global statistics for tasks and all their children, the following values are displayed:
PID
The identification number of the task which is being monitored together with its children.minflt-nr
Total number of minor faults made by the task and all its children, and collected during the interval of time.majflt-nr
Total number of major faults made by the task and all its children, and collected during the interval of time.Command
The command name of the task which is being monitored together with its children.-t
Also display statistics for threads associated with selected tasks.This option adds the following values to the reports:
TGID
The identification number of the thread group leader.TID
The identification number of the thread being monitored.-T { TASK | CHILD | ALL }
This option specifies what has to be monitored by the pidstat command. The TASK keyword indicates that statistics are to be reported for individual tasks (this is the default option) whereas the CHILD keyword indicates that statistics are to be globally reported for the selected tasks and all their children. The ALL keyword indicates that statistics are to be reported for individual tasks and globally for the selected tasks and their children.Note: Global statistics for tasks and all their children are not available for all options of pidstat. Also these statistics are not necessarily relevant to current time interval: The statistics of a child process are collected only when it finishes or it is killed.
-u
Report CPU utilization.When reporting statistics for individual tasks, the following values are displayed:
PID
The identification number of the task being monitored.%usr
Percentage of CPU used by the task while executing at the user level (application), with or without nice priority. Note that this field does NOT include time spent running a virtual processor.%system
Percentage of CPU used by the task while executing at the system level (kernel).%guest
Percentage of CPU spent by the task in virtual machine (running a virtual processor).%CPU
Total percentage of CPU time used by the task. In an SMP environment, the task's CPU usage will be divided by the total number of CPU's if option -I has been entered on the command line.CPU
Processor number to which the task is attached.Command
The command name of the task.When reporting global statistics for tasks and all their children, the following values are displayed:
PID
The identification number of the task which is being monitored together with its children.usr-ms
Total number of milliseconds spent by the task and all its children while executing at the user level (application), with or without nice priority, and collected during the interval of time. Note that this field does NOT include time spent running a virtual processor.system-ms
Total number of milliseconds spent by the task and all its children while executing at the system level (kernel), and collected during the interval of time.guest-ms
Total number of milliseconds spent by the task and all its children in virtual machine (running a virtual processor).Command
The command name of the task which is being monitored together with its children.-V
Print version number then exit.-w
Report task switching activity (kernels 2.6.23 and later only). The following values are displayed:PID
The identification number of the task being monitored.cswch/s
Total number of voluntary context switches the task made per second. A voluntary context switch occurs when a task blocks because it requires a resource that is unavailable.nvcswch/s
Total number of non voluntary context switches the task made per second. A involuntary context switch takes place when a task executes for the duration of its time slice and then is forced to relinquish the processor.Command
The command name of the task.ENVIRONMENT
The pidstat command takes into account the following environment variable:S_TIME_FORMAT
If this variable exists and its value is ISO then the current locale will be ignored when printing the date in the report header. The pidstat command will use the ISO 8601 format (YYYY-MM-DD) instead.
EXAMPLES
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 -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.來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8554499/viewspace-600478/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- iOS監控:資源使用iOS
- 檢視某個程式使用到的並行程式數並行行程
- 使用 Shell 指令碼監控 Linux 系統程式資源指令碼Linux
- MySQL Profile檢視SQL的資源使用MySql
- 監視index的使用情況Index
- linux 資源監視器Linux
- MongoDB如何使用top命令監控資料庫MongoDB資料庫
- 使用 Performance API 實現前端資源監控ORMAPI前端
- 詳述top命令監視程式的內容
- Oracle-監控使用系統資源較多的使用者資訊Oracle
- 如何使用 Glances 命令監控
- 在 Linux 命令列下使用 Mop 監視股票價格Linux命令列
- 監視映象資料庫的其他資訊源資料庫
- 使用select監視update的操作
- 用命令檢視Mysql中某個資料庫的大小?MySql資料庫
- 監視磁碟使用情況
- kill某個使用者的所有程式
- 使用netstat命令檢視埠的使用情況
- 監控某個目錄使用情況的shell指令碼指令碼
- 使用命令檢視 Laravel 的版本Laravel
- 使用Shell指令碼對Linux系統和程式資源進行監控指令碼Linux
- 使用 JavaScript Promise 讀取 Github 某使用者的資料JavaScriptPromiseGithub
- top linux 實時監控命令 檢視CPU使用率(轉)Linux
- 使用memadmin視覺化監視我們的memcache視覺化
- 請問我用監視者模式實現資源的監聽會浪費很多的資源嗎?模式
- Linux中檢視系統資源使用情況Linux
- 使用metrics-server監控k8s的資源指標ServerK8S指標
- 【dinghao】在.net程式中使用資源
- [20141203]學習使用pidstat.txt
- git的基本命令使用演示視訊Git
- linux上檢視埠使用的命令Linux
- Linux下資源利用率監測利器—nmon使用Linux
- 監視index的使用看看是否需要重建!Index
- 使用awk批次殺程式的命令
- Windows7資源監視器在哪裡Windows
- 019、Vue3+TypeScript基礎,使用watch監視物件資料時,如何監控整個物件或單獨監控物件某個屬性VueTypeScript物件
- windows cmd中檢視某個命令所在的路徑Windows
- iotop和pidstat