enable fsx-linux.c running on VxWorks user space and add measurement of execution time
PATCH v2 1/1 enable fsx-linux.c running on VxWorks user space and add measurement of execution time
--- testcases/kernel/fs/fsx-linux/Makefile | 3 +- testcases/kernel/fs/fsx-linux/fsx-linux.c | 53 ++++++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-)
testcases/kernel/fs/fsx-linux/Makefile +2 -1
@@ -31,4 +31,5 @@ WCFLAGS += -w INSTALL_TARGETS := fsxtest* -include $(top_srcdir)/include/mk/generic_leaf_target.mk +include $(top_srcdir)/include/mk/testcases.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/fs/fsx-linux/fsx-linux.c +48 -5
113 lines not on this page · raw message
Signature · 5 lines
2.34.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hello,
Quoted 137 lines
Subject: [LTP][PATCH v2 1/1] enable
fsx-linux.crunning on VxWorks user space and add measurement of execution timeSigned-off-by Xin Wang <[email protected]>--- testcases/kernel/fs/fsx-linux/Makefile | 3 +- testcases/kernel/fs/fsx-linux/fsx-linux.c | 53 ++++++++++++++++++++--- 2 files changed, 50 insertions(+), 6 deletions(-)testcases/kernel/fs/fsx- renamed from testcases/kernel/fs/fsx-linux/Makefile +0
-0linux/Makefile
index956486b8a..8162da3f9100644testcases/kernel/fs/fsx-linux/Makefile +2
-1@@ -31,4 +31,5 @@ WCFLAGS += -w INSTALL_TARGETS := fsxtest* -include $(top_srcdir)/include/mk/generic_leaf_target.mk +include $(top_srcdir)/include/mk/testcases.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mktestcases/kernel/fs/fsx- renamed from testcases/kernel/fs/fsx-linux/fsx-linux.c +0
-0
linux/fsx-linux.c
index64c27a0f5..c1b0964f1100644testcases/kernel/fs/fsx-linux/fsx-linux.c +41
-5@@ -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> @@ -59,6 +61,10 @@#include <unistd.h> #include <stdarg.h> #include <errno.h> +#if !defined(__VXWORKS__) +#define TST_NO_DEFAULT_MAIN +#include "tst_timer.h" +#endif /* * A log entry is an operation and a bunch of arguments. @@ -87,6 +93,11 @@ int logcount = 0; /* total ops */#define OP_MAPREAD 5#define OP_MAPWRITE 6#define OP_SKIPPED 7 +#if defined(__VXWORKS__) +#define CLOCK_ID CLOCK_MONOTONIC +#else +#define CLOCK_ID CLOCK_MONOTONIC_RAW +#endif int page_size;int page_mask;@@ -128,6 +139,23 @@ int fsxgoodfd = 0;FILE *fsxlogf =NULL ;int badoff =-1 ; +#if defined(__VXWORKS__) +static inline struct timespec +tst_timespec_diff (struct timespec ts1,struct timespec ts2) { +struct timespec res; + +if (ts1.tv_nsec < ts2.tv_nsec) { + ts1.tv_nsec +=1000000000 ; + ts1.tv_sec -=1 ; + } + res.tv_sec = ts1.tv_sec - ts2.tv_sec; + res.tv_nsec = ts1.tv_nsec - ts2.tv_nsec; + +return res; +} +#endif +void vwarnc (int code,const char *fmt,va_list ap) {fprintf (stderr,"fsx: " );@@ -849,7 +877,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 ) { +#if defined(__VXWORKS__) +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 +1148,12 @@ 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 ; - page_size =getpagesize (); + page_size = (int )sysconf (_SC_PAGESIZE); page_mask = page_size -1 ;setvbuf (stdout,NULL , _IOLBF,0 );/* line buffered stdout */ @@ -1267,9 +1301,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 +1373,18 @@ int
main(int argc, char **argv)testcases/kernel/fs/fsx-linux/fsx-linux.c +2
-0}else check_trunc_hack (); +clock_gettime (CLOCK_ID , &time_start);while (numops ==-1 || numops--)test ();close_test_files (); +clock_gettime (CLOCK_ID , &time_end);
testcases/kernel/fs/fsx-linux/fsx-linux.c int main(int argc, char **argv)
Quoted 10 lines
testcases/kernel/fs/fsx-linux/fsx-linux.c +4
-1prt ("All operations completed A-OK!\n" ); + time_diff =tst_timespec_diff (time_end, time_start); +prt ("Elapsed Test Time %lu.%09lu\n" , + (unsigned long )time_diff.tv_sec, time_diff.tv_nsec); +if (tf_buf)free (tf_buf); --
Could you please review the patch v2?
Regards,
Xin
Quoted 1 line
2.34.1
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Xin,
Quoted 1 line
Could you please review the patch v2?
Could you please rebase the patch on current master? Most of it does not apply any more.
Kind regards,
Petr
Quoted 2 lines
Regards,
Xin
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Xin,
Quoted 3 lines
Hello,
Quoted 2 lines
Subject: [LTP][PATCH v2 1/1] enable
fsx-linux.crunning on VxWorks user space and add measurement of execution time
Also, the subject suggests (and the code changes how I understand it), that you're changing two things:
1) fixes for VxWorks 2) add measurement of execution time
If I'm correct, it would make sense to split changes into two commits.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hello Petr,
Quoted 6 lines
Hi Xin,
Quoted 3 lines
Hello,
Quoted 2 lines
Subject: [LTP][PATCH v2 1/1] enable
fsx-linux.crunning on VxWorks user space and add measurement of execution time
Quoted 8 lines
Also, the subject suggests (and the code changes how I understand it), that you're changing two things:
1) fixes for VxWorks 2) add measurement of execution timeIf I'm correct, it would make sense to split changes into two commits.
Kind regards,
Petr
Since fsx-linux.c had been updated to support new LTP API, this commit hasn't been fit to current version. I will try to find a new way to support VxWorks.
Regards,
Xin
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp