summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-11-25 16:53:56 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-12-08 17:25:15 +0100
commit3e9820b82b9968209f2662414b8ec9175f0a0288 (patch)
tree4e9f8fe2b73b8fd2a65a4eaee8a15445fa048595
parent57bfb320b814455fc28fd3c2884da61ece2dae03 (diff)
validation: Performance
-rw-r--r--spec/build/testsuites/validation/grp.yml2
-rw-r--r--spec/build/testsuites/validation/performance-no-clock-0.yml (renamed from spec/build/testsuites/validation/performance-0.yml)4
-rw-r--r--testsuites/validation/tc-barrier-performance.c27
-rw-r--r--testsuites/validation/tc-event-performance.c8
-rw-r--r--testsuites/validation/tc-message-performance.c10
-rw-r--r--testsuites/validation/tc-part-performance.c2
-rw-r--r--testsuites/validation/tc-sem-performance.c10
-rw-r--r--testsuites/validation/tc-task-performance.c81
-rw-r--r--testsuites/validation/ts-performance-no-clock-0.c (renamed from testsuites/validation/ts-performance-0.c)10
9 files changed, 112 insertions, 42 deletions
diff --git a/spec/build/testsuites/validation/grp.yml b/spec/build/testsuites/validation/grp.yml
index c793332cb5..afbb71e25c 100644
--- a/spec/build/testsuites/validation/grp.yml
+++ b/spec/build/testsuites/validation/grp.yml
@@ -41,7 +41,7 @@ links:
- role: build-dependency
uid: fatal-too-large-tls-size
- role: build-dependency
- uid: performance-0
+ uid: performance-no-clock-0
- role: build-dependency
uid: terminate
- role: build-dependency
diff --git a/spec/build/testsuites/validation/performance-0.yml b/spec/build/testsuites/validation/performance-no-clock-0.yml
index 874ad3823c..190b8936a5 100644
--- a/spec/build/testsuites/validation/performance-0.yml
+++ b/spec/build/testsuites/validation/performance-no-clock-0.yml
@@ -17,9 +17,9 @@ source:
- testsuites/validation/tc-part-performance.c
- testsuites/validation/tc-sem-performance.c
- testsuites/validation/tc-task-performance.c
-- testsuites/validation/ts-performance-0.c
+- testsuites/validation/ts-performance-no-clock-0.c
stlib: []
-target: testsuites/validation/ts-performance-0.exe
+target: testsuites/validation/ts-performance-no-clock-0.exe
type: build
use-after:
- validation
diff --git a/testsuites/validation/tc-barrier-performance.c b/testsuites/validation/tc-barrier-performance.c
index 25cc6c9cf6..498d13cb69 100644
--- a/testsuites/validation/tc-barrier-performance.c
+++ b/testsuites/validation/tc-barrier-performance.c
@@ -61,7 +61,7 @@
/**
* @defgroup RTEMSTestCaseRtemsBarrierValPerf spec:/rtems/barrier/val/perf
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*
* @brief This test case provides a context to run @ref RTEMSAPIClassicBarrier
* performance tests.
@@ -265,26 +265,9 @@ static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Prepare(
ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
SetScheduler( ctx->worker_id, SCHEDULER_B_ID, PRIO_NORMAL );
StartTask( ctx->worker_id, BarrierWaitWorker, ctx );
-}
-
-/**
- * @brief Make sure the worker task is fully blocked on the barrier.
- */
-static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Setup(
- RtemsBarrierValPerf_Context *ctx
-)
-{
WaitForNextTask( 1, ctx->worker_id );
}
-static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Setup_Wrap( void *arg )
-{
- RtemsBarrierValPerf_Context *ctx;
-
- ctx = arg;
- RtemsBarrierReqPerfReleaseAutoOtherCpu_Setup( ctx );
-}
-
/**
* @brief Automatically release the barrier.
*/
@@ -305,8 +288,8 @@ static void RtemsBarrierReqPerfReleaseAutoOtherCpu_Body_Wrap( void *arg )
}
/**
- * @brief Set the measured runtime. Discard samples interrupted by a clock
- * tick.
+ * @brief Make sure the worker waits for the next event. Set the measured
+ * runtime. Discard samples interrupted by a clock tick.
*/
static bool RtemsBarrierReqPerfReleaseAutoOtherCpu_Teardown(
RtemsBarrierValPerf_Context *ctx,
@@ -318,6 +301,7 @@ static bool RtemsBarrierReqPerfReleaseAutoOtherCpu_Teardown(
{
T_quiet_rsc_success( ctx->status );
+ WaitForNextTask( 1, ctx->worker_id );
*delta = ctx->end - ctx->begin;
return tic == toc;
@@ -503,6 +487,7 @@ static void RtemsBarrierReqPerfReleaseManualPreempt_Body(
{
uint32_t count;
+ ctx->begin = T_tick();
ctx->status = rtems_barrier_release( ctx->barrier_id, &count );
}
@@ -590,7 +575,7 @@ T_TEST_CASE_FIXTURE( RtemsBarrierValPerf, &RtemsBarrierValPerf_Fixture )
#if defined(RTEMS_SMP)
RtemsBarrierReqPerfReleaseAutoOtherCpu_Prepare( ctx );
ctx->request.name = "RtemsBarrierReqPerfReleaseAutoOtherCpu";
- ctx->request.setup = RtemsBarrierReqPerfReleaseAutoOtherCpu_Setup_Wrap;
+ ctx->request.setup = NULL;
ctx->request.body = RtemsBarrierReqPerfReleaseAutoOtherCpu_Body_Wrap;
ctx->request.teardown = RtemsBarrierReqPerfReleaseAutoOtherCpu_Teardown_Wrap;
T_measure_runtime( ctx->context, &ctx->request );
diff --git a/testsuites/validation/tc-event-performance.c b/testsuites/validation/tc-event-performance.c
index d73ec73f6e..77e690d662 100644
--- a/testsuites/validation/tc-event-performance.c
+++ b/testsuites/validation/tc-event-performance.c
@@ -61,7 +61,7 @@
/**
* @defgroup RTEMSTestCaseRtemsEventValPerf spec:/rtems/event/val/perf
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*
* @brief This test case provides a context to run @ref RTEMSAPIClassicEvent
* performance tests.
@@ -352,8 +352,8 @@ static void RtemsEventReqPerfOtherCpu_Body_Wrap( void *arg )
}
/**
- * @brief Set the measured runtime. Make sure the worker waits for the next
- * event. Discard samples interrupted by a clock tick.
+ * @brief Make sure the worker waits for the next event. Set the measured
+ * runtime. Discard samples interrupted by a clock tick.
*/
static bool RtemsEventReqPerfOtherCpu_Teardown(
RtemsEventValPerf_Context *ctx,
@@ -365,8 +365,8 @@ static bool RtemsEventReqPerfOtherCpu_Teardown(
{
T_quiet_rsc_success( ctx->status );
- *delta = ctx->end - ctx->begin;
WaitForNextTask( 1, ctx->worker_id );
+ *delta = ctx->end - ctx->begin;
return tic == toc;
}
diff --git a/testsuites/validation/tc-message-performance.c b/testsuites/validation/tc-message-performance.c
index cc76217ff9..28fbd585c2 100644
--- a/testsuites/validation/tc-message-performance.c
+++ b/testsuites/validation/tc-message-performance.c
@@ -61,7 +61,7 @@
/**
* @defgroup RTEMSTestCaseRtemsMessageValPerf spec:/rtems/message/val/perf
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*
* @brief This test case provides a context to run @ref RTEMSAPIClassicMessage
* performance tests.
@@ -358,6 +358,7 @@ static void RtemsMessageReqPerfReceiveWaitForever_Body(
uint64_t message;
size_t size;
+ ctx->begin = T_tick();
ctx->status = rtems_message_queue_receive(
ctx->queue_id,
&message,
@@ -444,6 +445,7 @@ static void RtemsMessageReqPerfReceiveWaitTimed_Body(
uint64_t message;
size_t size;
+ ctx->begin = T_tick();
ctx->status = rtems_message_queue_receive(
ctx->queue_id,
&message,
@@ -693,8 +695,8 @@ static void RtemsMessageReqPerfSendOtherCpu_Body_Wrap( void *arg )
}
/**
- * @brief Set the measured runtime. Make sure the worker waits for the next
- * event. Discard samples interrupted by a clock tick.
+ * @brief Make sure the worker waits for the next event. Set the measured
+ * runtime. Discard samples interrupted by a clock tick.
*/
static bool RtemsMessageReqPerfSendOtherCpu_Teardown(
RtemsMessageValPerf_Context *ctx,
@@ -706,8 +708,8 @@ static bool RtemsMessageReqPerfSendOtherCpu_Teardown(
{
T_quiet_rsc_success( ctx->status );
- *delta = ctx->end - ctx->begin;
WaitForNextTask( 1, ctx->worker_id );
+ *delta = ctx->end - ctx->begin;
return tic == toc;
}
diff --git a/testsuites/validation/tc-part-performance.c b/testsuites/validation/tc-part-performance.c
index baaddff06a..474e220f03 100644
--- a/testsuites/validation/tc-part-performance.c
+++ b/testsuites/validation/tc-part-performance.c
@@ -60,7 +60,7 @@
/**
* @defgroup RTEMSTestCaseRtemsPartValPerf spec:/rtems/part/val/perf
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*
* @brief This test case provides a context to run @ref RTEMSAPIClassicPart
* performance tests.
diff --git a/testsuites/validation/tc-sem-performance.c b/testsuites/validation/tc-sem-performance.c
index 7ef4debe30..f59e9d5c23 100644
--- a/testsuites/validation/tc-sem-performance.c
+++ b/testsuites/validation/tc-sem-performance.c
@@ -61,7 +61,7 @@
/**
* @defgroup RTEMSTestCaseRtemsSemValPerf spec:/rtems/sem/val/perf
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*
* @brief This test case provides a context to run @ref RTEMSAPIClassicSem
* performance tests.
@@ -463,6 +463,7 @@ static void RtemsSemReqPerfMtxPiReleaseOtherCpu_Body(
RtemsSemValPerf_Context *ctx
)
{
+ ctx->begin = T_tick();
ctx->status = rtems_semaphore_release( ctx->mutex_id );
}
@@ -475,8 +476,8 @@ static void RtemsSemReqPerfMtxPiReleaseOtherCpu_Body_Wrap( void *arg )
}
/**
- * @brief Set the measured runtime. Make sure the worker waits for the next
- * event. Discard samples interrupted by a clock tick.
+ * @brief Make sure the worker waits for the next event. Set the measured
+ * runtime. Discard samples interrupted by a clock tick.
*/
static bool RtemsSemReqPerfMtxPiReleaseOtherCpu_Teardown(
RtemsSemValPerf_Context *ctx,
@@ -488,8 +489,8 @@ static bool RtemsSemReqPerfMtxPiReleaseOtherCpu_Teardown(
{
T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
- *delta = ctx->end - ctx->begin;
WaitForNextTask( 1, ctx->worker_id );
+ *delta = ctx->end - ctx->begin;
return tic == toc;
}
@@ -551,6 +552,7 @@ static void RtemsSemReqPerfMtxPiReleasePreempt_Body(
RtemsSemValPerf_Context *ctx
)
{
+ ctx->begin = T_tick();
ctx->status = rtems_semaphore_release( ctx->mutex_id );
}
diff --git a/testsuites/validation/tc-task-performance.c b/testsuites/validation/tc-task-performance.c
index f343fc8bec..68037aaf5f 100644
--- a/testsuites/validation/tc-task-performance.c
+++ b/testsuites/validation/tc-task-performance.c
@@ -54,12 +54,15 @@
#include <rtems.h>
+#include "ts-config.h"
+#include "tx-support.h"
+
#include <rtems/test.h>
/**
* @defgroup RTEMSTestCaseRtemsTaskValPerf spec:/rtems/task/val/perf
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*
* @brief This test case provides a context to run @ref RTEMSAPIClassicTasks
* performance tests.
@@ -72,6 +75,11 @@
*/
typedef struct {
/**
+ * @brief This member provides a worker identifier.
+ */
+ rtems_id worker_id;
+
+ /**
* @brief This member provides a status code.
*/
rtems_status_code status;
@@ -100,6 +108,23 @@ typedef struct {
static RtemsTaskValPerf_Context
RtemsTaskValPerf_Instance;
+RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char task_storage[
+ RTEMS_TASK_STORAGE_SIZE(
+ TEST_MAXIMUM_TLS_SIZE + TEST_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_ATTRIBUTES
+ )
+];
+
+static const rtems_task_config config = {
+ .name = OBJECT_NAME,
+ .initial_priority = PRIO_NORMAL,
+ .storage_area = task_storage,
+ .storage_size = sizeof( task_storage ),
+ .maximum_thread_local_storage_size = 0,
+ .initial_modes = RTEMS_DEFAULT_MODES,
+ .attributes = RTEMS_DEFAULT_ATTRIBUTES
+};
+
static void RtemsTaskValPerf_Setup_Context( RtemsTaskValPerf_Context *ctx )
{
T_measure_runtime_config config;
@@ -129,6 +154,54 @@ static T_fixture RtemsTaskValPerf_Fixture = {
};
/**
+ * @brief Construct a task.
+ */
+static void RtemsTaskReqPerfConstruct_Body( RtemsTaskValPerf_Context *ctx )
+{
+ ctx->status = rtems_task_construct( &config, &ctx->worker_id );
+}
+
+static void RtemsTaskReqPerfConstruct_Body_Wrap( void *arg )
+{
+ RtemsTaskValPerf_Context *ctx;
+
+ ctx = arg;
+ RtemsTaskReqPerfConstruct_Body( ctx );
+}
+
+/**
+ * @brief Delete the worker. Discard samples interrupted by a clock tick.
+ */
+static bool RtemsTaskReqPerfConstruct_Teardown(
+ RtemsTaskValPerf_Context *ctx,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ T_quiet_rsc_success( ctx->status );
+
+ DeleteTask( ctx->worker_id );
+
+ return tic == toc;
+}
+
+static bool RtemsTaskReqPerfConstruct_Teardown_Wrap(
+ void *arg,
+ T_ticks *delta,
+ uint32_t tic,
+ uint32_t toc,
+ unsigned int retry
+)
+{
+ RtemsTaskValPerf_Context *ctx;
+
+ ctx = arg;
+ return RtemsTaskReqPerfConstruct_Teardown( ctx, delta, tic, toc, retry );
+}
+
+/**
* @fn void T_case_body_RtemsTaskValPerf( void )
*/
T_TEST_CASE_FIXTURE( RtemsTaskValPerf, &RtemsTaskValPerf_Fixture )
@@ -136,6 +209,12 @@ T_TEST_CASE_FIXTURE( RtemsTaskValPerf, &RtemsTaskValPerf_Fixture )
RtemsTaskValPerf_Context *ctx;
ctx = T_fixture_context();
+
+ ctx->request.name = "RtemsTaskReqPerfConstruct";
+ ctx->request.setup = NULL;
+ ctx->request.body = RtemsTaskReqPerfConstruct_Body_Wrap;
+ ctx->request.teardown = RtemsTaskReqPerfConstruct_Teardown_Wrap;
+ T_measure_runtime( ctx->context, &ctx->request );
}
/** @} */
diff --git a/testsuites/validation/ts-performance-0.c b/testsuites/validation/ts-performance-no-clock-0.c
index 2c35a4d7c2..e43b3a6327 100644
--- a/testsuites/validation/ts-performance-0.c
+++ b/testsuites/validation/ts-performance-no-clock-0.c
@@ -3,7 +3,7 @@
/**
* @file
*
- * @ingroup RTEMSTestSuiteTestsuitesPerformance0
+ * @ingroup RTEMSTestSuiteTestsuitesPerformanceNoClock0
*/
/*
@@ -57,8 +57,8 @@
#include <rtems/test.h>
/**
- * @defgroup RTEMSTestSuiteTestsuitesPerformance0 \
- * spec:/testsuites/performance-0
+ * @defgroup RTEMSTestSuiteTestsuitesPerformanceNoClock0 \
+ * spec:/testsuites/performance-no-clock-0
*
* @ingroup RTEMSTestSuites
*
@@ -71,10 +71,12 @@
* @{
*/
-const char rtems_test_name[] = "Performance0";
+const char rtems_test_name[] = "PerformanceNoClock0";
#define CONFIGURE_MAXIMUM_PROCESSORS 4
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
#include "ts-default.h"
/** @} */