[lttng-dev] make a trace_event in a module (driver)
Francis Giraldeau
francis.giraldeau at gmail.com
Wed Dec 18 11:27:01 EST 2013
Le 2013-12-16 13:35, Klaus Dannecker a écrit :
> Hi Francis,
>
> sample.h -> ../instumentation/events/lttng-modul
> lttng-trace-events-sample.c -> ../addons/
> and two various example
> trace-events-sample.c ; trace-events-sample.h
> trace-events-sample1.c with the
> the examples are stored in the folder ../addons/
>
> in the make-File i add
> obj-m += lttng-trace-events-sample.o
> obj-m += trace-events-sample.o
> obj-m += trace-events-sample1.o
>
> where is the error?
> what sample is the best?
> can i use the same trace-event in all sample?
First, there were two definition with the same name, that is you may
end-up enabling one, but calling the other. It's better to use unique
names.
Also, the module lttng-modsign must be loaded first, otherwise the
tracepoint won't generate data.
It's better to put the probe code in it's own module.
You should put '\n' at the end of printk() (and printf() in general) to
force a flush, otherwise the string accumulates, and is flushed later.
I did put your code into addons-klaus branch on github. Grab the source,
then:
make
sudo make modules_install
sudo depmod -a
sudo lttng-sessiond -v
// make sure normal modules are loaded
cd addons
./control-addons.sh load
// make sure sample modules are loaded
// verify that event-sample thread is running (pgrep -l event-sample)
lttng create
lttng enable-event -k foo1_bar
lttng start
// check dmesg for event-sample output
lttng stop
lttng view
I tested it and it worked for me.
https://github.com/giraldeau/lttng-modules/tree/addons-klaus
Cheers,
Francis
More information about the lttng-dev
mailing list