X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=tests%2Fbenchmark%2Fbench.c;h=1626fd2beeb7998db7a9d755cd942570689a1faf;hb=c0c0989ab70574e09b2f7e8b48c2da6af664a849;hp=ec08130d764e8d5001a7836ab45ec470fa5b1fd1;hpb=e6af533d5eb211b3b01834621a1c022e07b124de;p=lttng-ust.git diff --git a/tests/benchmark/bench.c b/tests/benchmark/bench.c index ec08130d..1626fd2b 100644 --- a/tests/benchmark/bench.c +++ b/tests/benchmark/bench.c @@ -1,37 +1,40 @@ /* - * bench.c + * SPDX-License-Identifier: GPL-2.0-or-later + * + * Copyright 2010 Douglas Santos * * LTTng Userspace Tracer (UST) - benchmark tool */ -#define _GNU_SOURCE #include #include #include #include #include -#include +#include + +#ifdef TRACING +#define TRACEPOINT_DEFINE +#include "ust_tests_benchmark.h" +#endif static int nr_cpus; static unsigned long nr_events; -pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; void do_stuff(void) { int v; FILE *file; - int lock; v = 1; - lock = pthread_mutex_lock(&mutex); - file = fopen("/tmp/bench.txt", "a"); + file = fopen("/dev/null", "a"); fprintf(file, "%d", v); fclose(file); - lock = pthread_mutex_unlock(&mutex); + time(NULL); -#ifdef MARKER - trace_mark(ust, event, "event %d", v); +#ifdef TRACING + tracepoint(ust_tests_benchmark, tpbench, v); #endif } @@ -47,7 +50,6 @@ void *function(void *arg) return NULL; } - void usage(char **argv) { printf("Usage: %s nr_cpus nr_events\n", argv[0]); }