diff options
author | Andy Lutomirski <luto@kernel.org> | 2016-01-08 14:19:26 -0800 |
---|---|---|
committer | Andy Lutomirski <luto@kernel.org> | 2016-01-08 14:19:26 -0800 |
commit | 9e19bba010cb7e750260d291f3300f0e2b61150e (patch) | |
tree | fc6812065a2221b45568b46775ad001ab044712d | |
parent | 81b82367eb2baa0db0f6097c83a699bb097b2697 (diff) | |
download | misc-tests-9e19bba010cb7e750260d291f3300f0e2b61150e.tar.gz |
context_switch_latency: Reindent
-rw-r--r-- | context_switch_latency.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/context_switch_latency.c b/context_switch_latency.c index ad6818a..e4a44ce 100644 --- a/context_switch_latency.c +++ b/context_switch_latency.c @@ -21,52 +21,52 @@ int thread_cpu; static void maybe_use_xstate(void) { - if (use_xstate) - asm volatile ("pxor %%xmm0, %%xmm0" : : : "xmm0"); + if (use_xstate) + asm volatile ("pxor %%xmm0, %%xmm0" : : : "xmm0"); } void *threadproc(void *x) { - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - CPU_SET(thread_cpu, &cpuset); - if (sched_setaffinity(0, sizeof(cpuset), &cpuset) != 0) - printf("[WARN]\tsched_setaffinity failed\n"); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(thread_cpu, &cpuset); + if (sched_setaffinity(0, sizeof(cpuset), &cpuset) != 0) + printf("[WARN]\tsched_setaffinity failed\n"); - while(1) - { - uint64_t buf; + while(1) + { + uint64_t buf; - if (read(to_thread, &buf, 8) != 8) - err(1, "read eventfd"); + if (read(to_thread, &buf, 8) != 8) + err(1, "read eventfd"); - if (state == 2) - return 0; + if (state == 2) + return 0; - maybe_use_xstate(); + maybe_use_xstate(); - buf = 1; - if (write(from_thread, &buf, 8) != 8) - err(1, "write eventfd"); - } + buf = 1; + if (write(from_thread, &buf, 8) != 8) + err(1, "write eventfd"); + } } static void bounce() { - uint64_t buf = 1; - if (write(to_thread, &buf, 8) != 8) - err(1, "write eventfd"); + uint64_t buf = 1; + if (write(to_thread, &buf, 8) != 8) + err(1, "write eventfd"); - if (read(from_thread, &buf, 8) != 8) - err(1, "read eventfd"); + if (read(from_thread, &buf, 8) != 8) + err(1, "read eventfd"); } void killit() { - uint64_t buf = 1; - state = 2; - if (write(to_thread, &buf, 8) != 8) - err(1, "write eventfd at exit"); + uint64_t buf = 1; + state = 2; + if (write(to_thread, &buf, 8) != 8) + err(1, "write eventfd at exit"); } int main(int argc, char **argv) @@ -162,7 +162,7 @@ int main(int argc, char **argv) ns = 1000000000ULL * (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec); printf("%llu iters at %.1f ns/switch\n", - (unsigned long long)iters, (double)ns / (2*iters)); + (unsigned long long)iters, (double)ns / (2*iters)); if (use_thread) pthread_join(thread, 0); |