fs/fsx-linux/fsx-linux.c: Add measurement of execution time
PATCH 1/1 fs/fsx-linux/fsx-linux.c: Add measurement of execution time
fsx-linux.c is usually used for file system regression testing and total execution time also more and more receives attention. Add measurement of execution time in fsx-linux.c:
[fsx-linux]$ PATH=$PATH:$PWD ./fsx-linux -N 20000 /tmp/test/test.ini
All operations completed A-OK!
Elapsed Test Time 0.388891
Signed-off-by [email protected]
--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
testcases/kernel/fs/fsx-linux/fsx-linux.c +14 -1
@@ -1115,7 +1115,8 @@ int main(int argc, char **argv)int i, style, ch;char *endp;int dirpath =0 ; - +struct timeval time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ;
@@ -1336,12 +1337,24 @@ int main(int argc, char **argv) }else check_trunc_hack (); +gettimeofday (&time_start,NULL );while (numops ==-1 || numops--)test ();close_test_files (); +gettimeofday (&time_end,NULL ); +prt ("All operations completed A-OK!\n" ); + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_usec = time_end.tv_usec - time_start.tv_usec; +if (time_diff.tv_usec <0 ) { + time_diff.tv_usec +=1000000 ; + time_diff.tv_sec -=1 ; + } +prt ("Elapsed Test Time %lu.%06lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_usec); +if (tf_buf)free (tf_buf);
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 20 lines
Signed-off-by [email protected]--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)testcases/kernel/fs/fsx-linux/fsx-linux.c +2
-1@@ -1115,7 +1115,8 @@ int main(int argc, char **argv)int i, style, ch;char *endp;int dirpath =0 ; - +struct timeval time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ;
testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv) · line 1340
Quoted 4 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +1
-0@@ -1336,12 +1337,24 @@ int main(int argc, char **argv) }else check_trunc_hack (); +gettimeofday (&time_start,NULL );
gettimeofday() is not a good way how to measure elapsed time, it may jump up and down as it's adjusted by ntp-daemon.
If you want to measure time between two events you should use clock_gettime() with CLOCK_MONOTONIC_RAW instead.
Quoted 26 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +11
-0while (numops ==-1 || numops--)test ();close_test_files (); +gettimeofday (&time_end,NULL ); +prt ("All operations completed A-OK!\n" ); + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_usec = time_end.tv_usec - time_start.tv_usec; +if (time_diff.tv_usec <0 ) { + time_diff.tv_usec +=1000000 ; + time_diff.tv_sec -=1 ; + } +prt ("Elapsed Test Time %lu.%06lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_usec); +if (tf_buf)free (tf_buf);Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp