tests: Move to kernel style SPDX license identifiers
[lttng-tools.git] / tests / regression / ust / overlap / demo / 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 #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
23 #include "ust_tests_demo.h"
24 #include "ust_tests_demo2.h"
25 #include "ust_tests_demo3.h"
26
27 int main(int argc, char **argv)
28 {
29 int i, netint;
30 long values[] = { 1, 2, 3 };
31 char text[10] = "test";
32 double dbl = 2.0;
33 float flt = 2222.0;
34 int delay = 0;
35
36 if (argc == 2)
37 delay = atoi(argv[1]);
38
39 fprintf(stderr, "Demo program starting.\n");
40
41 sleep(delay);
42
43 fprintf(stderr, "Tracing... ");
44 tracepoint(ust_tests_demo, starting, 123);
45 for (i = 0; i < 5; i++) {
46 netint = htonl(i);
47 tracepoint(ust_tests_demo2, loop, i, netint, values,
48 text, strlen(text), dbl, flt);
49 }
50 tracepoint(ust_tests_demo, done, 456);
51 tracepoint(ust_tests_demo3, done, 42);
52 fprintf(stderr, " done.\n");
53 return 0;
54 }
This page took 0.030225 seconds and 5 git commands to generate.