]>
git.saurik.com Git - apple/xnu.git/blob - tests/mpsc.c
2 * mpsc: test the MPSC interface
9 #include <darwintest.h>
10 #include <sys/sysctl.h>
12 T_GLOBAL_META(T_META_NAMESPACE("xnu.mpsc"),
13 T_META_RUN_CONCURRENTLY(true));
15 T_DECL(pingpong
, "mpsc_pingpong", T_META_ASROOT(true))
17 uint64_t count
= 100 * 1000, nsecs
= 0;
18 size_t nlen
= sizeof(nsecs
);
21 error
= sysctlbyname("kern.mpsc_test_pingpong", &nsecs
, &nlen
,
22 &count
, sizeof(count
));
23 T_ASSERT_POSIX_SUCCESS(error
, "sysctlbyname");
24 T_LOG("%lld asyncs in %lld ns (%g us/async)", count
, nsecs
,
25 (nsecs
/ 1e3
) / count
);