blob: 88c1769c50202b7fe0b45292b11852de8d855e32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <pthread.h>
#include <string.h>
#include <err.h>
#include "bench.h"
static char name[] = "Condition Variable Signal/Broadcast, No Waiters";
static char doc[] =
"\tThis is the amount of time needed to execute pthread_cond_signal()\n"
"\tor pthread_cond_broadcast() if there are no threads blocked on\n"
"\tthe condition.";
int
main() {
pthread_cond_t c;
bench_t b;
bench_init(&b, name, doc, "per call of pthread_cond_signal()");
bench_header(&b);
pthread_cond_init(&c, NULL);
bench_amortize(&b, BENCH_LOOPS) {
pthread_cond_signal(&c);
}
bench_report(&b);
bench_init(&b, NULL, NULL, "per call of pthread_cond_broadcast()");
pthread_cond_init(&c, NULL);
bench_amortize(&b, BENCH_LOOPS) {
pthread_cond_broadcast(&c);
}
bench_report(&b);
exit(0);
}
|