X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Fust%2Fhigh-throughput%2Fmain.c;fp=tests%2Fregression%2Fust%2Fhigh-throughput%2Fmain.c;h=dbd2998ac54344e0952c14eeb9e92046dc03985f;hp=0000000000000000000000000000000000000000;hb=9ac429ef32142eaecfec2d1a44569464c4f8f721;hpb=785d2d0dc3aec3a4e44fcf677155dd07e8e4cc1f diff --git a/tests/regression/ust/high-throughput/main.c b/tests/regression/ust/high-throughput/main.c new file mode 100644 index 000000000..dbd2998ac --- /dev/null +++ b/tests/regression/ust/high-throughput/main.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009 Pierre-Marc Fournier + * Copyright (C) 2011 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 of + * the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TRACEPOINT_DEFINE +#include "tp.h" + +void inthandler(int sig) +{ +} + +int init_int_handler(void) +{ + int result; + struct sigaction act; + + memset(&act, 0, sizeof(act)); + result = sigemptyset(&act.sa_mask); + if (result == -1) { + perror("sigemptyset"); + return -1; + } + + act.sa_handler = inthandler; + act.sa_flags = SA_RESTART; + + /* Only defer ourselves. Also, try to restart interrupted + * syscalls to disturb the traced program as little as possible. + */ + result = sigaction(SIGUSR1, &act, NULL); + if (result == -1) { + perror("sigaction"); + return -1; + } + + return 0; +} + +int main(int argc, char **argv) +{ + int i, netint; + long values[] = { 1, 2, 3 }; + char text[10] = "test"; + double dbl = 2.0; + float flt = 2222.0; + int delay = 0; + + init_int_handler(); + + if (argc == 2) + delay = atoi(argv[1]); + + sleep(delay); + + for (i = 0; i < 1000000; i++) { + netint = htonl(i); + tracepoint(tp, tptest, i, netint, values, text, + strlen(text), dbl, flt); + } + + return 0; +}