diff options
author | Andy Lutomirski <luto@mit.edu> | 2011-07-25 11:09:19 -0400 |
---|---|---|
committer | Andy Lutomirski <luto@mit.edu> | 2011-07-25 11:12:36 -0400 |
commit | c4c83b2b4acd7956c180746e22464235e695a0df (patch) | |
tree | b3316895fa813f22bd9fb9e5fb640a5ac5532d21 | |
parent | 2158c72041b7aadf0952285bbb0e8b81beb2e0da (diff) | |
download | misc-tests-c4c83b2b4acd7956c180746e22464235e695a0df.tar.gz |
Revert bogosity in "Add context_switch_latency"
I committed some temporary hacks my mistake.
This partially reverts commit 2158c72041b7aadf0952285bbb0e8b81beb2e0da.
-rw-r--r-- | test_vsyscall.cc | 72 |
1 files changed, 18 insertions, 54 deletions
diff --git a/test_vsyscall.cc b/test_vsyscall.cc index 0d29af3..cbb1fe7 100644 --- a/test_vsyscall.cc +++ b/test_vsyscall.cc @@ -14,11 +14,6 @@ #include <asm/ldt.h> #include <errno.h> -static int sys_arch_prctl(long a, long b) -{ - return syscall(__NR_arch_prctl, a, b); -} - static inline int modify_ldt(int mode, void *ptr, unsigned long size) { int ret = syscall(__NR_modify_ldt, mode, ptr, size); @@ -205,57 +200,26 @@ int test(int argc, char **argv) int bench(int argc, char **argv) { - benchmark("dummy syscall ", [&]{syscall(0xffffffff);}); - benchmark("dummy prctl ", [&]{sys_arch_prctl(0xffffffff, 0);}); - - benchmark("kernel_fpu_begin ", [&]{sys_arch_prctl(1000, 0);}); - benchmark("kernel_fpu_begin + ymm", [&]{ - sys_arch_prctl(1000, 0); - asm volatile("vzeroupper"); - }); - - benchmark("stts/clts x1000 ", [&]{sys_arch_prctl(1001, 0);}); - - long one = 1; + struct timeval tv; + struct timezone tz; + benchmark(" syscall gettimeofday", [&]{sys_gtod(&tv, &tz);}); + benchmark(" vdso gettimeofday", [&]{vdso_gtod(&tv, &tz);}); + benchmark("vsyscall gettimeofday", [&]{vgtod(&tv, &tz);}); + + printf("\n"); + time_t t; + benchmark(" syscall time ", [&]{sys_time(&t);}); + if (vdso_time) + benchmark(" vdso time ", [&]{vdso_time(&t);}); + benchmark("vsyscall time ", [&]{vtime(&t);}); - char *xstate; - if (posix_memalign((void**)&xstate, 64, 4096)) { - perror("posix_memalign"); - return 1; - } + printf("\n"); + unsigned cpu, node; + benchmark(" vdso getcpu ", [&]{vdso_getcpu(&cpu, &node, 0);}); + benchmark("vsyscall getcpu ", [&]{vgetcpu(&cpu, &node, 0);}); - asm volatile ("vbroadcastsd %0, %%ymm0" : : "m" (one) : "xmm0"); - benchmark("xsave+clflush+restore ymm ", [&]{ - asm volatile("xsaveq %0\n\tclflush %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - benchmark("xsave+restore ymm ", [&]{ - asm volatile("xsaveq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - benchmark("xsave+2restore ymm ", [&]{ - asm volatile("xsaveq %0\n\txrstorq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - benchmark("2xsave+restore ymm ", [&]{ - asm volatile("xsaveq %0\n\txsaveq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - benchmark("xsaveopt+restore ymm ", [&]{ - asm volatile("xsaveoptq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - - asm volatile ("vbroadcastsd %0, %%ymm0; vzeroupper" : : "m" (one) : "xmm0"); - benchmark("xsave+restore xmm ", [&]{ - asm volatile("xsaveq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - benchmark("xsaveopt+restore xmm ", [&]{ - asm volatile("xsaveoptq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - - asm volatile ("vzeroall" : : "m" (one) : "xmm0"); - benchmark("xsave+restore zero ", [&]{ - asm volatile("xsaveq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); - benchmark("xsaveopt+restore zero ", [&]{ - asm volatile("xsaveoptq %0\n\txrstorq %0" : "=m" (*xstate) : "a" (0xffffffff), "d" (0xffffffff)); - }); + printf("\n"); + benchmark("dummy syscall ", [&]{syscall(0xffffffff);}); return 0; } |