2 * Copyright (C) - 2012 David Goulet <dgoulet@efficios.com>
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.
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
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
19 #include <arpa/inet.h>
27 #include <sys/types.h>
31 #define TRACEPOINT_DEFINE
34 void create_file(const char *path
)
40 ret
= creat(path
, S_IRWXU
);
42 fprintf(stderr
, "Failed to create file %s\n", path
);
49 int main(int argc
, char **argv
)
51 unsigned int i
, netint
;
52 long values
[] = { 1, 2, 3 };
53 char text
[10] = "test";
57 useconds_t nr_usec
= 0;
58 char *tmp_file_path
= NULL
;
59 bool file_created
= false;
63 * If nr_iter is negative, do an infinite tracing loop.
65 nr_iter
= atoi(argv
[1]);
69 /* By default, don't wait unless user specifies. */
70 nr_usec
= atoi(argv
[2]);
74 tmp_file_path
= argv
[3];
77 for (i
= 0; nr_iter
< 0 || i
< nr_iter
; i
++) {
79 tracepoint(tp
, tptest
, i
, netint
, values
, text
, strlen(text
), dbl
,
83 * First loop we create the file if asked to indicate that at least one
84 * tracepoint has been hit.
86 if (!file_created
&& tmp_file_path
) {
87 create_file(tmp_file_path
);
This page took 0.033795 seconds and 5 git commands to generate.