没有合适的资源?快使用搜索试试~ 我知道了~
首页Linux Kernel GCOV - tool analysis
资源详情
资源评论
资源推荐
Linux Kernel GCOV - tool analysis
Nicholas Mc Guire
Distributed & Embedded Systems Lab
SISE,Lanzhou University, Lanzhou,P.R.China
mcguire@lzu.edu.cn, http://dslab.lzu.edu.cn
February 8, 2006
i
Contents
Contents
1. Kernel gcov support - tool analysis 1
1.1. Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2. patch file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3. Patch analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4. Architecture dependent changes . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5. Architecture support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6. Basic technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6.1. -fprofile-arcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.6.2. -ftest-coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7. Building for 2.4.X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.7.1. patch the kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.7.2. patch the modultils . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.8. building for 2.6.X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.8.1. Applying the Patch . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.9. Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.9.1. Update Lilo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.9.2. Update GRUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.10. Runtime Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.11. Data acquisition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.11.1. File content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.12. Extracting profiling data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.13. Checking Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.14. Kernel Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.14.1. X86 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.15. encountered problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.16. Performance Impact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.17. RT-performance impact . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.18. General Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.18.1. Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.18.2. License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.18.3. Patch status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.18.4. Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.19. Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2. List of Acronyms 22
ii
Contents
Version Author Date Comment
1.0 Nicholas Mc
Guire
Jan 2005 First shot
1.1 Georg Schiesser 18 Jan 2005 converted to TEX
document
1.2 Nicholas Mc
Guire
Jan 2006 2.6 revision
This gcov intoduction/manual is released under FDL V1.2 [1]. All software used for this
session is available under GPL V2 license [2].
iii
1. Kernel gcov support - tool analysis
1. Kernel gcov support - t ool analysis
In the framework of Work Package 5 - Boot-Time Optimization, of ”A Compara-
tive Study on Real-time enhanced Linux Variants” conducted for Siemens CT SE2,
Muenchen, research on existing tools to analize boot-times was performed. In this arti-
cle, derived from analysis notes, we describe the tools basics and usage. The intention of
this article is to provide practical guidance for engeneers using these tools and provide
concept basics so that thes free-software tools are no long black-boxes. For a general
introduction to runtime debugging in embedded systems we refere you to [6].
As one of the well known tools for user-space applications extending gcov into kernel
space seems like a quite natural thing to do. In this article we describe the tools analysis,
gcov usage, and data acquisition for the 2.4.25 and 2.6.14 kernel.
A brief introduction to the core technology concept and its application in user-space
process and libraries is given.
Feedback to mcguire@lzu.edu.cn is always appreciated. The latest version of this
document is available at http://dslab.lzu.edu.cn.
This manual assumes a default installation of Slackware [3] 10.0 or 10.1 - though it
should apply to more or less any current distribution.
1.1. Source
lcov-1.4.tar.gz (not strictly required) http://sourceforge.net/projects/ltp ->
gcov-2.6.X.patch.gz
note that some patches use the naming scheme linux-2.6.X-gcov.patch.gz.
dependencies: none
1.2. patch file
• /drivers/gcov/gcov-core.c:
The gcov core functions for initializing logging of code coverage data
• /drivers/gcov/gcov-proc.c:
The proc interface built under /proc/gcov
• /include/linux/gcov.h:
GCOV related macros and function prototypes, the struct bb is declared here -
highly gcc version dependent.
1
1. Kernel gcov support - tool analysis
Due to this being quite compiler dependent gcov-core.c is a bit of a mess, basically it is
the same function set for three different compiler versions, ifdef’ed .
Note that the actual instrumentation is done by gcc’s -fprofile-arcs and -ftest-coverage
flags, the kernel patch only needs to make the data accessible (you actually can com-
pile a kernel with CFLAGS KERNEL=-fprofile-arcs -ftest-coverage eve n without the
patch applied, it would only fail in the linking stage with an unresolved symbol to
bb init func - that is exactly what gcov-core provides.
1.3. Patch analysis
The gcov interface is cleanly encapsulated in /driver/gcov - this code is not really
architecture dep endent. All gcov related parts are cleanly ifdef’ed in the code so turning
off gcov support leaves no side effects.
The main changes of the patch are in the configuration (Kconfig for 2.6.X) and in the
Makefiles - the patch is not very invasive at code level (though it does off course change
the runtime behavior of every function).
Fundamentally gcov-core.c is based on a doubly linked list of struct bb (basic blocks)
in which all data is collected - see include/linux/gcov.h for details on struct bb.
One such list is initialized for each module. This is also one source of the performance
penalty as these lists can become quite large and thus increase the cache misses.
1.4. Architecture dependent changes
The only really architecture specific issue is the sections added for the constructor and
destructor functions. Though this is not really that arch dependent, but can’t be placed
in any arch independent file.
/arch/i386/kernel/head.S
.section ".ctors","aw"
.globl __CTOR_LIST__
.type __CTOR_LIST__,@object
__CTOR_LIST__:
.section ".dtors","aw"
.globl __DTOR_LIST__
.type __DTOR_LIST__,@object
__DTOR_LIST__:
2
剩余25页未读,继续阅读
leopard_ray
- 粉丝: 84
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
- MW全能培训汽轮机调节保安系统PPT教学课件.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论4