Skip to content

xfiretrace/systemtap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

systemtap-container

Enhanced version of systemtap to support container environments. This means that you can use the systemtap command to trace and analyze a container's pid if it is obtained on the host. Compatible with all future systemtap features, seamless migration.

Feature

  • Extended support for container environments allows you to trace a container's pid on the host machine.
  • Adapted stapxx and openresty-systemtap-toolkit.

Install

From source code

  • Get source code
git clone https://github.com/xfiretrace/systemtap.git
cd systemtap
  • Installation command dependencies
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list && apt update
apt-get build-dep systemtap 
  • Compiling
./configure --prefix=/usr
make && make install

Install the kernel debuginfo dependency

For different versions of ubuntu, get the corresponding kernel version at https://wiki.ubuntu.com/Debug%20Symbol%20Packages.

apt-get install linux-image-$(uname -r)-dbgsym

Get start with systemtap-container

Compatible with all current systemtap operations, see https://github.com/xfiretrace/stapxx.

Example

  • You can trace processes like this
    stap -e 'probe process("/proc/{PID}/root/exec_path").function("*"){println("hello world")}'
  • Or Run with the script which stap++
    stap++ -e 'probe begin { println("hello world") exit() }'

Q & A

How does it work

  • We extended systemtap so that it can trace processes using /proc/{PID}/root/exec_path by improving the Uprobe inode and matching exec_path

You can only use stap like this

    probe process("/proc/{PID}/root/exec_path").function("*")

Also, use stapxx which we adapt stap++ with container

root       11807   11438  0 Jun14 ?        00:00:01 nginx: master process /usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf
nobody     12956   11807  0 Jun14 ?        03:38:57 nginx: worker process

./stap++ -I ./tapset -x 12956  ./samples/ngx-rps.sxx --dump-src
#!/usr/bin/env stap

# Print out the current number of requests per second in the Nginx worker
# process specified at real time.

global count

probe process("/proc/12956/root/usr/local/openresty/nginx/sbin/nginx").function("ngx_http_log_request")
{
    if (pid() == target() && $r == $r->main) {
        count++
    }
}

probe timer.s(1) 
{
    printf("[%d] %d req/sec\n", gettimeofday_s(), count)
    count = 0
}

probe begin 
{
    warn(sprintf("Tracing process %d (/proc/12956/root/usr/local/openresty/nginx/sbin/nginx).\nHit Ctrl-C to end.\n", target()))
}

Change log

See release https://github.com/xfiretrace/systemtap/release

About

No description, website, or topics provided.

Resources

License

AGPL-3.0, GPL-2.0 licenses found

Licenses found

AGPL-3.0
LICENSE
GPL-2.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published