[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2017-06-03 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: ac17e19da18581b138d2293b3a131bbf6f81521e
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ac17e19da18581b138d2293b3a131bbf6f81521e

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 97bebf0..77e9fea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -921,11 +921,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 5a82018..ae60a44 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2017-05-14 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 9c16960d3800c0c609c150dd543b0b921a65d6bc
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9c16960d3800c0c609c150dd543b0b921a65d6bc

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 97bebf0..77e9fea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -921,11 +921,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 5a82018..ae60a44 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2017-03-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 4d40f53e6db77e7a9d926e3beaae5969aaa1db82
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4d40f53e6db77e7a9d926e3beaae5969aaa1db82

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index a6b3e12..f2374f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -918,11 +918,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 5a82018..ae60a44 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2017-03-13 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: e249c2c8349dbcba15d51645e9da751f6efca74f
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e249c2c8349dbcba15d51645e9da751f6efca74f

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2170d0e..1432ef2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -918,11 +918,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 5a82018..ae60a44 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2017-03-05 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 83d1c15c2737f25579e20aad9b81e0926b522364
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=83d1c15c2737f25579e20aad9b81e0926b522364

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 28c41ce..adf88a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -915,11 +915,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2017-02-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 8dd53ef7dcca29b65dc0f2cce28d197f4a570bab
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8dd53ef7dcca29b65dc0f2cce28d197f4a570bab

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2197e55..9925d54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -915,11 +915,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2017-01-26 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6c92ab2f1279dffcddb178ca010faa0422e2d2b1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6c92ab2f1279dffcddb178ca010faa0422e2d2b1

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2197e55..9925d54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -915,11 +915,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2016-12-09 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: b4eadefcd31e1303e4f3331308135e6193544e34
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b4eadefcd31e1303e4f3331308135e6193544e34

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 14d2f8e..ab13f96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -911,11 +911,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2016-11-28 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: b073c97513f22f16df26938fe556f9330bb1baa7
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b073c97513f22f16df26938fe556f9330bb1baa7

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 14d2f8e..ab13f96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -911,11 +911,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 902a7ce4b7ba6eed078ddbd8957534c905a996f2
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=902a7ce4b7ba6eed078ddbd8957534c905a996f2

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b2a074..bbaf4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -905,11 +905,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2016-11-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 6cfca2ba8df5f1885da7e19d3e6b34f2159db578
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6cfca2ba8df5f1885da7e19d3e6b34f2159db578

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5b2a074..bbaf4a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -905,11 +905,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index b0904d2..e253d6f 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2016-10-17 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 75c96ce9a5f5a87b8f73053909290303f72d91ed
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=75c96ce9a5f5a87b8f73053909290303f72d91ed

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index ac9b252..9e9bc90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -904,11 +904,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 5ade58b..51292f1 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2016-09-22 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 06ee1f4ecc3176634c087bbc9d504be7e903f0dc
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=06ee1f4ecc3176634c087bbc9d504be7e903f0dc

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |6 +-
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 105 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index ac9b252..9e9bc90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -904,11 +904,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
-   testsuite/smokey/net_udp/Makefile \
-   testsuite/smokey/net_packet_dgram/Makefile \
-   testsuite/smokey/net_packet_raw/Makefile \
-   testsuite/smokey/net_common/Makefile \
-   testsuite/smokey/cpu-affinity/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 5ade58b..51292f1 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -9,6 +9,7 @@ COBALT_SUBDIRS =\
arith   \
bufp\
cpu-affinity\
+   fpu-stress  \
iddp\
leaks   \
net_packet_dgram\
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, report_error) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2015-11-02 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 3954909041071ab0422fe178e5afde0d52c100b1
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=3954909041071ab0422fe178e5afde0d52c100b1

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |   34 ---
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   95 ++
 4 files changed, 115 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index c805186..89c2911 100644
--- a/configure.ac
+++ b/configure.ac
@@ -899,6 +899,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 87e0555..023cd47 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -5,11 +5,10 @@ CCLD = $(top_srcdir)/scripts/wrap-link.sh $(CC)
 
 smokey_SOURCES = main.c
 
-if XENO_COBALT
-wrappers = $(XENO_POSIX_WRAPPERS)
-SUBDIRS =  \
+COBALT_SUBDIRS =   \
arith   \
bufp\
+   fpu-stress  \
iddp\
leaks   \
posix-clock \
@@ -25,8 +24,16 @@ SUBDIRS =\
tsc \
vdso-access \
xddp
+
+MERCURY_SUBDIRS =
+
+DIST_SUBDIRS = $(COBALT_SUBDIRS) $(MERCURY_SUBDIRS)
+   
+if XENO_COBALT
+wrappers = $(XENO_POSIX_WRAPPERS)
+SUBDIRS = $(COBALT_SUBDIRS)
 else
-SUBDIRS =
+SUBDIRS = $(MERCURY_SUBDIRS)
 wrappers =
 endif
 
@@ -50,22 +57,3 @@ smokey_LDADD =   \
../../lib/@XENO_CORE_LIB@   \
 @XENO_USER_LDADD@  \
-lpthread -lrt
-
-DIST_SUBDIRS = \
-   arith   \
-   bufp\
-   iddp\
-   leaks   \
-   posix-clock \
-   posix-cond  \
-   posix-fork  \
-   posix-mutex \
-   posix-select\
-   rtdm\
-   sched-quota \
-   sched-tp\
-   sigdebug\
-   timerfd \
-   tsc \
-   vdso-access \
-   xddp
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..59383c9
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,95 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int report_error(const char *fmt, ...)
+{
+   va_list ap;
+
+   va_start(ap, fmt);
+   smokey_vatrace(fmt, ap);
+   va_end(ap);
+
+   return 0;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, 

[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2015-11-01 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 7c555a563b42477602bb7fb193eacb3673170db8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=7c555a563b42477602bb7fb193eacb3673170db8

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   84 ++
 4 files changed, 94 insertions(+)

diff --git a/configure.ac b/configure.ac
index c805186..89c2911 100644
--- a/configure.ac
+++ b/configure.ac
@@ -899,6 +899,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 87e0555..e0361df 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -10,6 +10,7 @@ wrappers = $(XENO_POSIX_WRAPPERS)
 SUBDIRS =  \
arith   \
bufp\
+   fpu-stress  \
iddp\
leaks   \
posix-clock \
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..1846bf6
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,84 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, smokey_trace) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : testsuite/smokey: add basic FPU stress test

2015-10-24 Thread git repository hosting
Module: xenomai-3
Branch: arm64
Commit: 6a0c700645457dfeca4904e16aaa82457ed4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6a0c700645457dfeca4904e16aaa82457ed4

Author: Philippe Gerum 
Date:   Sat Oct 24 15:52:48 2015 +0200

testsuite/smokey: add basic FPU stress test

---

 configure.ac |1 +
 testsuite/smokey/Makefile.am |1 +
 testsuite/smokey/fpu-stress/Makefile.am  |8 +++
 testsuite/smokey/fpu-stress/fpu-stress.c |   84 ++
 4 files changed, 94 insertions(+)

diff --git a/configure.ac b/configure.ac
index c805186..89c2911 100644
--- a/configure.ac
+++ b/configure.ac
@@ -899,6 +899,7 @@ AC_CONFIG_FILES([ \
testsuite/smokey/timerfd/Makefile \
testsuite/smokey/tsc/Makefile \
testsuite/smokey/leaks/Makefile \
+   testsuite/smokey/fpu-stress/Makefile \
testsuite/clocktest/Makefile \
testsuite/xeno-test/Makefile \
utils/Makefile \
diff --git a/testsuite/smokey/Makefile.am b/testsuite/smokey/Makefile.am
index 87e0555..e0361df 100644
--- a/testsuite/smokey/Makefile.am
+++ b/testsuite/smokey/Makefile.am
@@ -10,6 +10,7 @@ wrappers = $(XENO_POSIX_WRAPPERS)
 SUBDIRS =  \
arith   \
bufp\
+   fpu-stress  \
iddp\
leaks   \
posix-clock \
diff --git a/testsuite/smokey/fpu-stress/Makefile.am 
b/testsuite/smokey/fpu-stress/Makefile.am
new file mode 100644
index 000..c90d0dd
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/Makefile.am
@@ -0,0 +1,8 @@
+
+noinst_LIBRARIES = libfpu-stress.a
+
+libfpu_stress_a_SOURCES = fpu-stress.c
+
+libfpu_stress_a_CPPFLAGS = \
+   @XENO_USER_CFLAGS@  \
+   -I$(top_srcdir)/include
diff --git a/testsuite/smokey/fpu-stress/fpu-stress.c 
b/testsuite/smokey/fpu-stress/fpu-stress.c
new file mode 100644
index 000..1846bf6
--- /dev/null
+++ b/testsuite/smokey/fpu-stress/fpu-stress.c
@@ -0,0 +1,84 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+
+smokey_test_plugin(fpu_stress,
+  SMOKEY_ARGLIST(
+  SMOKEY_INT(duration),
+  ),
+  "Check FPU context sanity during real-time stress\n"
+  "\tduration=\thow long to run the stress loop 
(0=indefinitely)"
+);
+
+static int fp_features;
+
+static void *stress_loop(void *arg)
+{
+   struct timespec rqt = {
+   .tv_sec = 0,
+   .tv_nsec = CONFIG_XENO_DEFAULT_PERIOD
+   };
+   
+   for (;;) {
+   fp_regs_set(fp_features, 0xf1f5f1f5);
+   clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL);
+   }
+
+   return NULL;
+}
+
+static int run_fpu_stress(struct smokey_test *t,
+ int argc, char *const argv[])
+{
+   unsigned sleep_ms, n, rounds, duration = 3;
+   struct sched_param param;
+   pthread_attr_t attr;
+   struct timespec rqt;
+   pthread_t tid;
+   int ret;
+
+   fp_features = cobalt_fp_detect();
+   if (fp_features == 0)
+   return -ENOSYS;
+
+   smokey_parse_args(t, argc, argv);
+   
+   if (SMOKEY_ARG_ISSET(fpu_stress, duration))
+   duration = SMOKEY_ARG_INT(fpu_stress, duration);
+   
+   rqt.tv_sec = 0;
+   rqt.tv_nsec = CONFIG_XENO_DEFAULT_PERIOD;
+   sleep_ms = 100UL / rqt.tv_nsec; /* wake up each ms */
+   rounds = duration * 1000UL / sleep_ms;
+
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_JOINABLE);
+   pthread_attr_setinheritsched(, PTHREAD_EXPLICIT_SCHED);
+   pthread_attr_setschedpolicy(, SCHED_FIFO);
+   param.sched_priority = 10;
+   pthread_attr_setschedparam(, );
+   ret = pthread_create(, , stress_loop, NULL);
+   if (ret)
+   return -ret;
+
+   if (rounds)
+   smokey_trace("running for %d seconds", duration);
+   else
+   smokey_trace("running indefinitely...");
+
+   for (n = 0; rounds == 0 || n < rounds; n++) {
+   fp_regs_set(fp_features, n);
+   __STD(clock_nanosleep(CLOCK_MONOTONIC, 0, , NULL));
+   if (fp_regs_check(fp_features, n, smokey_trace) != n) {
+   ret = -EINVAL;
+   break;
+   }
+   }
+
+   pthread_cancel(tid);
+   pthread_join(tid, NULL);
+
+   return ret;
+}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git