Move to kernel style SPDX license identifiers
[lttng-ust.git] / doc / examples / demo-tracef / demo-tracef.c
1 /*
2 * SPDX-License-Identifier: LGPL-2.1-only
3 *
4 * Copyright (C) 2009 Pierre-Marc Fournier
5 * Copyright (C) 2011-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 */
7
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <unistd.h>
11
12 #include <lttng/tracef.h>
13
14 int main(int argc, char **argv)
15 {
16 int i;
17 int delay = 0;
18 const char *str = "mystring test";
19 long l = 0x42;
20
21 if (argc == 2)
22 delay = atoi(argv[1]);
23
24 fprintf(stderr, "Demo program starting.\n");
25
26 sleep(delay);
27
28 fprintf(stderr, "Tracing... ");
29 for (i = 0; i < 5; i++) {
30 tracef("This is a \"%s\" formatted %d event %lx",
31 str, i, l);
32 }
33 fprintf(stderr, " done.\n");
34 return 0;
35 }
This page took 0.029202 seconds and 4 git commands to generate.