tests: Move to kernel style SPDX license identifiers
[lttng-tools.git] / tests / regression / tools / filtering / gen-ust-events.c
1 /*
2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #include <arpa/inet.h>
9 #include <stdarg.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <sys/mman.h>
14 #include <sys/stat.h>
15 #include <sys/types.h>
16 #include <unistd.h>
17
18 #define TRACEPOINT_DEFINE
19 #include "tp.h"
20
21 int main(int argc, char **argv)
22 {
23 int i, netint;
24 long values[] = { 1, 2, 3 };
25 uint32_t net_values[] = { 1, 2, 3 };
26 char text[10] = "test";
27 char escape[10] = "\\*";
28 double dbl = 2.0;
29 float flt = 2222.0;
30 /* Generate 30 events. */
31 unsigned int nr_iter = 100;
32 useconds_t nr_usec = 0;
33
34 if (argc >= 2) {
35 nr_iter = atoi(argv[1]);
36 }
37
38 if (argc == 3) {
39 /* By default, don't wait unless user specifies. */
40 nr_usec = atoi(argv[2]);
41 }
42
43 for (i = 0; i < 3; i++) {
44 net_values[i] = htonl(net_values[i]);
45 }
46
47 for (i = 0; i < nr_iter; i++) {
48 netint = htonl(i);
49 tracepoint(tp, tptest, i, netint, values, text, strlen(text), escape, dbl, flt,
50 net_values);
51 usleep(nr_usec);
52 }
53
54 return 0;
55 }
This page took 0.030717 seconds and 5 git commands to generate.