This commit enable fsx-linux.c running on VxWorks user space and add measurement of execution time
PATCH 1/1 This commit enable fsx-linux.c running on VxWorks user space and add measurement of execution time
Hello,
I come from Wind River. We and our customers used fsx-linux for file system testing on VxWorks user space and total execution time also received more attention in the testing. So I upstream the change of VxWorks compatibility parts on this patch, wish to enlarge the test support of fsx-linux.
There is a point need to explain, because current VxWorks doesn't support CLOCK_MONOTONIC_RAW , CLOCK_MONOTONIC is still used by VxWorks when calling clock_gettime. When CLOCK_MONOTONIC_RAW is support by VxWorks in the future, this part will be removed.
[fsx-linux]$ PATH=$PATH:$PWD ./fsx-linux -N 20000 /tmp/test/test.ini truncating to largest ever: 0x13e76
truncating to largest ever: 0x2e52c
truncating to largest ever: 0x3c2c2
truncating to largest ever: 0x3f15f
truncating to largest ever: 0x3fcb9
truncating to largest ever: 0x3fe96
truncating to largest ever: 0x3ff9d
All operations completed A-OK!
Elapsed Test Time 1.366451681
--- testcases/kernel/fs/fsx-linux/fsx-linux.c | 44 ++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-)
testcases/kernel/fs/fsx-linux/fsx-linux.c +40 -4
@@ -39,8 +39,10 @@#include <sys/types.h> #include <sys/stat.h> -#if defined(_UWIN) || defined(__linux__) +#if defined(_UWIN) || defined(__linux__) || defined(__VXWORKS__) +#if !defined(__VXWORKS__)#include <sys/param.h> +#endif #include <limits.h> #include <time.h> #include <string.h>
@@ -849,7 +851,12 @@ void domapwrite(unsigned offset, unsigned size)gettimeofday (&t,NULL );prt (" %lu.%06lu memcpy done\n" , t.tv_sec, t.tv_usec); } -if (msync (p, map_size,0 ) !=0 ) { +#ifdef MS_SYNC +if (msync (p, map_size,MS_SYNC ) !=0 ) +#else + if (msync(p, map_size, 0) != 0) +#endif + {prterr ("domapwrite: msync" );report_failure (203 ); }
@@ -1115,11 +1122,16 @@ int main(int argc, char **argv)int i, style, ch;char *endp;int dirpath =0 ; - +struct timespec time_start, time_end, time_diff; + goodfile[0 ] =0 ; logfile[0 ] =0 ; +#if defined(__VXWORKS__) + page_size = (int )sysconf (_SC_PAGESIZE); +#else page_size =getpagesize (); +#endif page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */
@@ -1267,9 +1279,12 @@ int main(int argc, char **argv)signal (SIGUSR1 , cleanup);signal (SIGUSR2 , cleanup); +#if defined(__VXWORKS__) +srand (seed); +#else initstate (seed, state,256 );setstate (state); - +#endif open_test_files (argv, argc);strncat (goodfile, dirpath ?basename (fname) : fname,256 );
@@ -1336,12 +1351,33 @@ int main(int argc, char **argv) }else check_trunc_hack (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_start); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_start); +#endif +while (numops ==-1 || numops--)test ();close_test_files (); +#if defined(__VXWORKS__) +clock_gettime (CLOCK_MONOTONIC , &time_end); +#else +clock_gettime (CLOCK_MONOTONIC_RAW , &time_end); +#endif +prt ("All operations completed A-OK!\n" ); +if (time_end.tv_nsec < time_start.tv_nsec) { + time_end.tv_nsec +=1000000000 ; + time_end.tv_sec -=1 ; + } + time_diff.tv_sec = time_end.tv_sec - time_start.tv_sec; + time_diff.tv_nsec = time_end.tv_nsec - time_start.tv_nsec; +prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf);
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp