diff options
author | Andy Lutomirski <luto@kernel.org> | 2016-01-08 14:18:58 -0800 |
---|---|---|
committer | Andy Lutomirski <luto@kernel.org> | 2016-01-08 14:18:58 -0800 |
commit | 81b82367eb2baa0db0f6097c83a699bb097b2697 (patch) | |
tree | 1a72d499ffe3496870ffce4b84a56c11f93f168b | |
parent | 0fe666686e56d0f6f550111cb6a3303bf4826abf (diff) | |
download | misc-tests-81b82367eb2baa0db0f6097c83a699bb097b2697.tar.gz |
context_switch_latency: Tidy up the code a bit
-rw-r--r-- | context_switch_latency.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/context_switch_latency.c b/context_switch_latency.c index 7920ea4..ad6818a 100644 --- a/context_switch_latency.c +++ b/context_switch_latency.c @@ -19,7 +19,7 @@ volatile int state; // 0 = warmup. 1 = benchmark. 2 = exit. int use_xstate = 0; int thread_cpu; -void maybe_use_xstate(void) +static void maybe_use_xstate(void) { if (use_xstate) asm volatile ("pxor %%xmm0, %%xmm0" : : : "xmm0"); @@ -40,11 +40,10 @@ void *threadproc(void *x) if (read(to_thread, &buf, 8) != 8) err(1, "read eventfd"); - int s = state; - if (s == 2) + if (state == 2) return 0; - else if (1 || s == 0) - maybe_use_xstate(); + + maybe_use_xstate(); buf = 1; if (write(from_thread, &buf, 8) != 8) @@ -52,7 +51,7 @@ void *threadproc(void *x) } } -void bounce() +static void bounce() { uint64_t buf = 1; if (write(to_thread, &buf, 8) != 8) |