c26a2a9ed0cbd35d10c5be6f14d5c28bf1ee1ae1
[deliverable/barectf.git] / doc / examples / barectf-tracepoint / README.md
1 # Example using `barectf-tracepoint.h`
2
3 This example is based on the [linux-fs-simple example](../linux-fs-simple),
4 but it uses the `tracepoint()` macro defined in
5 [`barectf-tracepoint.h`](../../../extra/barectf-tracepoint.h) instead of
6 calling the generated tracing functions directly.
7
8 This example also shows the compatibility with
9 [LTTng-UST](http://lttng.org/) that this `barectf-tracepoint.h` allows.
10
11
12 ## Building
13
14 To build both barectf and LTTng-UST targets, make sure both tools are
15 installed, and do:
16
17 make
18
19 To build only the example using barectf:
20
21 make -f Makefile.barectf
22
23 To build only the example using LTTng-UST:
24
25 make -f Makefile.lttng-ust
26
27
28 ## barectf tracing
29
30 Run this example:
31
32 ./barectf-tracepoint-barectf
33
34 The complete CTF trace is written to the `ctf` directory.
35
36 You may run the example with any arguments; they will be recorded,
37 as string fields in the events of the binary stream, e.g.:
38
39 ./barectf-tracepoint-barectf this argument and this one will be recorded
40
41
42 ## LTTng-UST tracing
43
44 Create an LTTng tracing session:
45
46 lttng create my-session
47
48 Enable the events of this example:
49
50 lttng enable-event --userspace 'barectf_tp:*'
51
52 Start tracing:
53
54 lttng start
55
56 Run this example:
57
58 ./barectf-tracepoint-lttng-ust
59
60 You may run the example with any arguments; they will be recorded,
61 as string fields in the events of the binary stream, e.g.:
62
63 ./barectf-tracepoint-lttng-ust this argument and this one will be recorded
64
65 Stop tracing and inspect the recorded events:
66
67 lttng stop
68 lttng view
This page took 0.031323 seconds and 3 git commands to generate.