System performance monitoring Tool-Pidstat

Source: Internet
Author: User

It is primarily used to monitor all or the specified processes that consume system resources, such as CPUs, memory, device IO, task switches, threads, and so on. Pidstat displays statistics from the start of the system startup at the first run, and then runs Pidstat displays statistics from the last time the command was run. Users can obtain the required statistics by specifying the number and time of the statistics.
Parameters:
-L Displays the process and CPU-related information (the command column can display the full pathname of the commands and the parameters of the command).
-D displays information about the process and device IO.
-R Displays the process and memory-related information.
-W Displays information about the process and the task time slice switchover.
-T displays information about threads that are running within the process.
After-P is followed by the monitored process ID or all (representing all processes), and if this option is not specified, all processes running on the current system are monitored.

1) Monitor CPU resource usage of the PID 1 (init) process, which refreshes and outputs once every 3 seconds, 3 times after the program exits
Pidstat-p 1 2 3-l
07:18:58 AM PID%usr%system%guest%cpu CPU Command
07:18:59 AM 1 0.00 0.00 0.00 0.00 0/sbin/init
07:19:00 AM 1 0.00 0.00 0.00 0.00 0/sbin/init
07:19:01 AM 1 0.00 0.00 0.00 0.00 0/sbin/init
Average:1 0.00 0.00 0.00 0.00-/sbin/init

%USR: The CPU usage of the process in the user state.
%system: CPU utilization of the process at the kernel state (System level).
%CPU: The total CPU utilization of the process, if in SMP environment, the value will be divided by the number of CPUs to represent the data per CPU.
CPU: The CPU number that the process is attached to (0 represents the first CPU).

2) Monitor the device IO resource load of the process with PID 1 (init), which refreshes and outputs once every 2 seconds, 3 times after the program exits
Pidstat-p 1 2
07:24:49 AM PID kb_rd/s kb_wr/s kb_ccwr/s Command
07:24:51 AM 1 0.00 0.00 0.00 Init
07:24:53 AM 1 0.00 0.00 0.00 Init
07:24:55 AM 1 0.00 0.00 0.00 Init
Average:1 0.00 0.00 0.00 Init

KB_RD/S: The number of bytes read per second of the process (in kilobytes).
KB_WR/S: The number of bytes written by the process per second in kilobytes (KB).
KB_CCWR/S: This process cancels the number of disk writes per second (in kilobytes).

3) Monitor the memory usage of the process with PID 1 (init), which refreshes and outputs once every 2 seconds, 3 times after the program exits
Pidstat-p 1 2 3-r
07:29:56 AM PID minflt/s majflt/s VSZ RSS%MEM Command
07:29:58 AM 1 0.00 0.00 2828 1368 0.13 Init
07:30:00 AM 1 0.00 0.00 2828 1368 0.13 Init
07:30:02 AM 1 0.00 0.00 2828 1368 0.13 Init
Average:1 0.00 0.00 2828 1368 0.13 Init

MINFLT/S: Number of page faults per second (minor page faults), number of times page faults means that the virtual memory address is mapped to the number of pages fault generated by the physical memory address
MAJFLT/S: The number of Main page faults per second (Major page faults), when the virtual memory address is mapped to a physical memory address, the corresponding pages in the swap, such page fault is major page fault, generally in memory use tension generated
VSZ: Virtual memory (in kilobytes) used by the process
RSS: The amount of physical memory used by the process (in kilobytes)
%MEM: Percentage of memory used by the process
Command: Pull up the commands corresponding to the process

4) Monitoring the PID 1 (INIT) Process task switching situation, which refreshes and outputs every 2 seconds, 3 times after the program exits.
Pidstat-p 1 2 3-w
07:32:15 AM PID cswch/s nvcswch/s Command
07:32:17 AM 1 0.00 0.00 Init
07:32:19 AM 1 0.00 0.00 Init
07:32:21 AM 1 0.00 0.00 Init
Average:1 0.00 0.00 Init

CSWCH/S: The number of times a task is actively (voluntarily) switching contexts per second. Active switching is when a task is in a blocking wait, it voluntarily yields its own CPU resources.
NVCSWCH/S: The number of times the task is passively (involuntarily) switching contexts per second. Passive switching is when the CPU has run out of time slices allocated to a task, forcing the process to let the CPU execute.

5) Monitor the PID 1 (INIT) process and its internal thread memory (r option) usage, which refreshes and outputs once every 2 seconds, 3 times after the program exits. It is necessary to note that if the-t option is not followed by any other option, the default monitoring is CPU resources
Pidstat-p 1 2 3-tr
Linux 2.6.32-71.el6.i686 (stephen-pc) 11/16/2011 _i686_ (1 CPU)
07:37:04 AM tgid TID minflt/s majflt/s VSZ RSS%MEM Command
07:37:06 AM 1-0.00 0.00 2828 1368 0.13 Init
07:37:06 AM-1 0.00 0.00 2828 1368 0.13 |__init

07:37:06 AM tgid TID minflt/s majflt/s VSZ RSS%MEM Command
07:37:08 AM 1-0.00 0.00 2828 1368 0.13 Init
07:37:08 AM-1 0.00 0.00 2828 1368 0.13 |__init

07:37:08 AM tgid TID minflt/s majflt/s VSZ RSS%MEM Command
07:37:10 AM 1-0.00 0.00 2828 1368 0.13 Init
07:37:10 AM-1 0.00 0.00 2828 1368 0.13 |__init

Average:tgid TID minflt/s majflt/s VSZ RSS%MEM Command
Average:1-0.00 0.00 2828 1368 0.13 Init
Average:-1 0.00 0.00 2828 1368 0.13 |__init

Tgid: Thread group ID.
TID: Thread ID.
The above options for monitoring different resources can exist at the same time, so that the use of multiple resources will be output in a single output, such as: Pidstat-p 1-dr.

System performance monitoring Tool-Pidstat

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.