CPU

  • vmstat 1

  • mpstat #查看所有CPU 信息

  • top

  • pidstat #每个进程CPU使用量

  • sar -u 2 2

  • perf #可以跟着到进程内部具体函数耗时情况,并且可以指定内核函数进行统计

    • sudo yum install perf gawk (on centos install perf if no)

perf-tools

cd

git clone --depth 1 https://github.com/brendangregg/perf-tools

cd perf-tools
[root@sf-vm-1 perf-tools]# sudo ./iolatency
Tracing block I/O. Output every 1 seconds. Ctrl-C to end.

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 0        |                                      |

  >=(ms) .. <(ms)   : I/O      |Distribution                          |
       0 -> 1       : 3        |######################################|
[root@sf-vm-1 perf-tools]# sudo ./fs/cachestat
Counting cache functions... Output every 1 seconds.
    HITS   MISSES  DIRTIES    RATIO   BUFFERS_MB   CACHE_MB
     451        0        0   100.0%            2       3703
     452        0        0   100.0%            2       3703
     452        0        0   100.0%            2       3703
     451        0        0   100.0%            2       3703
     451        0        0   100.0%            2       3703
     451        0        0   100.0%            2       3703
     452        0        0   100.0%            2       3703
     450        0        0   100.0%            2       3703
     451        0        0   100.0%            2       3703
     451        0        0   100.0%            2       3703
^C     443        0        0   100.0%            2       3703

Ending tracing...

Last updated

Was this helpful?