[lttng-dev] [RFC] perf sampling library for LTTng-UST

Staffan Tjernstrom staffan at eternaltraveller.com
Thu Nov 17 16:14:27 UTC 2016

Whilst I'm not competent to comment on the implementation, I really
like the functionality - it's going to be a life-saver for me.

The need to sample perf counters from user space programs is huge in
my world.
> Hello!
> I did a small shared library for profiling code using perf sampling
> and LTTng-UST:
>   https://github.com/giraldeau/lttng-ust/tree/sampling/liblttng-ust-sampling
> It works by preloading the library when executing a program. Inside
> the library constructor, a perf counter is created and samples are
> saved inside the SIGIO handler using an LTTng-UST tracepoint. The call
> stack is obtained using libunwind, and thus it works even without
> frame pointers and with unmodified executables.
> Preliminary overhead measure with the default sampling period of 1E4
> for cpu cycles is about 8.5%, or 2.2us per event. On my machine, about
> 38k samples per second are generated. This figure is obtained when
> compiling libunwind without signal re-entrance support.
> Genevieve Bastien did a nice view in TraceCompass to load this trace
> and display the corresponding call graph view.
>   http://secretaire.dorsal.polymtl.ca/~gbastien/screenshots/lttng_sampling_callstack.png
> The counter is hard coded now, but it's just a prototype to
> demonstrate the concept. I would find it very cool to see such feature
> in LTTng. What do you think?
> Cheers,
> Francis
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

More information about the lttng-dev mailing list