X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tests%2Fbenchmark%2Fbench.c;h=212baefffefeeb108bfe5a091e9cc9981cdbc708;hb=402147a0ffcc8fb0a1784a6d880fac318038e686;hp=ec08130d764e8d5001a7836ab45ec470fa5b1fd1;hpb=e6af533d5eb211b3b01834621a1c022e07b124de;p=lttng-ust.git diff --git a/tests/benchmark/bench.c b/tests/benchmark/bench.c index ec08130d..212baeff 100644 --- a/tests/benchmark/bench.c +++ b/tests/benchmark/bench.c @@ -2,6 +2,22 @@ * bench.c * * LTTng Userspace Tracer (UST) - benchmark tool + * + * Copyright 2010 - Douglas Santos + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _GNU_SOURCE @@ -11,27 +27,25 @@ #include #include #include +#include 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); + ust_marker(event, "event %d", v); #endif } @@ -47,7 +61,6 @@ void *function(void *arg) return NULL; } - void usage(char **argv) { printf("Usage: %s nr_cpus nr_events\n", argv[0]); }