[rtems commit] smptests/smpload01: New test
Sebastian Huber
sebh at rtems.org
Fri Mar 14 07:42:47 UTC 2014
Module: rtems
Branch: master
Commit: 4575ae0a40c3dcd7a03b52d93d0d3a2adb2b154c
Changeset: http://git.rtems.org/rtems/commit/?id=4575ae0a40c3dcd7a03b52d93d0d3a2adb2b154c
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Mar 10 13:39:31 2014 +0100
smptests/smpload01: New test
---
testsuites/smptests/Makefile.am | 1 +
testsuites/smptests/configure.ac | 1 +
testsuites/smptests/smpload01/Makefile.am | 19 +++
testsuites/smptests/smpload01/init.c | 138 +++++++++++++++++++++
testsuites/smptests/smpload01/smpload01.doc | 13 ++
testsuites/smptests/smpload01/smpload01.scn | 172 +++++++++++++++++++++++++++
6 files changed, 344 insertions(+), 0 deletions(-)
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..c7bfb37
--- /dev/null
+++ b/testsuites/smptests/smpload01/init.c
@@ -0,0 +1,138 @@
+/*
+ * 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
+
+#define WORKER_COUNT (3 * CPU_COUNT)
+
+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 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 < WORKER_COUNT; ++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 + WORKER_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..b97c719
--- /dev/null
+++ b/testsuites/smptests/smpload01/smpload01.scn
@@ -0,0 +1,172 @@
+*** TEST SMPLOAD 1 ***
+ <ProfilingReport name="SMPLOAD 1">
+ <PerCPUProfilingReport processorIndex="0">
+ <MaxThreadDispatchDisabledTime unit="ns">110405</MaxThreadDispatchDisabledTime>
+ <ThreadDispatchDisabledCount>5165</ThreadDispatchDisabledCount>
+ <TotalThreadDispatchDisabledTime unit="ns">170810415</TotalThreadDispatchDisabledTime>
+ <MaxInterruptTime unit="ns">215600</MaxInterruptTime>
+ <MaxInterruptDelay unit="ns">78390</MaxInterruptDelay>
+ <InterruptCount>1061</InterruptCount>
+ <TotalInterruptTime unit="ns">89412555</TotalInterruptTime>
+ </PerCPUProfilingReport>
+ <PerCPUProfilingReport processorIndex="1">
+ <MaxThreadDispatchDisabledTime unit="ns">132930</MaxThreadDispatchDisabledTime>
+ <ThreadDispatchDisabledCount>4105</ThreadDispatchDisabledCount>
+ <TotalThreadDispatchDisabledTime unit="ns">142276895</TotalThreadDispatchDisabledTime>
+ <MaxInterruptTime unit="ns">8030</MaxInterruptTime>
+ <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
+ <InterruptCount>1029</InterruptCount>
+ <TotalInterruptTime unit="ns">3350735</TotalInterruptTime>
+ </PerCPUProfilingReport>
+ <PerCPUProfilingReport processorIndex="2">
+ <MaxThreadDispatchDisabledTime unit="ns">96015</MaxThreadDispatchDisabledTime>
+ <ThreadDispatchDisabledCount>4086</ThreadDispatchDisabledCount>
+ <TotalThreadDispatchDisabledTime unit="ns">138497785</TotalThreadDispatchDisabledTime>
+ <MaxInterruptTime unit="ns">8645</MaxInterruptTime>
+ <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
+ <InterruptCount>1025</InterruptCount>
+ <TotalInterruptTime unit="ns">3154355</TotalInterruptTime>
+ </PerCPUProfilingReport>
+ <PerCPUProfilingReport processorIndex="3">
+ <MaxThreadDispatchDisabledTime unit="ns">207895</MaxThreadDispatchDisabledTime>
+ <ThreadDispatchDisabledCount>4143</ThreadDispatchDisabledCount>
+ <TotalThreadDispatchDisabledTime unit="ns">151584650</TotalThreadDispatchDisabledTime>
+ <MaxInterruptTime unit="ns">11145</MaxInterruptTime>
+ <MaxInterruptDelay unit="ns">0</MaxInterruptDelay>
+ <InterruptCount>1122</InterruptCount>
+ <TotalInterruptTime unit="ns">2717540</TotalInterruptTime>
+ </PerCPUProfilingReport>
+ <SMPLockProfilingReport name="SMP lock stats">
+ <MaxAcquireTime unit="ns">7415</MaxAcquireTime>
+ <MaxSectionTime unit="ns">19980</MaxSectionTime>
+ <UsageCount>13</UsageCount>
+ <TotalAcquireTime unit="ns">29500</TotalAcquireTime>
+ <TotalSectionTime unit="ns">63445</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">
+ <MaxAcquireTime unit="ns">2080</MaxAcquireTime>
+ <MaxSectionTime unit="ns">5300</MaxSectionTime>
+ <UsageCount>3</UsageCount>
+ <TotalAcquireTime unit="ns">5810</TotalAcquireTime>
+ <TotalSectionTime unit="ns">14905</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">
+ <MaxAcquireTime unit="ns">66395</MaxAcquireTime>
+ <MaxSectionTime unit="ns">16045</MaxSectionTime>
+ <UsageCount>12</UsageCount>
+ <TotalAcquireTime unit="ns">169185</TotalAcquireTime>
+ <TotalSectionTime unit="ns">84470</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">
+ <MaxAcquireTime unit="ns">27355</MaxAcquireTime>
+ <MaxSectionTime unit="ns">81595</MaxSectionTime>
+ <UsageCount>6526</UsageCount>
+ <TotalAcquireTime unit="ns">16099290</TotalAcquireTime>
+ <TotalSectionTime unit="ns">89849335</TotalSectionTime>
+ <ContentionCount initialQueueLength="0">5922</ContentionCount>
+ <ContentionCount initialQueueLength="1">604</ContentionCount>
+ <ContentionCount initialQueueLength="2">0</ContentionCount>
+ <ContentionCount initialQueueLength="3">0</ContentionCount>
+ </SMPLockProfilingReport>
+ <SMPLockProfilingReport name="per-CPU">
+ <MaxAcquireTime unit="ns">36025</MaxAcquireTime>
+ <MaxSectionTime unit="ns">146465</MaxSectionTime>
+ <UsageCount>5552</UsageCount>
+ <TotalAcquireTime unit="ns">22070045</TotalAcquireTime>
+ <TotalSectionTime unit="ns">74385305</TotalSectionTime>
+ <ContentionCount initialQueueLength="0">4629</ContentionCount>
+ <ContentionCount initialQueueLength="1">923</ContentionCount>
+ <ContentionCount initialQueueLength="2">0</ContentionCount>
+ <ContentionCount initialQueueLength="3">0</ContentionCount>
+ </SMPLockProfilingReport>
+ <SMPLockProfilingReport name="per-CPU">
+ <MaxAcquireTime unit="ns">16895</MaxAcquireTime>
+ <MaxSectionTime unit="ns">83280</MaxSectionTime>
+ <UsageCount>4728</UsageCount>
+ <TotalAcquireTime unit="ns">18585920</TotalAcquireTime>
+ <TotalSectionTime unit="ns">59083815</TotalSectionTime>
+ <ContentionCount initialQueueLength="0">3868</ContentionCount>
+ <ContentionCount initialQueueLength="1">860</ContentionCount>
+ <ContentionCount initialQueueLength="2">0</ContentionCount>
+ <ContentionCount initialQueueLength="3">0</ContentionCount>
+ </SMPLockProfilingReport>
+ <SMPLockProfilingReport name="per-CPU">
+ <MaxAcquireTime unit="ns">26365</MaxAcquireTime>
+ <MaxSectionTime unit="ns">94130</MaxSectionTime>
+ <UsageCount>6506</UsageCount>
+ <TotalAcquireTime unit="ns">17592735</TotalAcquireTime>
+ <TotalSectionTime unit="ns">92991200</TotalSectionTime>
+ <ContentionCount initialQueueLength="0">6170</ContentionCount>
+ <ContentionCount initialQueueLength="1">336</ContentionCount>
+ <ContentionCount initialQueueLength="2">0</ContentionCount>
+ <ContentionCount initialQueueLength="3">0</ContentionCount>
+ </SMPLockProfilingReport>
+ <SMPLockProfilingReport name="Giant">
+ <MaxAcquireTime unit="ns">245180</MaxAcquireTime>
+ <MaxSectionTime unit="ns">232130</MaxSectionTime>
+ <UsageCount>10102</UsageCount>
+ <TotalAcquireTime unit="ns">416556635</TotalAcquireTime>
+ <TotalSectionTime unit="ns">529718895</TotalSectionTime>
+ <ContentionCount initialQueueLength="0">1950</ContentionCount>
+ <ContentionCount initialQueueLength="1">4735</ContentionCount>
+ <ContentionCount initialQueueLength="2">2441</ContentionCount>
+ <ContentionCount initialQueueLength="3">976</ContentionCount>
+ </SMPLockProfilingReport>
+ <SMPLockProfilingReport name="chains">
+ <MaxAcquireTime unit="ns">7555</MaxAcquireTime>
+ <MaxSectionTime unit="ns">8805</MaxSectionTime>
+ <UsageCount>12</UsageCount>
+ <TotalAcquireTime unit="ns">24785</TotalAcquireTime>
+ <TotalSectionTime unit="ns">28550</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">
+ <MaxAcquireTime unit="ns">8400</MaxAcquireTime>
+ <MaxSectionTime unit="ns">18135</MaxSectionTime>
+ <UsageCount>12736</UsageCount>
+ <TotalAcquireTime unit="ns">36411665</TotalAcquireTime>
+ <TotalSectionTime unit="ns">51414560</TotalSectionTime>
+ <ContentionCount initialQueueLength="0">12728</ContentionCount>
+ <ContentionCount initialQueueLength="1">8</ContentionCount>
+ <ContentionCount initialQueueLength="2">0</ContentionCount>
+ <ContentionCount initialQueueLength="3">0</ContentionCount>
+ </SMPLockProfilingReport>
+ <SMPLockProfilingReport name="mount table entry">
+ <MaxAcquireTime unit="ns">2940</MaxAcquireTime>
+ <MaxSectionTime unit="ns">4835</MaxSectionTime>
+ <UsageCount>43</UsageCount>
+ <TotalAcquireTime unit="ns">74160</TotalAcquireTime>
+ <TotalSectionTime unit="ns">86065</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">
+ <MaxAcquireTime unit="ns">9740</MaxAcquireTime>
+ <MaxSectionTime unit="ns">15735</MaxSectionTime>
+ <UsageCount>1</UsageCount>
+ <TotalAcquireTime unit="ns">9740</TotalAcquireTime>
+ <TotalSectionTime unit="ns">15735</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 ***
More information about the vc
mailing list