Commit | Line | Data |
---|---|---|
9fec62f7 CB |
1 | /* |
2 | * Copyright (C) - 2012 David Goulet <dgoulet@efficios.com> | |
3 | * | |
4 | * This library is free software; you can redistribute it and/or modify it | |
5 | * under the terms of the GNU Lesser General Public License as published by the | |
6 | * Free Software Foundation; version 2.1 of the License. | |
7 | * | |
8 | * This library is distributed in the hope that it will be useful, but WITHOUT | |
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | |
11 | * for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU Lesser General Public License | |
14 | * along with this library; if not, write to the Free Software Foundation, | |
15 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
16 | */ | |
17 | ||
18 | #include <arpa/inet.h> | |
19 | #include <stdarg.h> | |
20 | #include <stdio.h> | |
21 | #include <stdlib.h> | |
22 | #include <string.h> | |
23 | #include <sys/mman.h> | |
24 | #include <sys/stat.h> | |
25 | #include <sys/types.h> | |
26 | #include <unistd.h> | |
27 | ||
28 | #define TRACEPOINT_DEFINE | |
29 | #include "tp.h" | |
30 | ||
31 | int main(int argc, char **argv) | |
32 | { | |
33 | int i, netint; | |
34 | long values[] = { 1, 2, 3 }; | |
bff988fa | 35 | uint32_t net_values[] = { 1, 2, 3 }; |
9fec62f7 CB |
36 | char text[10] = "test"; |
37 | char escape[10] = "\\*"; | |
38 | double dbl = 2.0; | |
39 | float flt = 2222.0; | |
40 | /* Generate 30 events. */ | |
41 | unsigned int nr_iter = 100; | |
42 | useconds_t nr_usec = 0; | |
43 | ||
44 | if (argc >= 2) { | |
45 | nr_iter = atoi(argv[1]); | |
46 | } | |
47 | ||
48 | if (argc == 3) { | |
49 | /* By default, don't wait unless user specifies. */ | |
50 | nr_usec = atoi(argv[2]); | |
51 | } | |
52 | ||
bff988fa MD |
53 | for (i = 0; i < 3; i++) { |
54 | net_values[i] = htonl(net_values[i]); | |
55 | } | |
56 | ||
9fec62f7 CB |
57 | for (i = 0; i < nr_iter; i++) { |
58 | netint = htonl(i); | |
bff988fa MD |
59 | tracepoint(tp, tptest, i, netint, values, text, strlen(text), escape, dbl, flt, |
60 | net_values); | |
9fec62f7 CB |
61 | usleep(nr_usec); |
62 | } | |
63 | ||
64 | return 0; | |
65 | } |