[PATCH 11/11] smptests/smpload01: New test

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Mar 10 13:28:33 UTC 2014


---
 testsuites/smptests/Makefile.am             |    1 +
 testsuites/smptests/configure.ac            |    1 +
 testsuites/smptests/smpload01/Makefile.am   |   19 +++
 testsuites/smptests/smpload01/init.c        |  137 +++++++++++++++++++++++
 testsuites/smptests/smpload01/smpload01.doc |   13 ++
 testsuites/smptests/smpload01/smpload01.scn |  160 +++++++++++++++++++++++++++
 6 files changed, 331 insertions(+), 0 deletions(-)
 create mode 100644 testsuites/smptests/smpload01/Makefile.am
 create mode 100644 testsuites/smptests/smpload01/init.c
 create mode 100644 testsuites/smptests/smpload01/smpload01.doc
 create mode 100644 testsuites/smptests/smpload01/smpload01.scn

diff --git a/testsuites/smptests/Makefile.am b/testsuites/smptests/Makefile.am
index 1f4b0b3..c7fa028 100644
--- a/testsuites/smptests/Makefile.am
+++ b/testsuites/smptests/Makefile.am
@@ -1,6 +1,7 @@
 ACLOCAL_AMFLAGS = -I ../aclocal
 
 SUBDIRS =
+SUBDIRS += smpload01
 
 if SMPTESTS
 SUBDIRS += smp01
diff --git a/testsuites/smptests/configure.ac b/testsuites/smptests/configure.ac
index a2e99eb..0d08f0d 100644
--- a/testsuites/smptests/configure.ac
+++ b/testsuites/smptests/configure.ac
@@ -57,6 +57,7 @@ AM_CONDITIONAL(HAS_CPUSET,test x"${ac_cv_header_sys_cpuset_h}" = x"yes")
 
 # Explicitly list all Makefiles here
 AC_CONFIG_FILES([Makefile
+smpload01/Makefile
 smp01/Makefile
 smp02/Makefile
 smp03/Makefile
diff --git a/testsuites/smptests/smpload01/Makefile.am b/testsuites/smptests/smpload01/Makefile.am
new file mode 100644
index 0000000..7e41337
--- /dev/null
+++ b/testsuites/smptests/smpload01/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = smpload01
+smpload01_SOURCES = init.c
+
+dist_rtems_tests_DATA = smpload01.scn smpload01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(smpload01_OBJECTS)
+LINK_LIBS = $(smpload01_LDLIBS)
+
+smpload01$(EXEEXT): $(smpload01_OBJECTS) $(smpload01_DEPENDENCIES)
+	@rm -f smpload01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/smptests/smpload01/init.c b/testsuites/smptests/smpload01/init.c
new file mode 100644
index 0000000..b33dd63
--- /dev/null
+++ b/testsuites/smptests/smpload01/init.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include "tmacros.h"
+
+#include <rtems.h>
+#include <rtems/profiling.h>
+
+#define CPU_COUNT 32
+
+struct {
+  rtems_id sema_prio_inherit;
+  rtems_id sema_prio_ceiling;
+} test_context;
+
+static uint32_t simple_random(uint32_t v)
+{
+	v *= 1664525;
+	v += 1013904223;
+
+	return v;
+}
+
+static void worker_task(rtems_task_argument arg)
+{
+  uint32_t v = arg;
+
+  while (true) {
+    rtems_status_code sc;
+    rtems_id id;
+
+    v = simple_random(v);
+
+    if ((v & 0x80000000) != 0) {
+      id = test_context.sema_prio_inherit;
+    } else {
+      id = test_context.sema_prio_ceiling;
+    }
+
+    sc = rtems_semaphore_obtain(id, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
+    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+    sc = rtems_task_wake_after(1);
+    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+    sc = rtems_semaphore_release(id);
+    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+  }
+}
+
+static void test(void)
+{
+  uint32_t n = 3 * rtems_smp_get_processor_count();
+  uint32_t i;
+  rtems_status_code sc;
+  rtems_id id;
+
+  sc = rtems_semaphore_create(
+    rtems_build_name('I', 'N', 'H', 'R'),
+    1,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY,
+    0,
+    &test_context.sema_prio_inherit
+  );
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+  sc = rtems_semaphore_create(
+    rtems_build_name('C', 'E', 'I', 'L'),
+    1,
+    RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_PRIORITY_CEILING,
+    2,
+    &test_context.sema_prio_ceiling
+  );
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+  for (i = 0; i < n; ++i) {
+    sc = rtems_task_create(
+      rtems_build_name('W', 'O', 'R', 'K'),
+      3 + i,
+      RTEMS_MINIMUM_STACK_SIZE,
+      RTEMS_DEFAULT_MODES,
+      RTEMS_DEFAULT_ATTRIBUTES,
+      &id
+    );
+    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+    sc = rtems_task_start(id, worker_task, i);
+    rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+  }
+
+  sc = rtems_task_wake_after(10 * rtems_clock_get_ticks_per_second());
+  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
+
+  rtems_profiling_report_xml("SMPLOAD 1", rtems_printf_plugin, NULL, 1, "  ");
+}
+
+static void Init(rtems_task_argument arg)
+{
+  puts("\n\n*** TEST SMPLOAD 1 ***");
+
+  test();
+
+  puts("*** END OF TEST SMPLOAD 1 ***");
+
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_SMP_APPLICATION
+
+#define CONFIGURE_SMP_MAXIMUM_PROCESSORS CPU_COUNT
+
+#define CONFIGURE_MAXIMUM_TASKS (1 + 3 * CPU_COUNT)
+#define CONFIGURE_MAXIMUM_SEMAPHORES 2
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/smptests/smpload01/smpload01.doc b/testsuites/smptests/smpload01/smpload01.doc
new file mode 100644
index 0000000..9777502
--- /dev/null
+++ b/testsuites/smptests/smpload01/smpload01.doc
@@ -0,0 +1,13 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: smpload01
+
+directives:
+
+  - rtems_semaphore_obtain()
+  - rtems_semaphore_release()
+  - rtems_profiling_report_xml()
+
+concepts:
+
+  - Produce some system load to get profiling data samples.
diff --git a/testsuites/smptests/smpload01/smpload01.scn b/testsuites/smptests/smpload01/smpload01.scn
new file mode 100644
index 0000000..901ef48
--- /dev/null
+++ b/testsuites/smptests/smpload01/smpload01.scn
@@ -0,0 +1,160 @@
+*** TEST SMPLOAD 1 ***
+  <ProfilingReport name="SMPLOAD 1">
+    <PerCPUProfilingReport processorIndex="0">
+      <MaxThreadDispatchDisabledTime unit="ns">74045</MaxThreadDispatchDisabledTime>
+      <ThreadDispatchDisabledCount>4623</ThreadDispatchDisabledCount>
+      <TotalThreadDispatchDisabledTime unit="ns">150714575</TotalThreadDispatchDisabledTime>
+      <MaxInterruptTime unit="ns">148430</MaxInterruptTime>
+      <MaxInterruptDelay unit="ns">9340</MaxInterruptDelay>
+      <InterruptCount>1224</InterruptCount>
+      <TotalInterruptTime unit="ns">85229435</TotalInterruptTime>
+    </PerCPUProfilingReport>
+    <PerCPUProfilingReport processorIndex="1">
+      <MaxThreadDispatchDisabledTime unit="ns">125580</MaxThreadDispatchDisabledTime>
+      <ThreadDispatchDisabledCount>3617</ThreadDispatchDisabledCount>
+      <TotalThreadDispatchDisabledTime unit="ns">116537550</TotalThreadDispatchDisabledTime>
+      <MaxInterruptTime unit="ns">7005</MaxInterruptTime>
+      <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
+      <InterruptCount>890</InterruptCount>
+      <TotalInterruptTime unit="ns">3334960</TotalInterruptTime>
+    </PerCPUProfilingReport>
+    <PerCPUProfilingReport processorIndex="2">
+      <MaxThreadDispatchDisabledTime unit="ns">103430</MaxThreadDispatchDisabledTime>
+      <ThreadDispatchDisabledCount>3627</ThreadDispatchDisabledCount>
+      <TotalThreadDispatchDisabledTime unit="ns">118006025</TotalThreadDispatchDisabledTime>
+      <MaxInterruptTime unit="ns">7585</MaxInterruptTime>
+      <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
+      <InterruptCount>958</InterruptCount>
+      <TotalInterruptTime unit="ns">3393735</TotalInterruptTime>
+    </PerCPUProfilingReport>
+    <PerCPUProfilingReport processorIndex="3">
+      <MaxThreadDispatchDisabledTime unit="ns">205635</MaxThreadDispatchDisabledTime>
+      <ThreadDispatchDisabledCount>3802</ThreadDispatchDisabledCount>
+      <TotalThreadDispatchDisabledTime unit="ns">117862825</TotalThreadDispatchDisabledTime>
+      <MaxInterruptTime unit="ns">10530</MaxInterruptTime>
+      <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
+      <InterruptCount>875</InterruptCount>
+      <TotalInterruptTime unit="ns">3463700</TotalInterruptTime>
+    </PerCPUProfilingReport>
+    <SMPLockProfilingReport name="SMP lock stats">
+      <MaxSectionTime unit="ns">18200</MaxSectionTime>
+      <MaxAcquireTime unit="ns">7795</MaxAcquireTime>
+      <UsageCount>13</UsageCount>
+      <TotalSectionTime unit="ns">58680</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">13</ContentionCount>
+      <ContentionCount initialQueueLength="1">0</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="LEON3 IrqCtrl">
+      <MaxSectionTime unit="ns">3770</MaxSectionTime>
+      <MaxAcquireTime unit="ns">2525</MaxAcquireTime>
+      <UsageCount>3</UsageCount>
+      <TotalSectionTime unit="ns">11275</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">3</ContentionCount>
+      <ContentionCount initialQueueLength="1">0</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="per-CPU state">
+      <MaxSectionTime unit="ns">16100</MaxSectionTime>
+      <MaxAcquireTime unit="ns">63635</MaxAcquireTime>
+      <UsageCount>12</UsageCount>
+      <TotalSectionTime unit="ns">77005</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">7</ContentionCount>
+      <ContentionCount initialQueueLength="1">4</ContentionCount>
+      <ContentionCount initialQueueLength="2">1</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="per-CPU">
+      <MaxSectionTime unit="ns">76675</MaxSectionTime>
+      <MaxAcquireTime unit="ns">19785</MaxAcquireTime>
+      <UsageCount>5807</UsageCount>
+      <TotalSectionTime unit="ns">79800345</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">5310</ContentionCount>
+      <ContentionCount initialQueueLength="1">497</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="per-CPU">
+      <MaxSectionTime unit="ns">136635</MaxSectionTime>
+      <MaxAcquireTime unit="ns">35115</MaxAcquireTime>
+      <UsageCount>5008</UsageCount>
+      <TotalSectionTime unit="ns">67661840</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">4444</ContentionCount>
+      <ContentionCount initialQueueLength="1">564</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="per-CPU">
+      <MaxSectionTime unit="ns">79230</MaxSectionTime>
+      <MaxAcquireTime unit="ns">18320</MaxAcquireTime>
+      <UsageCount>5674</UsageCount>
+      <TotalSectionTime unit="ns">76243665</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">5168</ContentionCount>
+      <ContentionCount initialQueueLength="1">506</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="per-CPU">
+      <MaxSectionTime unit="ns">89215</MaxSectionTime>
+      <MaxAcquireTime unit="ns">19530</MaxAcquireTime>
+      <UsageCount>4226</UsageCount>
+      <TotalSectionTime unit="ns">49347540</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">3521</ContentionCount>
+      <ContentionCount initialQueueLength="1">705</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="Giant">
+      <MaxSectionTime unit="ns">233360</MaxSectionTime>
+      <MaxAcquireTime unit="ns">192160</MaxAcquireTime>
+      <UsageCount>9281</UsageCount>
+      <TotalSectionTime unit="ns">464815740</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">2480</ContentionCount>
+      <ContentionCount initialQueueLength="1">3893</ContentionCount>
+      <ContentionCount initialQueueLength="2">2201</ContentionCount>
+      <ContentionCount initialQueueLength="3">707</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="chains">
+      <MaxSectionTime unit="ns">10750</MaxSectionTime>
+      <MaxAcquireTime unit="ns">4175</MaxAcquireTime>
+      <UsageCount>12</UsageCount>
+      <TotalSectionTime unit="ns">34130</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">12</ContentionCount>
+      <ContentionCount initialQueueLength="1">0</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="TOD">
+      <MaxSectionTime unit="ns">15985</MaxSectionTime>
+      <MaxAcquireTime unit="ns">7080</MaxAcquireTime>
+      <UsageCount>11335</UsageCount>
+      <TotalSectionTime unit="ns">37367415</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">11270</ContentionCount>
+      <ContentionCount initialQueueLength="1">65</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="mount table entry">
+      <MaxSectionTime unit="ns">4780</MaxSectionTime>
+      <MaxAcquireTime unit="ns">2680</MaxAcquireTime>
+      <UsageCount>43</UsageCount>
+      <TotalSectionTime unit="ns">75125</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">43</ContentionCount>
+      <ContentionCount initialQueueLength="1">0</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+    <SMPLockProfilingReport name="constructor">
+      <MaxSectionTime unit="ns">11910</MaxSectionTime>
+      <MaxAcquireTime unit="ns">9110</MaxAcquireTime>
+      <UsageCount>1</UsageCount>
+      <TotalSectionTime unit="ns">11910</TotalSectionTime>
+      <ContentionCount initialQueueLength="0">1</ContentionCount>
+      <ContentionCount initialQueueLength="1">0</ContentionCount>
+      <ContentionCount initialQueueLength="2">0</ContentionCount>
+      <ContentionCount initialQueueLength="3">0</ContentionCount>
+    </SMPLockProfilingReport>
+  </ProfilingReport>
+*** END OF TEST SMPLOAD 1 ***
-- 
1.7.7




More information about the devel mailing list