summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2024-12-18 22:43:47 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-08 10:00:56 +0100
commit04a44ae90d161e339b23e9afb2d76355c6f46a32 (patch)
treec82cec65e6267e10791d3278743e6611721cd0c0 /tools/testing
parentd8cc20a8cceb3b5e8ad2e11365e3100ba36a27e9 (diff)
downloadlinux-04a44ae90d161e339b23e9afb2d76355c6f46a32.tar.gz
linux-04a44ae90d161e339b23e9afb2d76355c6f46a32.tar.bz2
linux-04a44ae90d161e339b23e9afb2d76355c6f46a32.zip
selftests/powerpc: Fix argument order to timer_sub()
[ Upstream commit 2bf66e66d2e6feece6175ec09ec590a0a8563bdd ] Commit c814bf958926 ("powerpc/selftests: Use timersub() for gettimeofday()"), got the order of arguments to timersub() wrong, leading to a negative time delta being reported, eg: test: gettimeofday tags: git_version:v6.12-rc5-409-gdddf291c3030 time = -3.297781 success: gettimeofday The correct order is minuend, subtrahend, which in this case is end, start. Which gives: test: gettimeofday tags: git_version:v6.12-rc5-409-gdddf291c3030-dirty time = 3.300650 success: gettimeofday Fixes: c814bf958926 ("powerpc/selftests: Use timersub() for gettimeofday()") Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20241218114347.428108-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/powerpc/benchmarks/gettimeofday.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c b/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c
index 580fcac0a09f..b71ef8a493ed 100644
--- a/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c
+++ b/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c
@@ -20,7 +20,7 @@ static int test_gettimeofday(void)
gettimeofday(&tv_end, NULL);
}
- timersub(&tv_start, &tv_end, &tv_diff);
+ timersub(&tv_end, &tv_start, &tv_diff);
printf("time = %.6f\n", tv_diff.tv_sec + (tv_diff.tv_usec) * 1e-6);