* [LTP] [PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space and add measurement of execution time
@ 2023-10-18 1:49 Xin Wang via ltp
2023-10-26 1:09 ` Wang, Xin via ltp
0 siblings, 1 reply; 5+ messages in thread
From: Xin Wang via ltp @ 2023-10-18 1:49 UTC (permalink / raw)
To: ltp
Signed-off-by: Xin Wang <Xin.Wang@windriver.com>
---
testcases/kernel/fs/fsx-linux/Makefile | 3 +-
testcases/kernel/fs/fsx-linux/fsx-linux.c | 53 ++++++++++++++++++++---
2 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/fs/fsx-linux/Makefile b/testcases/kernel/fs/fsx-linux/Makefile
index 956486b8a..8162da3f9 100644
--- a/testcases/kernel/fs/fsx-linux/Makefile
+++ b/testcases/kernel/fs/fsx-linux/Makefile
@@ -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
\ No newline at end of file
diff --git a/testcases/kernel/fs/fsx-linux/fsx-linux.c b/testcases/kernel/fs/fsx-linux/fsx-linux.c
index 64c27a0f5..c1b0964f1 100644
--- a/testcases/kernel/fs/fsx-linux/fsx-linux.c
+++ b/testcases/kernel/fs/fsx-linux/fsx-linux.c
@@ -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)
} else
check_trunc_hack();
+ clock_gettime(CLOCK_ID, &time_start);
while (numops == -1 || numops--)
test();
close_test_files();
+ clock_gettime(CLOCK_ID, &time_end);
prt("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);
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space and add measurement of execution time
2023-10-18 1:49 [LTP] [PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space and add measurement of execution time Xin Wang via ltp
@ 2023-10-26 1:09 ` Wang, Xin via ltp
2023-12-01 17:43 ` Petr Vorel
2023-12-01 17:46 ` Petr Vorel
0 siblings, 2 replies; 5+ messages in thread
From: Wang, Xin via ltp @ 2023-10-26 1:09 UTC (permalink / raw)
To: ltp@lists.linux.it
Hello,
> Subject: [LTP][PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space
> and add measurement of execution time
>
> Signed-off-by: Xin Wang <Xin.Wang@windriver.com>
> ---
> testcases/kernel/fs/fsx-linux/Makefile | 3 +-
> testcases/kernel/fs/fsx-linux/fsx-linux.c | 53 ++++++++++++++++++++---
> 2 files changed, 50 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/kernel/fs/fsx-linux/Makefile b/testcases/kernel/fs/fsx-
> linux/Makefile
> index 956486b8a..8162da3f9 100644
> --- a/testcases/kernel/fs/fsx-linux/Makefile
> +++ b/testcases/kernel/fs/fsx-linux/Makefile
> @@ -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
> \ No newline at end of file
> diff --git a/testcases/kernel/fs/fsx-linux/fsx-linux.c b/testcases/kernel/fs/fsx-
> linux/fsx-linux.c
> index 64c27a0f5..c1b0964f1 100644
> --- a/testcases/kernel/fs/fsx-linux/fsx-linux.c
> +++ b/testcases/kernel/fs/fsx-linux/fsx-linux.c
> @@ -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)
> } else
> check_trunc_hack();
>
> + clock_gettime(CLOCK_ID, &time_start);
> while (numops == -1 || numops--)
> test();
>
> close_test_files();
> + clock_gettime(CLOCK_ID, &time_end);
> prt("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
> 2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space and add measurement of execution time
2023-10-26 1:09 ` Wang, Xin via ltp
@ 2023-12-01 17:43 ` Petr Vorel
2023-12-01 17:46 ` Petr Vorel
1 sibling, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-12-01 17:43 UTC (permalink / raw)
To: Wang, Xin; +Cc: ltp@lists.linux.it
Hi Xin,
> 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
> Regards,
> Xin
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space and add measurement of execution time
2023-10-26 1:09 ` Wang, Xin via ltp
2023-12-01 17:43 ` Petr Vorel
@ 2023-12-01 17:46 ` Petr Vorel
2023-12-05 1:46 ` Wang, Xin via ltp
1 sibling, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2023-12-01 17:46 UTC (permalink / raw)
To: Wang, Xin; +Cc: ltp@lists.linux.it
Hi Xin,
> Hello,
> > Subject: [LTP][PATCH v2 1/1] enable fsx-linux.c running 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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space and add measurement of execution time
2023-12-01 17:46 ` Petr Vorel
@ 2023-12-05 1:46 ` Wang, Xin via ltp
0 siblings, 0 replies; 5+ messages in thread
From: Wang, Xin via ltp @ 2023-12-05 1:46 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp@lists.linux.it
Hello Petr,
> Hi Xin,
>
> > Hello,
> > > Subject: [LTP][PATCH v2 1/1] enable fsx-linux.c running 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
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
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-05 1:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18 1:49 [LTP] [PATCH v2 1/1] enable fsx-linux.c running on VxWorks user space and add measurement of execution time Xin Wang via ltp
2023-10-26 1:09 ` Wang, Xin via ltp
2023-12-01 17:43 ` Petr Vorel
2023-12-01 17:46 ` Petr Vorel
2023-12-05 1:46 ` Wang, Xin via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox