diff options
author | Andy Lutomirski <luto@kernel.org> | 2015-10-07 13:50:19 -0700 |
---|---|---|
committer | Andy Lutomirski <luto@kernel.org> | 2015-10-07 13:50:19 -0700 |
commit | 17954d79bef826ce0c315f647a7baec344bc8ca6 (patch) | |
tree | d5abe8606953048141fbf576a76220bd76c7c312 | |
parent | 404d5254876cd2571e8049e6fa081b738e3db8d6 (diff) | |
download | misc-tests-17954d79bef826ce0c315f647a7baec344bc8ca6.tar.gz |
context_switch_latency: Improve diagnostics
-rw-r--r-- | context_switch_latency.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/context_switch_latency.c b/context_switch_latency.c index fe39a7a..4b8989c 100644 --- a/context_switch_latency.c +++ b/context_switch_latency.c @@ -8,6 +8,7 @@ #include <sched.h> #include <pthread.h> #include <sys/eventfd.h> +#include <err.h> int to_thread, from_thread; volatile int state; // 0 = warmup. 1 = benchmark. 2 = exit. @@ -34,7 +35,7 @@ void *threadproc(void *x) uint64_t buf; if (read(to_thread, &buf, 8) != 8) - abort(); + err(1, "read eventfd"); int s = state; if (s == 2) @@ -44,7 +45,7 @@ void *threadproc(void *x) buf = 1; if (write(from_thread, &buf, 8) != 8) - abort(); + err(1, "write eventfd"); } } @@ -52,10 +53,10 @@ void bounce() { uint64_t buf = 1; if (write(to_thread, &buf, 8) != 8) - abort(); + err(1, "write eventfd"); if (read(from_thread, &buf, 8) != 8) - abort(); + err(1, "read eventfd"); } void killit() @@ -63,7 +64,7 @@ void killit() uint64_t buf = 1; state = 2; if (write(to_thread, &buf, 8) != 8) - abort(); + err(1, "write eventfd at exit"); } int main(int argc, char **argv) |