[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] Fast stack trace utility for Linux
From: |
Vladimir Nikulichev |
Subject: |
[Libunwind-devel] Fast stack trace utility for Linux |
Date: |
Wed, 24 Sep 2014 18:20:58 +0400 |
Hi,
I would like to announce tbstack, a fast stack trace utility for Linux on
x86_64. It is designed to minimize time the process is being frozen. During that
time it only copies general-purpose registers and stack contents of threads.
Then the data is processed with libunwind remote interface. This approach
was inspired by samples processing in perf tool. Libunwind-ptrace is also
supported as a flavor.
More details from README:
At first it examines process' memory layout reading /proc/pid/maps. When the
process is frozen (PTRACE_ATTACH to the main thread + SIGSTOP to start freezing
other threads) it copies all threads' general-purpose registers and contents of
stack from %rsp to end of memory region or up to maximum stack size if specified
with --stack-size argument. System call proc_vm_readv is used on kernels from
version 3.2, on older kernels data is read from /proc/pid/mem. The process
continues execution. The collected data is enough to trace stacks. It is
arranged in structures snapshot and mem_map and can be accessed through callback
routines passed to libunwind by unw_create_addr_space.
Example summary, a process with 35 threads in idle state executed on server
with Intel Xeon E5-2690, 128G of memory:
Flavor | freeze time | copied data |
----------------------------------------------
default | 2ms 333us | 448K |
libunwind-ptrace | 431ms 19us | - |
Project page on github: http://github.com/tbricks/tbstack
Vladimir
- [Libunwind-devel] Fast stack trace utility for Linux,
Vladimir Nikulichev <=