systemtap

SystemTap script to profile latency of functions

。_饼干妹妹 提交于 2019-12-07 22:32:40
问题 My goal is to profile the execution time of each function in a kernel module. Using the sample scripts I saw online, I came up with the following script to fulfill my need. But occasionally I get negative values for calculated latencies. Although, they happen rarely but I guess that indicates something is wrong with my script. Can anyone help me with that please? probe module(@1).function(@2).call { begin = gettimeofday_ns() } probe module(@1).function(@2).return { if (begin>0) stats <<<

Linux 自检和 SystemTap

杀马特。学长 韩版系。学妹 提交于 2019-12-06 12:35:04
Linux 自检和 SystemTap 11/20. 2013 用于动态内核分析的接口和语言 现代的操作系统内核提供 自检 功能,即动态地检查内核以理解其行为的能力。这些行为可以反映内核问题和性能瓶颈。拥有这些信息时候,您就可以调优或修改内核以避免出现故障。本文探索一个名为 SystemTap 的开放源码基础设施,它为 Linux® 内核提供这种动态的自检。 SystemTap 是监控和跟踪运行中的 Linux 内核的操作的动态方法。这句话的关键词是 动态 ,因为 SystemTap 没有使用工具构建一个特殊的内核,而是允许您在运行时动态地安装该工具。它通过一个名为 Kprobes 的应用编程接口(API)来实现该目的,本文将探索这个 API。我们首先了解以前的一些内核跟踪方法,然后在深入探讨 SystemTap 的架构及其使用。 内核跟踪 SystemTap 与一种名为 DTrace 的老技术相似,该技术源于 Sun Solaris 操作系统。在 DTrace 中,开发人员可以用 D 编程语言(C 语言的子集,但修改为支持跟踪行为)编写脚本。DTrace 脚本包含许多探针和相关联的操作,这些操作在探针 “触发” 时发生。例如,探针可以表示简单的系统调用,也可以表示更加复杂的交互,比如执行特定的代码行。清单 1 显示了 DTrace 脚本的一个简单例子

Profiling for wall-time on Linux

人走茶凉 提交于 2019-12-04 03:05:12
I have an application that I want to profile wrt how much time is spent in various activities. Since this application is I/O intensive, I want to get a report that will summarize how much time is spent in every library/system call (wall time). I've tried oprofile, but it seems it gives time in terms of Unhalted CPU cycles (thats cputime, not real time) I've tried strace -T, which gives wall time, but the data generated is huge and getting the summary report is difficult (and awk/py scripts exist for this ?) Now I'm looking upto SystemTap, but I don't find any script that is close enough and

openresty 火焰图收集

北慕城南 提交于 2019-12-02 18:28:01
工具安装 查看内核及kernel 注:本次安装以下都是基于centos6的 uname -a ; rpm -qa kernel\* | sort kernel,kernel-devel,kernel-debuginfo,kernel-debuginfo-common(先安装kernel-debuginfo-common,在安装 kernel-debuginfo) 这些版本一定要和内核版本保持一致 相关rpm包下载: http://rpm.pbone.net (kernel,kernel-devel), http://debuginfo.centos.org (kernel-debuginfo,kernel-debuginfo-common)对应搜索下载rpm安装,版本一定要对应,不然会报一些内核错。 安装systemtap yum install systemtap 测试安装是否成功: stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}' 安装成功: 出现下面的情况,是kernel-devel不匹配导致的 kernel-debug 版本不匹配 下载stapxx、FlameGraph、openresty-systemtap-toolkit https://github.com/openresty

See socket options on existing sockets created by other apps?

守給你的承諾、 提交于 2019-11-29 08:09:35
I'd like to test whether particular socket options have been set on an existing socket. Ie, pretty much everything you can see in: #!/usr/bin/env python '''See possible TCP socket options''' import socket sockettypelist = [x for x in dir(socket) if x.startswith('SO_')] sockettypelist.sort() for sockettype in sockettypelist: print sockettype Anyone know how I can see the options on existing sockets, ie those created by other processes? Alas nearly all the documentation I read on Python socket programming is about making new sockets. Unfortunately, nailer's answer only catches the SOL_TCP level

See socket options on existing sockets created by other apps?

旧城冷巷雨未停 提交于 2019-11-28 01:43:37
问题 I'd like to test whether particular socket options have been set on an existing socket. Ie, pretty much everything you can see in: #!/usr/bin/env python '''See possible TCP socket options''' import socket sockettypelist = [x for x in dir(socket) if x.startswith('SO_')] sockettypelist.sort() for sockettype in sockettypelist: print sockettype Anyone know how I can see the options on existing sockets, ie those created by other processes? Alas nearly all the documentation I read on Python socket

内核调试 SystemTap【转载】

倖福魔咒の 提交于 2019-11-26 18:35:35
原文: http://www.cnblogs.com/wangkangluo1/archive/2012/06/26/2562971.html 相关技术:utrace, probe, ftrace, dtrace, pstrace centos安装systemtap 使用实例 参考 原文连接 参考连接 重点是需要内核的匹配 1.首先先查看你的内核版本 uname -a 2.6.18-194.el5 如果你的内核版本比较老的话,你需要去查找你需要的kernel-devel 的版本. 如果你想用yum去安装,你可以用 yum install kernel-devel 注意:在最新的yum里面安装的总是最新的kernel-devel的版本,kernel-devel 需要匹配内核版本 比如: CentOS release 5.5 (Final)用的是内核版本 2.6.18-194.el5 先下载 和内核版本一样的对应的 然后安装 rpm-ivh kernel-devel-2.6.18-194.el5-i686.rpm 安装好kernel-devel会有内核的目录在 /usr/src/kernels/2.6.18-194.el5-i686/ 2.安装systemtap yum install systemtap ( stap -V 1.3/0.137 请安装elfutils-devel