LINUX block I/O --systemtap
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的更多相关文章
- linux系统分析工具续-SystemTap和火焰图(Flame Graph)
本文为网上各位大神文章的综合简单实践篇,参考文章较多,有些总结性东西,自认暂无法详细写出,建议读文中列出的参考文档,相信会受益颇多.下面开始吧(本文出自 “cclo的博客” 博客,请务必保留此出处ht ...
- Linux: Block Port With IPtables
由Internet和其他网络协议识别端口号,使计算机能够与其他人进行交互.每个Linux服务器都有一个端口号(参见/ etc / services文件) Block Incoming Port The ...
- Linux block(1k) block(4k) 换算 gb
输入 df 显示1k blocks 大小 再输入 df -h 显示 gb换算大小 结论 block(1k) 计算公式为: block(1k) /1024/1000 = xx gb ...
- 【SystemTap】 Linux下安装使用SystemTap源码安装SystemTap
转自 http://blog.csdn.net/zklth/article/details/6248558 文章 http://blog.csdn.net/zklth/archive/2010/09/ ...
- linux 内核分析+使用SystemTap调试新增内核模块
http://blog.chinaunix.net/uid/14528823/list/1.html?cid=189394
- Linux Block模块之deadline调度算法代码解析
1 总体说明 Deadline调度器对一个请求的多方面特性进行权衡来进行调度,以期望既能满足块设备扇区的顺序访问又能兼顾到一个请求不会在队列中等待太久导致饿死.Deadline调度器为了兼顾这两个方面 ...
- Linux Block模块之IO合并代码解析
1 IO路径 从内核角度看,进程产生的IO路径主要有三条: 缓存IO:系统绝大部分IO走的这种形式,充分利用文件系统层的page cache所带来的优势.应用程序产生的IO经系统调用落入page ca ...
- 转 -Linux 自检和 SystemTap (强大的内核调试工具)---包含下载地址
下载: http://www.oschina.net/p/systemtap/ https://sourceware.org/systemtap/ftp/releases/ Linux 自检和 S ...
- Linux基础命令(四)
作业一:1) 开启Linux系统前添加一块大小为15G的SCSI硬盘 [root@bogon ~]# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 byte ...
随机推荐
- #NodeJS 服务器基本模板
基本server配置 cookie / session / get数据 / post数据 / 请求方法 const express=require('express'); const static=r ...
- Adapter.notifyDataSetChanged()源码分析以及与ListView.setAdapter的区别
一直很好奇,notifyDataSetChanged究竟是重绘了整个ListView还是只重绘了被修改的那些Item,它与重新设置适配器即调用setAdapter的区别在哪里?所以特地追踪了一下源码, ...
- Asp.net Vnext TagHelpers
概述 本文已经同步到<Asp.net Vnext 系列教程 >中] TagHelpers 是vnext中引入的新功能之一.TagHelper 的作用是类似于发挥在以前版本的 ASP.NET ...
- 解析文本文件 "r" 与 "rb" 模式的区别(Python)
r,rb 那么在读文件时,有无b标识的的主要区别在哪里呢? 1.文件使用方式标识 'r':默认值,表示从文件读取数据.'b':表示要读写二进制数据 2.读文件 进行读文件操作时,直到读到文档结束符(E ...
- [翻译]Gulp.js简介
我们讨论了很多关于怎么减少页面体积,提高重网站性能的方法.有些是操作是一劳永逸的,如开启服务器的gzip压缩,使用适当的图片格式,或删除一些不必要的字符.但有一些任务是每次工作都必须反复执行的.如 新 ...
- 【BZOJ】1152: [CTSC2006]歌唱王国Singleland
题解 读错题了,是最后留下一个牛人首长歌颂他,和其他人没有关系,t就相当于数据组数 结论题,具体可看 https://www.zhihu.com/question/59895916/answer/19 ...
- bzoj 1228 [SDOI2009]E&D
sg表很好打,规律很不好找.... #include<bits/stdc++.h> #define LL long long #define fi first #define se sec ...
- Eclipse中syso 快捷键 Alt + / 不能使用的问题
通过使用windows-preferences-java-editor-templates中的快捷键,可以显著提升输入速度.快捷键的设置一般是在这里以及general下面的keys里面设置. 但是,在 ...
- Ionic Js八:头部和底部
1.ion-header-bar 这个是固定在屏幕顶部的一个头部标题栏.如果给它加上'bar-subheader' 这个样式,它就是副标题. <ion-header-bar align-titl ...
- MYSQL插入不能中文的问题的解决
这个问题是由于数据库的字符集不对的问题. 解决方法: 打开要用的数据库,输入命令 status 如果Client characterset 值为utf8,则要改为:set char set 'gbk' ...