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
17 #define TRACEPOINT_DEFINE
18 #include "ust_tests_benchmark.h"
22 static unsigned long nr_events
;
31 file
= fopen("/dev/null", "a");
32 fprintf(file
, "%d", v
);
37 tracepoint(ust_tests_benchmark
, tpbench
, v
);
43 void *function(void *arg
)
47 for(i
= 0; i
< nr_events
; i
++) {
53 void usage(char **argv
) {
54 printf("Usage: %s nr_cpus nr_events\n", argv
[0]);
58 int main(int argc
, char **argv
)
68 nr_cpus
= atoi(argv
[1]);
69 printf("using %d processor(s)\n", nr_cpus
);
71 nr_events
= atol(argv
[2]);
72 printf("using %ld events per cpu\n", nr_events
);
74 pthread_t thread
[nr_cpus
];
75 for (i
= 0; i
< nr_cpus
; i
++) {
76 if (pthread_create(&thread
[i
], NULL
, function
, NULL
)) {
77 fprintf(stderr
, "thread create %d failed\n", i
);
82 for (i
= 0; i
< nr_cpus
; i
++) {
83 if (pthread_join(thread
[i
], &retval
)) {
84 fprintf(stderr
, "thread join %d failed\n", i
);
This page took 0.031196 seconds and 4 git commands to generate.