fix usertrace
[lttv.git] / ltt-usertrace / sample-printf.c
1
2 #include <stdio.h>
3 #include <unistd.h>
4
5 #define LTT_TRACE
6 #define LTT_BLOCKING 1
7 #include <ltt/ltt-facility-user_generic.h>
8 #include <ltt/ltt-facility-custom-user_generic.h>
9 // Notice the inclusion of ltt-facility-custom-user_generic.h for the
10 // slow_printf support
11
12
13 int main(int argc, char **argv)
14 {
15 printf("Will trace a printf of an incrementing counter.\n");
16 printf("Abort with CTRL-C.\n");
17 printf("No file is created with this example : it logs through a kernel\n");
18 printf("system call. See the LTTng lttctl command to start tracing.\n");
19
20 unsigned int count = 0;
21
22 while(1) {
23 trace_user_generic_slow_printf("in: %s at: %s:%d: Counter value is: %u.",
24 __FILE__, __func__, __LINE__, count);
25 count++;
26 sleep(1);
27 }
28
29 return 0;
30 }
31
This page took 0.052463 seconds and 4 git commands to generate.