2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
17 #include <sys/types.h>
20 #include "signal-helper.h"
22 #define TRACEPOINT_DEFINE
25 static struct option long_options
[] =
27 /* These options set a flag. */
28 {"iter", required_argument
, 0, 'i'},
29 {"wait", required_argument
, 0, 'w'},
33 int main(int argc
, char **argv
)
35 int i
, netint
, ret
= 0, option_index
, option
;
36 long values
[] = { 1, 2, 3 };
37 char text
[10] = "test";
40 unsigned int nr_iter
= 100;
41 useconds_t nr_usec
= 0;
43 while ((option
= getopt_long(argc
, argv
, "i:w:",
44 long_options
, &option_index
)) != -1) {
47 nr_iter
= atoi(optarg
);
50 nr_usec
= atoi(optarg
);
53 /* getopt_long already printed an error message. */
61 if (set_signal_handler()) {
67 for (i
= 0; i
< nr_iter
; i
++) {
69 tracepoint(tp
, tptest1
, i
, netint
, values
, text
, strlen(text
),
71 tracepoint(tp
, tptest2
, i
, netint
, values
, text
, strlen(text
),
73 tracepoint(tp
, tptest3
, i
, netint
, values
, text
, strlen(text
),
75 tracepoint(tp
, tptest4
, i
, netint
, values
, text
, strlen(text
),
77 tracepoint(tp
, tptest5
, i
, netint
, values
, text
, strlen(text
),
80 if (usleep_safe(nr_usec
)) {
91 exit(!ret
? EXIT_SUCCESS
: EXIT_FAILURE
);
This page took 0.051058 seconds and 5 git commands to generate.