tests: Move to kernel style SPDX license identifiers
[lttng-tools.git] / tests / regression / ust / linking / demo.c
1 /*
2 * Copyright (C) 2009 Pierre-Marc Fournier
3 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only
6 *
7 */
8
9 #include <stdio.h>
10 #include <unistd.h>
11 #include <sys/mman.h>
12 #include <stdarg.h>
13 #include <sys/types.h>
14 #include <sys/stat.h>
15 #include <fcntl.h>
16 #include <signal.h>
17 #include <string.h>
18 #include <arpa/inet.h>
19 #include <stdlib.h>
20
21 #define TRACEPOINT_DEFINE
22
23 #if TEST_DYNAMIC_LINKAGE
24 #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
25 #endif
26
27 #include "ust_tests_demo.h"
28 #include "ust_tests_demo2.h"
29 #include "ust_tests_demo3.h"
30
31 int main(int argc, char **argv)
32 {
33 int i, netint;
34 long values[] = { 1, 2, 3 };
35 char text[10] = "test";
36 double dbl = 2.0;
37 float flt = 2222.0;
38 int delay = 0;
39
40 if (argc == 2)
41 delay = atoi(argv[1]);
42
43 fprintf(stderr, "Demo program starting.\n");
44
45 sleep(delay);
46
47 fprintf(stderr, "Tracing... ");
48 tracepoint(ust_tests_demo, starting, 123);
49 for (i = 0; i < 5; i++) {
50 netint = htonl(i);
51 tracepoint(ust_tests_demo2, loop, i, netint, values,
52 text, strlen(text), dbl, flt);
53 }
54 tracepoint(ust_tests_demo, done, 456);
55 tracepoint(ust_tests_demo3, done, 42);
56 fprintf(stderr, " done.\n");
57 return 0;
58 }
This page took 0.030293 seconds and 4 git commands to generate.