[lttng-dev] LTTng ring buffer library.

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Sun Nov 15 10:57:29 EST 2015


----- On Nov 6, 2015, at 4:09 PM, Mike <melon.aerial at gmail.com> wrote: 

> Hello.
> I'd like to use your library for ring buffers between kernel and userspace. I'd
> found that this library is in lttng-modules repo on github. But i haven't found
> any examples of codes in docs. I just want to use this libray. Have u got some
> easy example of using it or maybe u can say what files in repo ot watch to
> faster understand how it works?

Hi Mike, 

I'll reply to your private email questions below the lttng-dev thread, since there 
appears to be more questions than initially posted in the lttng-dev email. 

----- On Nov 13, 2015, at 10:05 AM, Mike <melon.aerial at gmail.com> wrote: 

> Hello.
> I've tried to send to mail-list. but i haven't received any answer.

We've been busy with a workshop last week, hence the delayed answers. 

> So you are the mainterner of github repo, that' why i'm writing you. So the
> first question about documentation about "Generic Ring Buffer Library". I've
> been searching internet and haven't found it.

The generic ring buffer library was initially created as a library (modules) 
for the Linux kernel. Its github repo can be found here: 
https://github.com/compudj/linux-libringbuffer/commits/tip-current-ringbuffer-0.240 

However, it's not actively maintained, and the updated libringbuffer code for 
the Linux kernel now sits in lttng-modules under /lib/. There are a few commits 
of lib ring buffer clients examples that were never integrated from the ringbuffer 
github repo to lttng-modules though. 

> Also i've seen code on github, understand it a little bit. But i haven't found
> and client code there, only kernel one.

The lib ring buffer "client" code is actually a in-kernel "client" of the library. 
A ring buffer "client" selects a ring buffer configuration, and chooses the 
data layout in the ring buffer. It also implements the userspace-visible interfaces 
to read from the ring buffer. 

> i'd like to use library for interaction from kernel-space to user-space. Is it
> for it?

No. The in-kernel library has in-kernel clients, and interfaces to read the buffer 
content from user-space, but user-space cannot write into the kernel buffers. 

I also did a port of libringbuffer from lttng-modules into lttng-ust, the lttng 
user-space tracer. However, this is only for writing into the buffer from 
user-space, not from the kernel. Reading the buffers is done by a user-space 
consumer daemon. 

> Or i've unserstood something wrong maybe. Also another question about LTTng.
> I've seen that is a big framework, but i'm only need to trace system calls. Can
> i use it with tracing only system calls?

Yes, you can use it to trace only syscalls. You will need lttng-tools 
and lttng-modules, and do 

(as root) 
lttng-sessiond -d 

(as root or user part of the tracing group) 
lttng create 
lttng enable-event --syscall '*' 
lttng start 
[....] 
lttng stop 
lttng view 

more details at http://lttng.org/docs 

You can replace '*' with e.g. 'open' or 'op*'. The wildcard needs to be 
at the end of the string. 

> And if i can, where it is usually save logs? Have it got any parameters for that
> or maybe u can say where i can find it it code, cause it will really help me.

$HOME/lttng-traces/ 

It can be changed by passing parameters to lttng create. See manpages or website doc. 
Thanks, 

Mathieu 

-- 
Mathieu Desnoyers 
EfficiOS Inc. 
http://www.efficios.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20151115/58e20f03/attachment.html>


More information about the lttng-dev mailing list