add ppc atomic
[lttv.git] / ltt-usertrace / sample-printf.c
CommitLineData
e36efdc5 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>
987daa89 9// Notice the inclusion of ltt-facility-custom-user_generic.h for the
10// slow_printf support
e36efdc5 11
12
13int main(int argc, char **argv)
14{
15 printf("Will trace a printf of an incrementing counter.\n");
141274aa 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");
987daa89 19
e36efdc5 20 unsigned int count = 0;
21
22 while(1) {
15146922 23 trace_user_generic_slow_printf("in: %s at: %s:%d: Counter value is: %u.",
24 __FILE__, __func__, __LINE__, count);
e36efdc5 25 count++;
26 sleep(1);
27 }
28
29 return 0;
30}
31
This page took 0.029302 seconds and 4 git commands to generate.