统计linux cpu内存报表,[Linux] 统计和分析系统性能【IO CPU 内存】的工具集合

统计和分析系统性能【IO CPU 内存】的工具集合

blktrace

http://www.oschina.net/p/blktrace

获取磁盘写入的信息

root@demo:~/install/percona-toolkit-2.2.1# debugfs -R 'stats' /dev/sda1

debugfs 1.41.11 (14-Mar-2010)

debugfs -R 'stats' /dev/sda1|grep Block

debugfs 1.41.11 (14-Mar-2010)

Block count:              5012992

Block size:               4096

Blocks per group:         32768

Mount -t debugfs none /sys/kernel/debug

dd if=/dev/zero of=/root/a.s bs=1024 count=1000

./blktrace -d /dev/sda -o - | ./blkparse -i -

8,0    0     1070    71.884893141  6075  M   W 575360 + 8 [dd]

8,0    0     1071    71.884894103  6075  A   W 575368 + 8

8,0    0     1072    71.884894272  6075  Q   W 575368 + 8 [dd]

8,0    0     1073    71.884894481  6075  M   W 575368 + 8 [dd]

8,0    0     1074    71.884895481  6075  A   W 575376 + 8

8,0    0     1075    71.884895621  6075  Q   W 575376 + 8 [dd]

8,0    0     1076    71.884895830  6075  M   W 575376 + 8 [dd]

root@demo:~/install/blktrace# debugfs -R "icheck `echo 573320/8|bc`" /dev/sda1

debugfs 1.41.11 (14-Mar-2010)

Block Inode number

71665 937613

root@demo:~/install/blktrace#

root@demo:~/install/blktrace# debugfs -R "ncheck 937613" /dev/sda1

debugfs 1.41.11 (14-Mar-2010)

Inode Pathname

937613 /root/a.s

此时通过lsof可以查到是谁在写/root/a.s

iotop

http://www.oschina.net/p/iotop

./iotop.py -p ##

这个工具是python脚本

5e0fddc74c0e97c8d8c25b6fb90f089d.png

和top的使用有些类似

strace ltrace

http://sourceforge.net/projects/strace/

http://ltrace.alioth.debian.org/

统计、跟踪程序使用库函数、系统函数

Ø 执行跟踪执行某个文件

n strace prog

n ltrace prog

Ø 已经执行的文件跟踪

n strace -p pid

n ltrace -p pid

n 这种情况有pthread的程序,附加会出现问题SIG_TRAP

Percona toolkit

https://www.percona.com/downloads/percona-toolkit/

http://blog.chinaunix.net/uid-20639775-id-3206802.html

percona-toolkit工具包的使用教程之开发工具类使用

http://blog.chinaunix.net/uid-20639775-id-3207926.html

percona-toolkit工具包的使用教程之性能类工具

http://blog.chinaunix.net/uid-20639775-id-3210834.html

percona-toolkit工具包的使用教程之配置类工具

http://blog.chinaunix.net/uid-20639775-id-3210843.html

percona-toolkit工具包的使用教程之监控类工具使用

http://blog.chinaunix.net/uid-20639775-id-3215742.html

percona-toolkit工具包的使用教程之复制类工具

http://blog.chinaunix.net/uid-20639775-id-3229211.html

percona-toolkit工具包的使用教程之系统类工具

http://blog.chinaunix.net/uid-20639775-id-3236839.html

percona-toolkit工具包的使用教程之实用类工具

http://blog.chinaunix.net/uid-20639775-id-3236864.html

Ø pt-diskstats

An interactive I/O monitoring tool for GNU/Linux.

Ø pt-ioprofile

Watch process IO and print a table of file and I/O activity.

pt-ioprofile --profile-pid=### --cell=sizes

Ø pt-summary

Summarize system information nicely.

sysstat

http://pagesperso-orange.fr/sebastien.godard/

./iostat -x 2

Report Central Processing Unit (CPU) statistics and input/output

statistics for devices and partitions.

#CPU

# ?秒  ?次

./pidstat -u 2 &> cpu.txt &

#内存

./pidstat -r 10 &> mem.txt &

#磁盘

./pidstat -d 2  &> io.txt &

#

./iostat -x 2 &> iostat.txt &

#

./mpstat -P ALL 2 &> mpstat.txt &

#

sudo mkdir /var/log/sa -p

sudo chmod 777 /var/log/sa

sudo cp sad* /sbin/.

./sar -u 2 &> sacpu.txt &

./sar -b 2 &> saio.txt &

#创建的线程数

#./sar -c 2 &> sathread.txt &

#进程队列和平均负载统计信息

./sar -q 2 &> saproc.txt &

#内存和交换空间

./sar -r 10 &> samem.txt &

如上的例子就是采样信息写入到文件中

top/htop

http://sourceforge.net/projects/htop/

htop 是一个 Linux 下的交互式的进程浏览器,可以用来替换Linux下的top命令。

内存

Linux系统没运行多少程序,显示的可用内存这么少?其实Linux与Win的内存管理不同,会尽量缓存内存以提高读写性能,通常叫做Cache Memory

http://www.ha97.com/4337.html

http://blog.csdn.net/heizistudio/article/details/25125061 这个文章讲解的更详细

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值