X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Ftestapp%2Fgen-ust-nevents-str%2Fgen-ust-nevents-str.cpp;fp=tests%2Futils%2Ftestapp%2Fgen-ust-nevents-str%2Fgen-ust-nevents-str.cpp;h=d68501bee553406e00b2cb8f78a673a231493067;hp=0000000000000000000000000000000000000000;hb=729c1fec5976af17fded2f026725a08ef1924290;hpb=488dbb6062973d4990a33284e4717d89a893339d diff --git a/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.cpp b/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.cpp new file mode 100644 index 000000000..d68501bee --- /dev/null +++ b/tests/utils/testapp/gen-ust-nevents-str/gen-ust-nevents-str.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017 Philippe Proulx + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#define _LGPL_SOURCE +#include +#include "signal-helper.h" + +#define TRACEPOINT_DEFINE +#include "tp.h" + +int main(int argc, char **argv) +{ + int count = 0, i = 0, arg_i = 0; + + if (set_signal_handler()) { + return 1; + } + + if (argc <= 3) { + fprintf(stderr, "Usage: %s COUNT STRING [STRING]...\n", + argv[0]); + return 1; + } + + if (argc >= 2) { + count = atoi(argv[1]); + } + + if (count < 0) { + return 0; + } + + for (i = 0, arg_i = 2; i < count; i++) { + tracepoint(tp, the_string, i, arg_i, argv[arg_i]); + + arg_i++; + if (arg_i == argc) { + arg_i = 2; + } + if (should_quit) { + break; + } + } + + return 0; +}