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 源代码

也可进行实时调试