[lttng-dev] make a trace_event in a module (driver)

Klaus Dannecker klaus.dannecker at gmx.de
Thu Dec 19 10:42:25 EST 2013


Am 18.12.2013 17:27, schrieb Francis Giraldeau:
> 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
ok, so i downloadet the 
https://github.com/giraldeau/lttng-modules/tree/addons-klaus
but i can't compile this.
klaus at ubuntu:~/lttng_src/lttng-modules-addons-klaus$ make
..
   CC [M] 
/home/klaus/lttng_src/lttng-modules-addons-klaus/probes/lttng-probe-user.o
   CC [M] 
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-context-perf-counters.o
   LD [M] /home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-tracer.o
   MD5SUM /home/klaus/lttng_src/lttng-modules-addons-klaus/.System.map.md5
md5sum: /boot/System.map-3.8.0-29-generic: Permission denied
make[2]: *** 
[/home/klaus/lttng_src/lttng-modules-addons-klaus/.System.map.md5] Error 1
make[1]: *** [_module_/home/klaus/lttng_src/lttng-modules-addons-klaus] 
Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-29-generic'
make: *** [default] Error 2
klaus at ubuntu:~/lttng_src/lttng-modules-addons-klaus$

when i use sudo make, i become another error:
make -C /lib/modules/3.8.0-29-generic/build 
M=/home/klaus/lttng_src/lttng-modules-addons-klaus modules
make[1]: Entering directory `/usr/src/linux-headers-3.8.0-29-generic'
   AS [M] 
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.o
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.o: 
Assembler messages:
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.o: 
Warning: end of file in comment; newline inserted
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.o:1: 
Error: junk at end of line, first unrecognized character valued 0x7f
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.o:1: 
Error: junk at end of line, first unrecognized character valued 0x1
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.o:1: 
Error: junk at end of line, first unrecognized character valued 0x3
...
/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.S:13: 
Error: file not found: signing_key.x509
make[2]: *** 
[/home/klaus/lttng_src/lttng-modules-addons-klaus/lttng-certificate.o] 
Error 1
make[1]: *** [_module_/home/klaus/lttng_src/lttng-modules-addons-klaus] 
Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.8.0-29-generic'
make: *** [default] Error 2

but the File signing_key.x509 exist!

I'm so sorry that I always get errors!

Cheers,
Klaus
> Cheers,
>
> Francis
>




More information about the lttng-dev mailing list