Skip to content

Commit 2bf66e6

Browse files
mpemaddy-kerneldev
authored andcommitted
selftests/powerpc: Fix argument order to timer_sub()
Commit c814bf9 ("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: c814bf9 ("powerpc/selftests: Use timersub() for gettimeofday()") Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 200f22f commit 2bf66e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/powerpc/benchmarks/gettimeofday.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int test_gettimeofday(void)
2020
gettimeofday(&tv_end, NULL);
2121
}
2222

23-
timersub(&tv_start, &tv_end, &tv_diff);
23+
timersub(&tv_end, &tv_start, &tv_diff);
2424

2525
printf("time = %.6f\n", tv_diff.tv_sec + (tv_diff.tv_usec) * 1e-6);
2626

0 commit comments

Comments
 (0)