http://hushi55.github.io/2015/10/16/Block-Input-Output/

http://myaut.github.io/dtrace-stap-book/kernel/bio.html

http://blog.itpub.net/15480802/viewspace-762765/

http://blog.163.com/digoal@126/blog/static/1638770402013101993142404/

http://www.searchtb.com/2013/02/iowait_why_and_optimization.html

http://blog.yufeng.info/ppt

----------------------------------------------------------------------------------------------------------

systemtap 提供的io tracepoint

ioblock.end
ioblock.request
ioblock_trace.bounce
ioblock_trace.end
ioblock_trace.request

ioscheduler.elv_add_request
ioscheduler.elv_add_request.kp
ioscheduler.elv_add_request.tp
ioscheduler.elv_completed_request
ioscheduler.elv_next_request
ioscheduler.elv_next_request.return

ioscheduler_trace.elv_abort_request
ioscheduler_trace.elv_completed_request
ioscheduler_trace.elv_issue_request
ioscheduler_trace.elv_requeue_request
ioscheduler_trace.plug
ioscheduler_trace.unplug_io
ioscheduler_trace.unplug_timer

---------------------------------------------------------------

[root@localhost ~]# mount   -t  debugfs none  /sys/kernel/debug/
[root@localhost ~]# blktrace  /dev/sda                         
^CDevice: /dev/sda
  CPU  0:                    0 events,      524 KiB data
  CPU  1:                    0 events,      830 KiB data
  Total:                     0 events (dropped 0),     1353 KiB data

----------------------------------------------------------------------------------------------------------------

[root@localhost ~]# stap -l 'ioblock.*'
ioblock.end
ioblock.request

[root@localhost ~]# stap -L 'ioblock.*'                    
ioblock.end

name:string devname:string ino:long bytes_done:long error:long sector:long flags:long rw:long vcnt:long

idx:long phys_segments:long hw_segments:long size:long $bio:struct bio* $error:int

ioblock.request

name:string devname:string ino:long sector:long flags:long rw:long vcnt:long idx:long phys_segments:long

hw_segments:long size:long bdev:long bdev_contains:long p_start_sect:long $bio:struct bio*

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[root@localhost ~]# stap -l 'ioscheduler.*'
ioscheduler.elv_add_request
ioscheduler.elv_completed_request
ioscheduler.elv_next_request

[root@localhost ~]# stap -L 'ioscheduler.*'

ioscheduler.elv_add_request

__tracepoint_arg_q:long __tracepoint_arg_rq:long name:string q:long elevator_name:string rq:long disk_major:long disk_minor:long rq_flags:long $q:struct request_queue* $rq:struct request*

ioscheduler.elv_completed_request

name:string elevator_name:string disk_major:long disk_minor:long rq:long rq_flags:long $q:struct request_queue* $rq:struct request*
ioscheduler.elv_next_request

name:string elevator_name:string $q:struct request_queue* $__func__:char[] const

-------------------------------------------------------------------------------------------------------------

[root@localhost linux-2.6.32]# stap -l 'kernel.trace("block_*")'
kernel.trace("block:block_bio_backmerge")
kernel.trace("block:block_bio_bounce")
kernel.trace("block:block_bio_complete")
kernel.trace("block:block_bio_frontmerge")
kernel.trace("block:block_bio_queue")
kernel.trace("block:block_getrq")
kernel.trace("block:block_plug")
kernel.trace("block:block_remap")
kernel.trace("block:block_rq_abort")
kernel.trace("block:block_rq_complete")
kernel.trace("block:block_rq_insert")
kernel.trace("block:block_rq_issue")
kernel.trace("block:block_rq_remap")
kernel.trace("block:block_rq_requeue")
kernel.trace("block:block_sleeprq")
kernel.trace("block:block_split")
kernel.trace("block:block_unplug_io")
kernel.trace("block:block_unplug_timer")

----------------------------------------------------------------------------------

[root@localhost linux-2.6.32]# stap -L 'kernel.trace("block_*")'
kernel.trace("block:block_bio_backmerge") $q:struct request_queue* $bio:struct bio*
kernel.trace("block:block_bio_bounce") $q:struct request_queue* $bio:struct bio*
kernel.trace("block:block_bio_complete") $q:struct request_queue* $bio:struct bio*
kernel.trace("block:block_bio_frontmerge") $q:struct request_queue* $bio:struct bio*
kernel.trace("block:block_bio_queue") $q:struct request_queue* $bio:struct bio*
kernel.trace("block:block_getrq") $q:struct request_queue* $bio:struct bio* $rw:int
kernel.trace("block:block_plug") $q:struct request_queue*
kernel.trace("block:block_remap") $q:struct request_queue* $bio:struct bio* $dev:dev_t $from:sector_t
kernel.trace("block:block_rq_abort") $q:struct request_queue* $rq:struct request*
kernel.trace("block:block_rq_complete") $q:struct request_queue* $rq:struct request*
kernel.trace("block:block_rq_insert") $q:struct request_queue* $rq:struct request*
kernel.trace("block:block_rq_issue") $q:struct request_queue* $rq:struct request*
kernel.trace("block:block_rq_remap") $q:struct request_queue* $rq:struct request* $dev:dev_t $from:sector_t
kernel.trace("block:block_rq_requeue") $q:struct request_queue* $rq:struct request*
kernel.trace("block:block_sleeprq") $q:struct request_queue* $bio:struct bio* $rw:int
kernel.trace("block:block_split") $q:struct request_queue* $bio:struct bio* $new_sector:unsigned int
kernel.trace("block:block_unplug_io") $q:struct request_queue*
kernel.trace("block:block_unplug_timer") $q:struct request_queue*

--------------------------------------------------------------------------------------------

[root@localhost linux-2.6.32]# stap -l 'kernel.function("congestion_wait")'
kernel.function("congestion_wait@mm/backing-dev.c:752")

--------------------------------------------------------------------------------------------------

[root@localhost /]# cd /usr/share/systemtap/tapset

root@localhost tapset]# grep -e 'ioblock.request' -R *   // 在当前目录下文件中搜索 ioblock.request 字符串
ioblock.stp: *  probe ioblock.request - Fires whenever making a generic block I/O request.
ioblock.stp:probe ioblock.request = kernel.function ("generic_make_request")
ioblock.stp:    name = "ioblock.request"

[root@localhost tapset]# stap -l 'kernel.function ("generic_make_request")'
kernel.function("generic_make_request@block/blk-core.c:1502")

[root@localhost tapset]# grep -e 'ioblock.end' -R *
ioblock.stp: * probe ioblock.end - Fires whenever a block I/O transfer is complete.
ioblock.stp:probe ioblock.end = kernel.function("bio_endio")
ioblock.stp:    name = "ioblock.end"

[root@localhost tapset]# stap -l 'kernel.function("bio_endio")'
kernel.function("bio_endio@fs/bio.c:1411")

ioblock.request:是内核函数 generic_make_request 的别名

ioblock.end:是内核函数 bio_endio 的别名

我这是使用的源码安装的 systemtap,

使用 yum 安装的 systemtap 的两个重要位置在

/usr/share/doc/systemtap-client-2.6/examples:systemtap 自带示例脚本的目录

/usr/share/systemtap/:systemtap 运行时的一些脚本,包括一些别名的定义

-----------------------------------------------------------------------------------------------------------------------------------

用tgpt

(gdb) trace generic_make_request

(gdb) list  1502    //直接显示第 1502行函数generic_make_request 源代码

也可进行实时调试

LINUX block I/O --systemtap的更多相关文章

  1. linux系统分析工具续-SystemTap和火焰图(Flame Graph)

    本文为网上各位大神文章的综合简单实践篇,参考文章较多,有些总结性东西,自认暂无法详细写出,建议读文中列出的参考文档,相信会受益颇多.下面开始吧(本文出自 “cclo的博客” 博客,请务必保留此出处ht ...

  2. Linux: Block Port With IPtables

    由Internet和其他网络协议识别端口号,使计算机能够与其他人进行交互.每个Linux服务器都有一个端口号(参见/ etc / services文件) Block Incoming Port The ...

  3. Linux block(1k) block(4k) 换算 gb

    输入 df  显示1k blocks  大小   再输入  df -h  显示 gb换算大小  结论 block(1k) 计算公式为:  block(1k)   /1024/1000  = xx gb ...

  4. 【SystemTap】 Linux下安装使用SystemTap源码安装SystemTap

    转自 http://blog.csdn.net/zklth/article/details/6248558 文章 http://blog.csdn.net/zklth/archive/2010/09/ ...

  5. linux 内核分析+使用SystemTap调试新增内核模块

    http://blog.chinaunix.net/uid/14528823/list/1.html?cid=189394

  6. Linux Block模块之deadline调度算法代码解析

    1 总体说明 Deadline调度器对一个请求的多方面特性进行权衡来进行调度,以期望既能满足块设备扇区的顺序访问又能兼顾到一个请求不会在队列中等待太久导致饿死.Deadline调度器为了兼顾这两个方面 ...

  7. Linux Block模块之IO合并代码解析

    1 IO路径 从内核角度看,进程产生的IO路径主要有三条: 缓存IO:系统绝大部分IO走的这种形式,充分利用文件系统层的page cache所带来的优势.应用程序产生的IO经系统调用落入page ca ...

  8. 转 -Linux 自检和 SystemTap (强大的内核调试工具)---包含下载地址

    下载: http://www.oschina.net/p/systemtap/ https://sourceware.org/systemtap/ftp/releases/   Linux 自检和 S ...

  9. Linux基础命令(四)

    作业一:1) 开启Linux系统前添加一块大小为15G的SCSI硬盘 [root@bogon ~]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 byte ...

随机推荐

  1. OR 连接查询注意

    用or 查询时, 取得是 每个or中条件的 查询的结果集union. select * from categorysecond t where ISNULL(null); ort.csid in (' ...

  2. python类型学习

    python类型学习 标准类型 数字 Integer 整型 Boolean 布尔型 Long integer 长整型 Floating point real numer  浮点型 Complex nu ...

  3. VMware虚拟机的三种联网方法及原理(转)

    转自:http://blog.chinaunix.net/uid-24876683-id-3593774.html 一.Brigde——桥接 :默认使用VMnet0 .原理: Bridge 桥&quo ...

  4. #CSS 文本溢出部分显示省略号

    单行结尾溢出: 用text-overflow:ellipsis属性实现,当然还需要加宽度width属来兼容部分浏览. width:300px;overflow: hidden; text-overfl ...

  5. Web Api之Cors跨域以及其他跨域方式(三)

    我们知道ajax不能跨域访问,但是有时我们确实需要跨域访问获取数据,所以JSONP就此诞生了,其本质使用的是Script标签,除JSONP以外还有另外实现跨域方式 一.手动实现JSONP跨域 1.首先 ...

  6. git推送本地仓库到github

    总结一下,方便后人,也方便自己查阅.直接写步骤 一.本地创建一个文件夹,在里面写项目的文件(* .php/*.js.....). git本地操作: 1 .  cd  /path/to/project  ...

  7. Ruby windows7安装配置(最新版本)

    1.下载最新版本的rubyinstaller并安装http://rubyinstaller.org/downloads/ 如下图所示设置路径,我安装时将所有选项都打够了,免除了后面需要什么配置麻烦. ...

  8. HTML Input 表单校验之datatype

    凡要验证格式的元素均需绑定datatype属性,datatype可选值内置有10类,用来指定不同的验证格式. 如果还不能满足您的验证需求,可以传入自定义datatype,自定义datatype是一个非 ...

  9. UVALive - 6912 Prime Switch (状压DP)

    题目链接:传送门 [题意]有n个灯,m个开关,灯的编号从1~n,每个开关上有一个质数,这个开关同时控制编号为这个质数的倍数的灯,问最多有多少灯打开. [分析]发现小于根号1000的质数有10个左右,然 ...

  10. load Properties

    /* */ public static final Properties loadProperties(String propertyFileRelativePath) /* */ { /* 67 * ...