[常用命令] ioprofile脚本介绍

1 ioprofile   (来源:http://aspersa.googlecode.com/svn/html/installing.html)
  作两件事 1> 利用lsof和strace获得结果
           2> 统计  如果跟文件名, 1 不执行

  a. 获得工具
    wget http://aspersa.googlecode.com/svn/trunk/ioprofile

  b. 生产环境使用要谨慎,可能导致mysql 挂起
 
  c.参数
    -a  sum)  default
        avg)
    -b  BINARY
    -c  CELL
        count)
        sizes)
        times)   default
    -g  GROUPBY
        all)  
        filename) default
        pid)
    -k  KEEPFILE /tmp
    -p  PID  覆盖 -b 参数
    -s  TIME   default
    
  d.用法
    
    1>ioprofile -b firefox

2012年 07月 12日 星期四 11:30:25 CST
Tracing process ID 337
     total       read      write      fsync  fdatasync       open      close      lseek      fcntl  ftruncate filename
  0.157100   0.000000   0.000516   0.156276   0.000000   0.000169   0.000139   0.000000   0.000000   0.000000 /home/xingwei/.mozilla/firefox/3560u2hd.default/sessionstore-1.js
  0.054706   0.000321   0.003002   0.000000   0.049684   0.000000   0.000000   0.001003   0.000000   0.000696 /home/xingwei/.mozilla/firefox/3560u2hd.default/places.sqlite-wal
  0.031445   0.000426   0.000212   0.000000   0.030506   0.000000   0.000000   0.000287   0.000000   0.000014 /home/xingwei/.mozilla/firefox/3560u2hd.default/places.sqlite
  0.003962   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000   0.000000   0.003962   0.000000 /home/xingwei/.mozilla/firefox/3560u2hd.default/places.sqlite-shm

    结果: 最左边一列降序排列
    total  总体
    read   读
    fysnc  只对文件描述符指定的单一文件起作用,将数据排入写队列,然后等待返回结果 (会更新文件属性)
    fdatasync 只对文件的数据部分起作用
    open   打开
    close  关闭
    lseek  控制文件的读写位置
    fcntl  用来操作文件描述符的一些特性。不仅可以施加建议性锁,还可以施加强制锁。同时还能对文件的某一记录进行上锁,也就是记录锁。
    ftruncate 会将参数fd指定的文件大小改为参数length指定的大小。参数fd为已打开的文件描述词,而且必须是以写入模式打开的文件。
    filename   完整文件名

    2>ioprofile  -b firefox -s 60 -k log

    3>ioprofile  -c count  log
    4>ioprofile  -a avg    log
    5>ioprofile  -c sizes  log
    6>ioprofile  -g pid    log
    7>ioprofile  -g all    log


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值