Re: bpftrace ustack() pid packing
Daniel Xu
Thanks Brendan, that makes sense.
toggle quoted messageShow quoted text
Here's an example that can trigger the fork issue: $ cat ustack_fork_dup.cpp #include <iostream> #include <unistd.h> #include <stdio.h> __attribute__((noinline)) void do_sleep() { ::usleep(500000); } __attribute__((noinline)) void pathAAAA() { do_sleep(); } __attribute__((noinline)) void pathAAA() { pathAAAA(); } __attribute__((noinline)) void pathAA() { pathAAA(); } __attribute__((noinline)) void pathA() { pathAA(); } int main() { ::fork(); while (1) { pathA(); } } $ sudo ./build/src/bpftrace -e 'uprobe:/lib64/libc.so.6:usleep /comm == "a.out"/ { @[ustack(2)] = count() }' Attaching 1 probe... ^C @[ usleep+0 pathAAAA()+9 ]: 16 @[ usleep+0 pathAAAA()+9 ]: 16 The user would expect only a single entry in the map. Daniel
On Tue, May 28, 2019, at 1:01 PM, Brendan Gregg wrote:
On Tue, May 28, 2019 at 11:35 AM Daniel Xu <dxu@...> wrote:
|
|