[PATCH] KVM: selftests: Tweak time measurement flag in kvm_page_table_test

From: Yanan Wang
Date: Mon Apr 19 2021 - 06:50:05 EST


Also use CLOCK_MONOTONIC flag to get time in kvm_page_table_test.c,
since that's what all the kvm/selftests do currently. And this will
be consistent with function timespec_elapsed() in test_util.c.

Signed-off-by: Yanan Wang <wangyanan55@xxxxxxxxxx>
---
tools/testing/selftests/kvm/kvm_page_table_test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/kvm/kvm_page_table_test.c b/tools/testing/selftests/kvm/kvm_page_table_test.c
index 1c4753fff19e..d7847fba47a8 100644
--- a/tools/testing/selftests/kvm/kvm_page_table_test.c
+++ b/tools/testing/selftests/kvm/kvm_page_table_test.c
@@ -212,7 +212,7 @@ static void *vcpu_worker(void *data)
if (READ_ONCE(host_quit))
return NULL;

- clock_gettime(CLOCK_MONOTONIC_RAW, &start);
+ clock_gettime(CLOCK_MONOTONIC, &start);
ret = _vcpu_run(vm, vcpu_id);
ts_diff = timespec_elapsed(start);

@@ -390,7 +390,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
/* Test the stage of KVM creating mappings */
*current_stage = KVM_CREATE_MAPPINGS;

- clock_gettime(CLOCK_MONOTONIC_RAW, &start);
+ clock_gettime(CLOCK_MONOTONIC, &start);
vcpus_complete_new_stage(*current_stage);
ts_diff = timespec_elapsed(start);

@@ -403,7 +403,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)

*current_stage = KVM_UPDATE_MAPPINGS;

- clock_gettime(CLOCK_MONOTONIC_RAW, &start);
+ clock_gettime(CLOCK_MONOTONIC, &start);
vcpus_complete_new_stage(*current_stage);
ts_diff = timespec_elapsed(start);

@@ -415,7 +415,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)

*current_stage = KVM_ADJUST_MAPPINGS;

- clock_gettime(CLOCK_MONOTONIC_RAW, &start);
+ clock_gettime(CLOCK_MONOTONIC, &start);
vcpus_complete_new_stage(*current_stage);
ts_diff = timespec_elapsed(start);

--
2.23.0