Linux Command pidstat TC Learning

Source: Internet
Author: User
Tags cpu usage

2.Linux Development machine and intranet server Mutual transfer file method

Download file:

Running on an intranet server

1 tar-cf - file_name | nc -l -p 8555

Run on a Linux notebook:

1 nc 10.1.1.1 8555 | tarxvf -

Upload file:

Running on an intranet server

1 nc -l -p 8555 | tarxvf -

Run on a Linux notebook:

1 tar-cf - file_name | nc 10.1.1.1 8555

3. Get the current machine occupies the highest IO process

1 pidstat -d 1

pidstat Command Detailed description Introduction

Pidstat is primarily used to monitor all or specified processes that consume system resources, such as CPU, memory, device IO, task switching, threading, 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.

Example Explanation

Default parameters

Executes Pidstat, which outputs the CPU statistics for all active processes after the system is started:

linux:~ # pidstatlinux 2.6.32.12-0.7-default (Linux)             06/18/12        _x86_64_11:37:19          PID    %usr%system  %guest    %cpu   CPU  Command ... 11:37:19114520.000.000.000.002  BASH11:37:19115090.000.000.000.003DD

Specify sampling period and number of samples

The Pidstat command specifies the sampling period and the number of samples, the command is "pidstat [option] interval [count]", and the following Pidstat outputs 10 CPU usage statistics with a 2-second sampling period:

Pidstat 210

CPU Usage statistics (-u)

With the-u option, Pidstat displays the CPU usage statistics for each active process, performing "Pidstat-u" the same as performing "Pidstat" alone.

Memory usage statistics (-R)

Using the-r option, Pidstat displays the memory usage statistics for each active process:

linux:~ # Pidstat-r-P 130841Linux 2.6.32.12-0.7-default (Linux)             06/18/12        _x86_64_15:08:18          PID  minflt/s  majflt/s     VSZ    RSS   %MEM  command15:08:1913084133835.000.00157202841571689696.26  mmmm15:08:201308435807.000.00158635041584975697.07  mmmm15:0 8:211308419273.870.00159490401579294496.72  MMMM

The output of the above columns has the following meanings:

MINFLT/S: Number of page faults per second (minor page faults), the number of times page faults means that the virtual memory address is mapped to the physical memory address generated by the page fault number majflt/s: Number of main faults per second (Major page faults), When the virtual memory address is mapped to a physical memory address, the corresponding page is in swap, and the page fault is major page fault, typically generating a vsz when memory usage is tense:      the virtual memory (in kilobytes) that the process uses for RSS:      The amount of physical memory (in kilobytes) used by the process%MEM:     The process uses a percentage of memory command: The  command to pull up the process

IO Case Statistics (-D)


With the-D option, we can view the statistics for process IO:

linux:~ # pidstat-d 12Linux 2.6.32.12-0.7-default (Linux)             06/18/12        _x86_64_17:11:36          PID   kb_rd/s   kb_wr/s kb_ccwr/s  command17:11:3714579124988.240.000.00dd17:11:37          PID   kb_rd/s   kb_wr/s kb_ccwr/s  Command17 : 11:3814579105441.580.000.00DD

Output message Meaning

KB_RD/S: The amount of data (in kilobytes) that the process reads from the disk per second kb_wr/s: The amount of data (in kilobytes) that the process writes to disk per second command: The commands that pull up the process

For specific process statistics (-p)

With the-P option, we can view system resource usage for a particular process:

linux:~ # Pidstat-r-P 11Linux 2.6.32.12-0.7-default (Linux)             06/18/12        _x86_64_18:26:17          PID  minflt/s  majflt/s     VSZ    RSS   %MEM  command18:26:1810.000.00103806400.00  init18 : 26:1910.000.00103806400.00  Init

pidstat Common Commands

When using Pidstat for problem targeting, the following commands are often used:

Pidstat-u 1pidstat-r 1pidstat-d 1

The above command takes 1 seconds for the information acquisition cycle, respectively, to obtain the CPU, memory and disk IO statistics.

Linux Command pidstat TC Learning

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.