diff options
author | Shuah Khan <skhan@linuxfoundation.org> | 2021-09-15 23:28:08 +0200 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2021-09-16 20:57:26 +0200 |
commit | 20175d5eac5bb94a7a3719ef275337fc9abf26ac (patch) | |
tree | eb4239635327ea26c9a62afa77c91a2152bed113 /tools/testing/selftests/kvm/steal_time.c | |
parent | selftests:kvm: fix get_trans_hugepagesz() ignoring fscanf() return warn (diff) | |
download | linux-20175d5eac5bb94a7a3719ef275337fc9abf26ac.tar.xz linux-20175d5eac5bb94a7a3719ef275337fc9abf26ac.zip |
selftests: kvm: move get_run_delay() into lib/test_util
get_run_delay() is defined static in xen_shinfo_test and steal_time test.
Move it to lib and remove code duplication.
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/kvm/steal_time.c')
-rw-r--r-- | tools/testing/selftests/kvm/steal_time.c | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/tools/testing/selftests/kvm/steal_time.c b/tools/testing/selftests/kvm/steal_time.c index ecec30865a74..51fe95a5c36a 100644 --- a/tools/testing/selftests/kvm/steal_time.c +++ b/tools/testing/selftests/kvm/steal_time.c @@ -10,7 +10,6 @@ #include <sched.h> #include <pthread.h> #include <linux/kernel.h> -#include <sys/syscall.h> #include <asm/kvm.h> #include <asm/kvm_para.h> @@ -217,20 +216,6 @@ static void steal_time_dump(struct kvm_vm *vm, uint32_t vcpuid) #endif -static long get_run_delay(void) -{ - char path[64]; - long val[2]; - FILE *fp; - - sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid)); - fp = fopen(path, "r"); - fscanf(fp, "%ld %ld ", &val[0], &val[1]); - fclose(fp); - - return val[1]; -} - static void *do_steal_time(void *arg) { struct timespec ts, stop; |