环境:
宿主机版本
[root@85-aliyun-core]# uname -r
3.10.0-514.26.2.el7.x86_64
[root@85-aliyun-core]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.5.1804 (Core)
Release: 7.5.1804
Codename: Core
[root@85-aliyun-core]#
docker kernel信息:
[root@85-132-83-aliyun-core util]# uname -r
3.10.0-514.26.2.el7.x86_64
[root@85-132-83-aliyun-core util]# lsb_release
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
[root@85-132-83-aliyun-core util]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.5.1804 (Core)
Release: 7.5.1804
Codename: Core
docker 安装的rpm
[root@85-132-83-aliyun-core util]# rpm -qa | fgrep -i -e kernel | sort
kernel-3.10.0-514.26.2.el7.x86_64
kernel-debug-devel-3.10.0-514.26.2.el7.x86_64
kernel-debuginfo-3.10.0-514.26.2.el7.x86_64
kernel-debuginfo-common-x86_64-3.10.0-514.26.2.el7.x86_64
kernel-devel-3.10.0-514.26.2.el7.x86_64
kernel-headers-3.10.0-514.26.2.el7.x86_64
kernel-tools-3.10.0-514.26.2.el7.x86_64
kernel-tools-debuginfo-3.10.0-514.26.2.el7.x86_64
kernel-tools-libs-3.10.0-514.26.2.el7.x86_64
[root@85-132-83-aliyun-core util]#
1.启动docker --使用--pid=host --privileged 参数
docker run -it --name flamegraph --net=host --pid=host --privileged -v /lib/modules/3.10.0-514.26.2.el7.x86_64:/lib/modules/3.10.0-514.26.2.el7.x86_64 -v /data1/RUF_video_recom:/home -d centos7-ruf-flamegraph:v2
2.查看systemtap安装执行
[root@85aliyun-core systemtap]# stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'
Pass 1: parsed user script and 471 library scripts using 137320virt/41268res/3444shr/37864data kb, in 370usr/30sys/399real ms.
WARNING: cannot find module nfs debuginfo: No DWARF information found [man warning::debuginfo]
WARNING: cannot find module sunrpc debuginfo: No DWARF information found [man warning::debuginfo]
WARNING: cannot find module nfs debuginfo: No DWARF information found [man warning::debuginfo]
Pass 2: analyzed script: 1 probe, 1 function, 7 embeds, 0 globals using 268616virt/173448res/6420shr/167060data kb, in 2580usr/770sys/6016real ms.
Pass 3: translated to C into "/tmp/stapyrnOvH/stap_cdfdd457c52f576127197101d57e23cf_2721_src.c" using 268616virt/173688res/6660shr/167060data kb, in 10usr/0sys/6real ms.
Pass 4: compiled C into "stap_cdfdd457c52f576127197101d57e23cf_2721.ko" in 8750usr/2090sys/11239real ms.
Pass 5: starting run.
read performed
Pass 5: run completed in 10usr/60sys/427real ms.
执行成功
3. 抓取pid:报错
./ngx-sample-lua-bt -p 16139 --luajit20 -t 10
WARNING: Tracing 16140 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16153 16154 16155 16156 16157 (/usr/local/openresty/nginx/sbin/nginx) for LuaJIT 2.0...
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/nginx/sbin/nginx" byte 0 (0x75 vs 0x94) address 0x400284 rc 0
WARNING: task_finder inode-uprobes callback for task 17106 failed: 1
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/nginx/sbin/nginx" byte 0 (0x75 vs 0x94) address 0x400284 rc 0
WARNING: task_finder inode-uprobes callback for task 17110 failed: 1
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/nginx/sbin/nginx" byte 0 (0x75 vs 0x94) address 0x400284 rc 0
WARNING: task_finder inode-uprobes callback for task 17116 failed: 1
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0" byte 0 (0xc2 vs 0x08) address 0x7f1576bb0210 rc 0
WARNING: task_finder mmap inode-uprobes callback for task 17110 failed: 1
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0" byte 0 (0xc2 vs 0x08) address 0x7f1576bb0210 rc 0
WARNING: task_finder mmap inode-uprobes callback for task 17106 failed: 1
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0" byte 0 (0xc2 vs 0x08) address 0x7f1576bb0210 rc 0
WARNING: task_finder mmap inode-uprobes callback for task 17116 failed: 1
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/nginx/sbin/nginx" byte 0 (0x75 vs 0x94) address 0x400284 rc 0
WARNING: task_finder inode-uprobes callback for task 17119 failed: 1
ERROR: Build-id mismatch [man error::buildid]: "/usr/local/openresty/luajit/lib/libluajit-5.1.so.2.1.0" byte 0 (0xc2 vs 0x08) address 0x7f1576bb0210 rc 0
WARNING: task_finder mmap inode-uprobes callback for task 17119 failed: 1
WARNING: /usr/bin/staprun exited with status: 1