4 * LTTng Userspace Tracer (UST) - benchmark tool
6 * Copyright 2010 - Douglas Santos <douglas.santos@polymtl.ca>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #define TRACEPOINT_DEFINE
32 #include "ust_tests_benchmark.h"
36 static unsigned long nr_events
;
45 file
= fopen("/dev/null", "a");
46 fprintf(file
, "%d", v
);
51 tracepoint(ust_tests_benchmark
, tpbench
, v
);
57 void *function(void *arg
)
61 for(i
= 0; i
< nr_events
; i
++) {
67 void usage(char **argv
) {
68 printf("Usage: %s nr_cpus nr_events\n", argv
[0]);
72 int main(int argc
, char **argv
)
82 nr_cpus
= atoi(argv
[1]);
83 printf("using %d processor(s)\n", nr_cpus
);
85 nr_events
= atol(argv
[2]);
86 printf("using %ld events per cpu\n", nr_events
);
88 pthread_t thread
[nr_cpus
];
89 for (i
= 0; i
< nr_cpus
; i
++) {
90 if (pthread_create(&thread
[i
], NULL
, function
, NULL
)) {
91 fprintf(stderr
, "thread create %d failed\n", i
);
96 for (i
= 0; i
< nr_cpus
; i
++) {
97 if (pthread_join(thread
[i
], &retval
)) {
98 fprintf(stderr
, "thread join %d failed\n", i
);
This page took 0.03359 seconds and 5 git commands to generate.