c23f07c3d0153278efed3b44a8de1fd6d59c9e50
2 * SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright 2010 Douglas Santos <douglas.santos@polymtl.ca>
6 * LTTng Userspace Tracer (UST) - benchmark tool
15 #include <urcu/compiler.h>
18 #define TRACEPOINT_DEFINE
19 #include "ust_tests_benchmark.h"
23 static unsigned long nr_events
;
32 for (i
= 0; i
< 100; i
++)
35 tracepoint(ust_tests_benchmark
, tpbench
, v
);
39 void *function(void *arg
)
43 for (i
= 0; i
< nr_events
; i
++) {
49 void usage(char **argv
) {
50 printf("Usage: %s nr_cpus nr_events\n", argv
[0]);
54 int main(int argc
, char **argv
)
64 nr_cpus
= atoi(argv
[1]);
65 printf("using %d processor(s)\n", nr_cpus
);
67 nr_events
= atol(argv
[2]);
68 printf("using %ld events per cpu\n", nr_events
);
70 pthread_t thread
[nr_cpus
];
71 for (i
= 0; i
< nr_cpus
; i
++) {
72 if (pthread_create(&thread
[i
], NULL
, function
, NULL
)) {
73 fprintf(stderr
, "thread create %d failed\n", i
);
78 for (i
= 0; i
< nr_cpus
; i
++) {
79 if (pthread_join(thread
[i
], &retval
)) {
80 fprintf(stderr
, "thread join %d failed\n", i
);
This page took 0.051762 seconds and 3 git commands to generate.