4 * LTTng Userspace Tracer (UST) - benchmark tool
13 #include <ust/marker.h>
17 static unsigned long nr_events
;
26 file
= fopen("/dev/null", "a");
27 fprintf(file
, "%d", v
);
32 trace_mark(ust
, event
, "event %d", v
);
38 void *function(void *arg
)
42 for(i
= 0; i
< nr_events
; i
++) {
48 void usage(char **argv
) {
49 printf("Usage: %s nr_cpus nr_events\n", argv
[0]);
53 int main(int argc
, char **argv
)
63 nr_cpus
= atoi(argv
[1]);
64 printf("using %d processor(s)\n", nr_cpus
);
66 nr_events
= atol(argv
[2]);
67 printf("using %ld events per cpu\n", nr_events
);
69 pthread_t thread
[nr_cpus
];
70 for (i
= 0; i
< nr_cpus
; i
++) {
71 if (pthread_create(&thread
[i
], NULL
, function
, NULL
)) {
72 fprintf(stderr
, "thread create %d failed\n", i
);
77 for (i
= 0; i
< nr_cpus
; i
++) {
78 if (pthread_join(thread
[i
], &retval
)) {
79 fprintf(stderr
, "thread join %d failed\n", i
);
This page took 0.03107 seconds and 4 git commands to generate.