[rtems-central commit] spec: Add performance requirements

Sebastian Huber sebh at rtems.org
Thu Nov 25 08:20:28 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    79cc48142011d5a9c362e41a715d75c70a9cd29f
Changeset: http://git.rtems.org/rtems-central/commit/?id=79cc48142011d5a9c362e41a715d75c70a9cd29f

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Nov 24 15:33:17 2021 +0100

spec: Add performance requirements

---

 .../barrier/req/perf-release-auto-other-cpu.yml    |  78 +++++++++++++
 spec/rtems/barrier/req/perf-release-auto.yml       |  60 ++++++++++
 .../barrier/req/perf-release-manual-preempt.yml    |  76 +++++++++++++
 spec/rtems/barrier/req/perf-release-manual.yml     |  75 +++++++++++++
 spec/rtems/barrier/req/perf-runtime.yml            |  14 +++
 spec/rtems/barrier/val/perf.yml                    |  58 ++++++++++
 spec/rtems/event/req/perf-runtime.yml              |  14 +++
 spec/rtems/event/val/perf.yml                      |  31 ++++++
 spec/rtems/message/req/perf-runtime.yml            |  14 +++
 spec/rtems/message/val/perf.yml                    |  31 ++++++
 spec/rtems/part/val/perf.yml                       |   3 +-
 spec/rtems/sem/req/perf-mtx-pi-obtain.yml          |  45 ++++++++
 spec/rtems/sem/req/perf-mtx-pi-release-one.yml     |  50 +++++++++
 .../sem/req/perf-mtx-pi-release-other-cpu.yml      |  66 +++++++++++
 spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml |  52 +++++++++
 spec/rtems/sem/req/perf-mtx-pi-release.yml         |  44 ++++++++
 spec/rtems/sem/req/perf-mtx-pi-try.yml             |  49 +++++++++
 spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml    |  60 ++++++++++
 spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml      |  60 ++++++++++
 spec/rtems/sem/req/perf-runtime.yml                |  14 +++
 spec/rtems/sem/val/perf.yml                        | 121 +++++++++++++++++++++
 spec/rtems/task/req/perf-runtime.yml               |  14 +++
 spec/rtems/task/val/perf.yml                       |  31 ++++++
 spec/testsuites/performance-0.yml                  |   2 +
 24 files changed, 1061 insertions(+), 1 deletion(-)

diff --git a/spec/rtems/barrier/req/perf-release-auto-other-cpu.yml b/spec/rtems/barrier/req/perf-release-auto-other-cpu.yml
new file mode 100644
index 0000000..98c74fe
--- /dev/null
+++ b/spec/rtems/barrier/req/perf-release-auto-other-cpu.yml
@@ -0,0 +1,78 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Automatically release the barrier.
+  code: |
+    ctx->begin = T_tick();
+    ctx->status = rtems_barrier_wait( ctx->barrier_id, RTEMS_NO_TIMEOUT );
+  description: null
+test-cleanup:
+  brief: |
+    Delete the barrier and the worker.
+  code: |
+    rtems_status_code sc;
+
+    DeleteTask( ctx->worker_id );
+
+    sc = rtems_barrier_delete( ctx->barrier_id );
+    T_rsc_success( sc );
+  description: null
+test-prepare:
+  brief: |
+    Create an automatic release barrier.  Create and start a worker task.
+  code: |
+    rtems_status_code sc;
+
+    sc = rtems_barrier_create(
+      OBJECT_NAME,
+      RTEMS_BARRIER_AUTOMATIC_RELEASE,
+      2,
+      &ctx->barrier_id
+    );
+    T_rsc_success( sc );
+
+    ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
+    SetScheduler( ctx->worker_id, SCHEDULER_B_ID, PRIO_NORMAL );
+    StartTask( ctx->worker_id, BarrierWaitWorker, ctx );
+  description: null
+test-setup:
+  brief: |
+    Make sure the worker task is fully blocked on the barrier.
+  code: |
+    WaitForNextTask( 1, ctx->worker_id );
+  description: null
+test-teardown:
+  brief: |
+    Set the measured runtime.  Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc_success( ctx->status );
+
+    *delta = ctx->end - ctx->begin;
+
+    return tic == toc;
+  description: null
+text: |
+  Let ``U` and `V`` be two tasks with distinct home schedulers.  Let :math:`B`
+  be a time point measured by ``U`` right before a call to ${../if/wait:/name}
+  which automaticall releases the barrier.  Let :math:`E` be a time point
+  measured by ``V`` right after a call to ${../if/wait:/name} returns
+  successfully due to the ${../if/wait:/name} call associated with :math:`B`.
+  While the execution environment is ${.:/environment}, while the barrier is an
+  automatic release barrier, while the measurement sample is :math:`E - B`,
+  when exactly ${../val/perf:/params/sample-count} samples are collected, the
+  ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/barrier/req/perf-release-auto.yml b/spec/rtems/barrier/req/perf-release-auto.yml
new file mode 100644
index 0000000..b1f79c3
--- /dev/null
+++ b/spec/rtems/barrier/req/perf-release-auto.yml
@@ -0,0 +1,60 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Automatically release the barrier.
+  code: |
+    ctx->status = rtems_barrier_wait( ctx->barrier_id, RTEMS_NO_TIMEOUT );
+  description: null
+test-cleanup:
+  brief: |
+    Delete the barrier and the worker.
+  code: |
+    rtems_status_code sc;
+
+    sc = rtems_barrier_delete( ctx->barrier_id );
+    T_rsc_success( sc );
+  description: null
+test-prepare:
+  brief: |
+    Create an automatic release barrier.
+  code: |
+    rtems_status_code sc;
+
+    sc = rtems_barrier_create(
+      OBJECT_NAME,
+      RTEMS_BARRIER_AUTOMATIC_RELEASE,
+      1,
+      &ctx->barrier_id
+    );
+    T_rsc_success( sc );
+  description: null
+test-setup: null
+test-teardown:
+  brief: |
+    Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc_success( ctx->status );
+
+    return tic == toc;
+  description: null
+text: |
+  While the execution environment is ${.:/environment}, while the barrier is an
+  automatic release barrier, while the measurement sample is the runtime of
+  exactly one successful call to ${../if/wait:/name} which automatically
+  releases the barrier, when exactly ${../val/perf:/params/sample-count}
+  samples are collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/barrier/req/perf-release-manual-preempt.yml b/spec/rtems/barrier/req/perf-release-manual-preempt.yml
new file mode 100644
index 0000000..d59bb9e
--- /dev/null
+++ b/spec/rtems/barrier/req/perf-release-manual-preempt.yml
@@ -0,0 +1,76 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Release the barrier.
+  code: |
+    uint32_t count;
+
+    ctx->status = rtems_barrier_release( ctx->barrier_id, &count );
+  description: null
+test-cleanup:
+  brief: |
+    Delete the barrier and the worker.
+  code: |
+    rtems_status_code sc;
+
+    DeleteTask( ctx->worker_id );
+
+    sc = rtems_barrier_delete( ctx->barrier_id );
+    T_rsc_success( sc );
+
+    RestoreRunnerPriority();
+  description: null
+test-prepare:
+  brief: |
+    Create a manual release barrier.  Create and start a worker task.
+  code: |
+    rtems_status_code sc;
+
+    sc = rtems_barrier_create(
+      OBJECT_NAME,
+      RTEMS_BARRIER_MANUAL_RELEASE,
+      0,
+      &ctx->barrier_id
+    );
+    T_rsc_success( sc );
+
+    SetSelfPriority( PRIO_NORMAL );
+    ctx->worker_id = CreateTask( "WORK", PRIO_HIGH );
+    StartTask( ctx->worker_id, BarrierWaitWorker, ctx );
+  description: null
+test-setup: null
+test-teardown:
+  brief: |
+    Set the measured runtime.  Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc_success( ctx->status );
+
+    *delta = ctx->end - ctx->begin;
+
+    return tic == toc;
+  description: null
+text: |
+  Let ``U` and `V`` be two tasks with the same home scheduler.  Let :math:`B`
+  be a time point measured by ``U`` right before a call to
+  ${../if/release:/name} which preempts the caller.  Let :math:`E` be a time
+  point measured by ``V`` right after a call to ${../if/wait:/name} returns
+  successfully due to the ${../if/release:/name} call associated with
+  :math:`B`.  While the execution environment is ${.:/environment}, while the
+  barrier is a manual release barrier, while the measurement sample is :math:`E
+  - B`, when exactly ${../val/perf:/params/sample-count} samples are collected,
+  the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/barrier/req/perf-release-manual.yml b/spec/rtems/barrier/req/perf-release-manual.yml
new file mode 100644
index 0000000..886797d
--- /dev/null
+++ b/spec/rtems/barrier/req/perf-release-manual.yml
@@ -0,0 +1,75 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Release the barrier.
+  code: |
+    uint32_t count;
+
+    ctx->status = rtems_barrier_release( ctx->barrier_id, &count );
+  description: null
+test-cleanup:
+  brief: |
+    Delete the barrier and the worker.
+  code: |
+    rtems_status_code sc;
+
+    DeleteTask( ctx->worker_id );
+
+    sc = rtems_barrier_delete( ctx->barrier_id );
+    T_rsc_success( sc );
+
+    RestoreRunnerPriority();
+  description: null
+test-prepare:
+  brief: |
+    Create a manual release barrier.  Create and start a worker task.
+  code: |
+    rtems_status_code sc;
+
+    sc = rtems_barrier_create(
+      OBJECT_NAME,
+      RTEMS_BARRIER_MANUAL_RELEASE,
+      0,
+      &ctx->barrier_id
+    );
+    T_rsc_success( sc );
+
+    SetSelfPriority( PRIO_NORMAL );
+    ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
+    StartTask( ctx->worker_id, BarrierWaitWorker, ctx );
+  description: null
+test-setup:
+  brief: |
+    Make sure the worker task is fully blocked on the barrier.
+  code: |
+    Yield();
+  description: null
+test-teardown:
+  brief: |
+    Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc_success( ctx->status );
+
+    return tic == toc;
+  description: null
+text: |
+  While the execution environment is ${.:/environment}, while the barrier is a
+  manual release barrier, while the measurement sample is the runtime of exactly
+  one successful call to ${../if/release:/name} which does not preempt the
+  caller, when exactly ${../val/perf:/params/sample-count} samples are
+  collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/barrier/req/perf-runtime.yml b/spec/rtems/barrier/req/perf-runtime.yml
new file mode 100644
index 0000000..fb6f99d
--- /dev/null
+++ b/spec/rtems/barrier/req/perf-runtime.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../../req/perf-runtime
+non-functional-type: performance
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+  The runtime of ${../if/group:/name} directives shall be measured.
+type: requirement
diff --git a/spec/rtems/barrier/val/perf.yml b/spec/rtems/barrier/val/perf.yml
new file mode 100644
index 0000000..4daca29
--- /dev/null
+++ b/spec/rtems/barrier/val/perf.yml
@@ -0,0 +1,58 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: validation
+  uid: ../req/perf-runtime
+params:
+  sample-count: 1000
+test-brief: |
+  This test case provides a context to run ${../if/group:/name} performance
+  tests.
+test-cleanup: null
+test-context:
+- brief: |
+    This member provides a barrier identifier.
+  description: null
+  member: |
+    rtems_id barrier_id
+- brief: |
+    This member provides a worker identifier.
+  description: null
+  member: |
+    rtems_id worker_id
+- brief: |
+    This member provides a status code.
+  description: null
+  member: |
+    rtems_status_code status
+test-context-support: null
+test-description: null
+test-includes:
+- rtems.h
+test-local-includes:
+- tx-support.h
+test-prepare: null
+test-setup: null
+test-stop: null
+test-support: |
+  typedef ${.:/test-context-type} Context;
+
+  static void BarrierWaitWorker( rtems_task_argument arg )
+  {
+    Context *ctx;
+
+    ctx = (Context *) arg;
+
+    while ( true ) {
+      rtems_status_code sc;
+
+      sc = rtems_barrier_wait( ctx->barrier_id, RTEMS_NO_TIMEOUT );
+      ctx->end = T_tick();
+      T_quiet_rsc_success( sc );
+    }
+  }
+test-target: testsuites/validation/tc-barrier-performance.c
+test-teardown: null
+type: runtime-measurement-test
diff --git a/spec/rtems/event/req/perf-runtime.yml b/spec/rtems/event/req/perf-runtime.yml
new file mode 100644
index 0000000..fb6f99d
--- /dev/null
+++ b/spec/rtems/event/req/perf-runtime.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../../req/perf-runtime
+non-functional-type: performance
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+  The runtime of ${../if/group:/name} directives shall be measured.
+type: requirement
diff --git a/spec/rtems/event/val/perf.yml b/spec/rtems/event/val/perf.yml
new file mode 100644
index 0000000..64a8a01
--- /dev/null
+++ b/spec/rtems/event/val/perf.yml
@@ -0,0 +1,31 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: validation
+  uid: ../req/perf-runtime
+params:
+  sample-count: 1000
+test-brief: |
+  This test case provides a context to run ${../if/group:/name} performance
+  tests.
+test-cleanup: null
+test-context:
+- brief: |
+    This member provides a status code.
+  description: null
+  member: |
+    rtems_status_code status
+test-context-support: null
+test-description: null
+test-includes:
+- rtems.h
+test-local-includes: []
+test-prepare: null
+test-setup: null
+test-stop: null
+test-support: null
+test-target: testsuites/validation/tc-event-performance.c
+test-teardown: null
+type: runtime-measurement-test
diff --git a/spec/rtems/message/req/perf-runtime.yml b/spec/rtems/message/req/perf-runtime.yml
new file mode 100644
index 0000000..fb6f99d
--- /dev/null
+++ b/spec/rtems/message/req/perf-runtime.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../../req/perf-runtime
+non-functional-type: performance
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+  The runtime of ${../if/group:/name} directives shall be measured.
+type: requirement
diff --git a/spec/rtems/message/val/perf.yml b/spec/rtems/message/val/perf.yml
new file mode 100644
index 0000000..f612cdf
--- /dev/null
+++ b/spec/rtems/message/val/perf.yml
@@ -0,0 +1,31 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: validation
+  uid: ../req/perf-runtime
+params:
+  sample-count: 1000
+test-brief: |
+  This test case provides a context to run ${../if/group:/name} performance
+  tests.
+test-cleanup: null
+test-context:
+- brief: |
+    This member provides a status code.
+  description: null
+  member: |
+    rtems_status_code status
+test-context-support: null
+test-description: null
+test-includes:
+- rtems.h
+test-local-includes: []
+test-prepare: null
+test-setup: null
+test-stop: null
+test-support: null
+test-target: testsuites/validation/tc-message-performance.c
+test-teardown: null
+type: runtime-measurement-test
diff --git a/spec/rtems/part/val/perf.yml b/spec/rtems/part/val/perf.yml
index d86bdb2..71878ee 100644
--- a/spec/rtems/part/val/perf.yml
+++ b/spec/rtems/part/val/perf.yml
@@ -9,7 +9,8 @@ params:
   buffer-count: 100
   sample-count: 1000
 test-brief: |
-  This test case provides a context to run Partition Manager performance tests.
+  This test case provides a context to run ${../if/group:/name} performance
+  tests.
 test-cleanup: null
 test-context:
 - brief: |
diff --git a/spec/rtems/sem/req/perf-mtx-pi-obtain.yml b/spec/rtems/sem/req/perf-mtx-pi-obtain.yml
new file mode 100644
index 0000000..f6dad4a
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-obtain.yml
@@ -0,0 +1,45 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Obtain the available mutex.
+  code: |
+    ctx->status = rtems_semaphore_obtain(
+      ctx->mutex_id,
+      RTEMS_WAIT,
+      RTEMS_NO_TIMEOUT
+    );
+  description: null
+test-cleanup: null
+test-prepare: null
+test-setup: null
+test-teardown:
+  brief: |
+    Release the mutex.  Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc_success( ctx->status );
+
+    ReleaseMutex( ctx->mutex_id );
+
+    return tic == toc;
+  description: null
+text: |
+  While the execution environment is ${.:/environment}, while the semaphore is
+  a priority inheritance mutex, while the measurement sample is the runtime of
+  exactly one successful call to ${../if/obtain:/name} which immediately
+  obtains the mutex, when exactly ${../val/perf:/params/sample-count} samples
+  are collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-mtx-pi-release-one.yml b/spec/rtems/sem/req/perf-mtx-pi-release-one.yml
new file mode 100644
index 0000000..4d0ea81
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-release-one.yml
@@ -0,0 +1,50 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Release the mutex.
+  code: |
+    ctx->status = rtems_semaphore_release( ctx->mutex_id );
+  description: null
+test-cleanup: null
+test-prepare: null
+test-setup:
+  brief: |
+    Let one task wait on the mutex.
+  code: |
+    ObtainMutex( ctx->mutex_id );
+    Send( ctx, EVENT_OBTAIN );
+    SetPriority( ctx->worker_id, PRIO_LOW );
+    Send( ctx, EVENT_RELEASE );
+  description: null
+test-teardown:
+  brief: |
+    Restore the worker priority.  Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
+
+    SetPriority( ctx->worker_id, PRIO_HIGH );
+
+    return tic == toc;
+  description: null
+text: |
+  While the execution environment is ${.:/environment}, while the semaphore is
+  a priority inheritance mutex, while the measurement sample is the runtime of
+  exactly one successful call to ${../if/release:/name} which does unblock
+  exactly one waiting task which does not preempt the caller, when exactly
+  ${../val/perf:/params/sample-count} samples are collected, the
+  ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-mtx-pi-release-other-cpu.yml b/spec/rtems/sem/req/perf-mtx-pi-release-other-cpu.yml
new file mode 100644
index 0000000..c8f2a71
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-release-other-cpu.yml
@@ -0,0 +1,66 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: RTEMS_SMP
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Release the mutex.
+  code: |
+    ctx->status = rtems_semaphore_release( ctx->mutex_id );
+  description: null
+test-cleanup:
+  brief: |
+    Move worker to scheduler A.
+  code: |
+    SetScheduler( ctx->worker_id, SCHEDULER_A_ID, PRIO_HIGH );
+  description: null
+test-prepare:
+  brief: |
+    Move worker to scheduler B.
+  code: |
+    SetScheduler( ctx->worker_id, SCHEDULER_B_ID, PRIO_NORMAL );
+  description: null
+test-setup:
+  brief: |
+    Let one task wait on the mutex.
+  code: |
+    ObtainMutex( ctx->mutex_id );
+    Send( ctx, EVENT_OBTAIN | EVENT_OBTAIN_END | EVENT_RELEASE );
+    WaitForNextTask( 1, ctx->worker_id );
+  description: null
+test-teardown:
+  brief: |
+    Set the measured runtime.  Make sure the worker waits for the next event.
+    Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
+
+    *delta = ctx->end - ctx->begin;
+    WaitForNextTask( 1, ctx->worker_id );
+
+    return tic == toc;
+  description: null
+text: |
+  Let ``U` and `V`` be two tasks with distinct home schedulers.  Let :math:`B`
+  be a time point measured by ``U`` right before a call to
+  ${../if/release:/name} which unblocks task ``V``.  Let :math:`E` be a time
+  point measured by ``V`` right after the first context switch after :math:`B`.
+  While the execution environment is While the execution environment is
+  ${.:/environment}, while the semaphore is a priority inheritance mutex, while
+  the measurement sample is the runtime of exactly one successful call to
+  ${../if/release:/name} which does unblock exactly one waiting task which is
+  scheduled on another processor, when exactly
+  ${../val/perf:/params/sample-count} samples are collected, the
+  ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml b/spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml
new file mode 100644
index 0000000..a86193e
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml
@@ -0,0 +1,52 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Release the mutex.
+  code: |
+    ctx->status = rtems_semaphore_release( ctx->mutex_id );
+  description: null
+test-cleanup: null
+test-prepare: null
+test-setup:
+  brief: |
+    Let one task wait on the mutex.
+  code: |
+    ObtainMutex( ctx->mutex_id );
+    Send( ctx, EVENT_OBTAIN | EVENT_OBTAIN_END | EVENT_RELEASE );
+  description: null
+test-teardown:
+  brief: |
+    Set the measured runtime.  Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
+
+    *delta = ctx->end - ctx->begin;
+
+    return tic == toc;
+  description: null
+text: |
+  Let ``U` and `V`` be two tasks with the same home scheduler.  Let :math:`B`
+  be a time point measured by ``U`` right before a call to
+  ${../if/release:/name} which unblocks task ``V``.  Let :math:`E` be a time
+  point measured by ``V`` right after the first context switch after :math:`B`.
+  While the execution environment is While the execution environment is
+  ${.:/environment}, while the semaphore is a priority inheritance mutex, while
+  the measurement sample is the runtime of exactly one successful call to
+  ${../if/release:/name} which does unblock exactly one waiting task which
+  preempts the caller, when exactly ${../val/perf:/params/sample-count} samples
+  are collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-mtx-pi-release.yml b/spec/rtems/sem/req/perf-mtx-pi-release.yml
new file mode 100644
index 0000000..46ca95a
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-release.yml
@@ -0,0 +1,44 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Release the mutex.
+  code: |
+    ctx->status = rtems_semaphore_release( ctx->mutex_id );
+  description: null
+test-cleanup: null
+test-prepare: null
+test-setup:
+  brief: |
+    Obtain the mutex.
+  code: |
+    ObtainMutex( ctx->mutex_id );
+  description: null
+test-teardown:
+  brief: |
+    Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc_success( ctx->status );
+
+    return tic == toc;
+  description: null
+text: |
+  While the execution environment is ${.:/environment}, while the semaphore is
+  a priority inheritance mutex, while the measurement sample is the runtime of
+  exactly one successful call to ${../if/release:/name} which does not unblock
+  a waiting task, when exactly ${../val/perf:/params/sample-count} samples are
+  collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-mtx-pi-try.yml b/spec/rtems/sem/req/perf-mtx-pi-try.yml
new file mode 100644
index 0000000..2285863
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-try.yml
@@ -0,0 +1,49 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Try to obtain the unavailable mutex.
+  code: |
+    ctx->status = rtems_semaphore_obtain( ctx->mutex_id, RTEMS_NO_WAIT, 0 );
+  description: null
+test-cleanup:
+  brief: |
+    Make the mutex available.
+  code: |
+    Send( ctx, EVENT_RELEASE );
+  description: null
+test-prepare:
+  brief: |
+    Make the mutex unavailable.
+  code: |
+    Send( ctx, EVENT_OBTAIN );
+  description: null
+test-setup: null
+test-teardown:
+  brief: |
+    Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc( ctx->status, RTEMS_UNSATISFIED );
+
+    return tic == toc;
+  description: null
+text: |
+  While the execution environment is ${.:/environment}, while the semaphore is
+  a priority inheritance mutex, while the measurement sample is the runtime of
+  exactly one unsatisfied call to ${../if/obtain:/name} which immediately
+  returns, when exactly ${../val/perf:/params/sample-count} samples are
+  collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml b/spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml
new file mode 100644
index 0000000..b1e5ec9
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-wait-forever.yml
@@ -0,0 +1,60 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Obtain the unavailable mutex and wait forever.
+  code: |
+    ctx->begin = T_tick();
+    ctx->status = rtems_semaphore_obtain(
+      ctx->mutex_id,
+      RTEMS_WAIT,
+      RTEMS_NO_TIMEOUT
+    );
+  description: null
+test-cleanup: null
+test-prepare: null
+test-setup:
+  brief: |
+    Make the mutex unavailable.
+  code: |
+    Send( ctx, EVENT_OBTAIN );
+    SetPriority( ctx->worker_id, PRIO_LOW );
+    Send( ctx, EVENT_END | EVENT_RELEASE );
+  description: null
+test-teardown:
+  brief: |
+    Set the measured runtime.  Restore the worker priority.  Release the mutex.
+    Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
+
+    *delta = ctx->end - ctx->begin;
+    SetPriority( ctx->worker_id, PRIO_HIGH );
+    ReleaseMutex( ctx->mutex_id );
+
+    return tic == toc;
+  description: null
+text: |
+  Let ``U` and `V`` be two tasks with the same home scheduler.  Let :math:`B`
+  be a time point measured by ``U`` right before a call to
+  ${../if/obtain:/name} which blocks on the mutex with no timeout.  Let
+  :math:`E` be a time point measured by ``V`` right after the first context
+  switch after :math:`B`.  While the execution environment is
+  ${.:/environment}, while the semaphore is a priority inheritance mutex, while
+  the measurement sample is :math:`E - B`, when exactly
+  ${../val/perf:/params/sample-count} samples are collected, the
+  ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml b/spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml
new file mode 100644
index 0000000..56084c6
--- /dev/null
+++ b/spec/rtems/sem/req/perf-mtx-pi-wait-timed.yml
@@ -0,0 +1,60 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+limits: {}
+links:
+- role: requirement-refinement
+  uid: perf-runtime
+- role: runtime-measurement-request
+  uid: ../val/perf
+non-functional-type: performance-runtime
+params: {}
+rationale: null
+references: []
+requirement-type: non-functional
+test-body:
+  brief: |
+    Obtain the unavailable mutex and wait forever.
+  code: |
+    ctx->begin = T_tick();
+    ctx->status = rtems_semaphore_obtain(
+      ctx->mutex_id,
+      RTEMS_WAIT,
+      UINT32_MAX
+    );
+  description: null
+test-cleanup: null
+test-prepare: null
+test-setup:
+  brief: |
+    Make the mutex unavailable.
+  code: |
+    Send( ctx, EVENT_OBTAIN );
+    SetPriority( ctx->worker_id, PRIO_LOW );
+    Send( ctx, EVENT_END | EVENT_RELEASE );
+  description: null
+test-teardown:
+  brief: |
+    Set the measured runtime.  Restore the worker priority.  Release the mutex.
+    Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc( ctx->status, RTEMS_SUCCESSFUL );
+
+    *delta = ctx->end - ctx->begin;
+    SetPriority( ctx->worker_id, PRIO_HIGH );
+    ReleaseMutex( ctx->mutex_id );
+
+    return tic == toc;
+  description: null
+text: |
+  Let ``U` and `V`` be two tasks with the same home scheduler.  Let :math:`B`
+  be a time point measured by ``U`` right before a call to
+  ${../if/obtain:/name} which blocks on the mutex with a timeout.  Let
+  :math:`E` be a time point measured by ``V`` right after the first context
+  switch after :math:`B`.  While the execution environment is
+  ${.:/environment}, while the semaphore is a priority inheritance mutex, while
+  the measurement sample is :math:`E - B`, when exactly
+  ${../val/perf:/params/sample-count} samples are collected, the
+  ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/sem/req/perf-runtime.yml b/spec/rtems/sem/req/perf-runtime.yml
new file mode 100644
index 0000000..fb6f99d
--- /dev/null
+++ b/spec/rtems/sem/req/perf-runtime.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../../req/perf-runtime
+non-functional-type: performance
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+  The runtime of ${../if/group:/name} directives shall be measured.
+type: requirement
diff --git a/spec/rtems/sem/val/perf.yml b/spec/rtems/sem/val/perf.yml
new file mode 100644
index 0000000..04dd8b9
--- /dev/null
+++ b/spec/rtems/sem/val/perf.yml
@@ -0,0 +1,121 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: validation
+  uid: ../req/perf-runtime
+params:
+  sample-count: 1000
+test-brief: |
+  This test case provides a context to run ${../if/group:/name} performance
+  tests.
+test-cleanup: null
+test-context:
+- brief: |
+    This member provides a mutex identifier.
+  description: null
+  member: |
+    rtems_id mutex_id
+- brief: |
+    This member provides a worker identifier.
+  description: null
+  member: |
+    rtems_id worker_id
+- brief: |
+    This member provides a status code.
+  description: null
+  member: |
+    rtems_status_code status
+test-context-support: null
+test-description: null
+test-includes:
+- rtems.h
+test-local-includes:
+- tx-support.h
+test-prepare: null
+test-setup:
+  brief: |
+    Create a mutex and a worker task.
+  code: |
+    SetSelfPriority( PRIO_NORMAL );
+    ctx->mutex_id = CreateMutex();
+    ctx->worker_id = CreateTask( "WORK", PRIO_HIGH );
+    StartTask( ctx->worker_id, Worker, ctx );
+  description: null
+test-stop: null
+test-support: |
+  typedef ${.:/test-context-type} Context;
+
+  typedef enum {
+    EVENT_END = RTEMS_EVENT_0,
+    EVENT_OBTAIN = RTEMS_EVENT_1,
+    EVENT_OBTAIN_END = RTEMS_EVENT_2,
+    EVENT_RELEASE = RTEMS_EVENT_3,
+    EVENT_RELEASE_END = RTEMS_EVENT_4
+  } Event;
+
+  static void Send( const Context *ctx, rtems_event_set events )
+  {
+    SendEvents( ctx->worker_id, events );
+  }
+
+  static void Worker( rtems_task_argument arg )
+  {
+    Context *ctx;
+
+    ctx = (Context *) arg;
+
+    while ( true ) {
+      rtems_event_set   events;
+      rtems_status_code sc;
+      T_ticks           ticks;
+
+      sc = rtems_event_receive(
+        RTEMS_ALL_EVENTS,
+        RTEMS_EVENT_ANY | RTEMS_WAIT,
+        RTEMS_NO_TIMEOUT,
+        &events
+      );
+      ticks = T_tick();
+      T_quiet_rsc_success( sc );
+
+      if ( ( events & EVENT_END ) != 0 ) {
+        ctx->end = ticks;
+      }
+
+      if ( ( events & EVENT_OBTAIN ) != 0 ) {
+        sc = rtems_semaphore_obtain(
+          ctx->mutex_id,
+          RTEMS_WAIT,
+          RTEMS_NO_TIMEOUT
+        );
+        ticks = T_tick();
+        T_quiet_rsc_success( sc );
+
+        if ( ( events & EVENT_OBTAIN_END ) != 0 ) {
+          ctx->end = ticks;
+        }
+      }
+
+      if ( ( events & EVENT_RELEASE ) != 0 ) {
+        sc = rtems_semaphore_release( ctx->mutex_id );
+        ticks = T_tick();
+        T_quiet_rsc_success( sc );
+
+        if ( ( events & EVENT_RELEASE_END ) != 0 ) {
+          ctx->end = ticks;
+        }
+      }
+    }
+  }
+test-target: testsuites/validation/tc-sem-performance.c
+test-teardown:
+  brief: |
+    Delete the worker task and the mutex.
+  code: |
+    DeleteTask( ctx->worker_id );
+    DeleteMutex( ctx->mutex_id );
+    RestoreRunnerPriority();
+  description: null
+type: runtime-measurement-test
diff --git a/spec/rtems/task/req/perf-runtime.yml b/spec/rtems/task/req/perf-runtime.yml
new file mode 100644
index 0000000..fb6f99d
--- /dev/null
+++ b/spec/rtems/task/req/perf-runtime.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de
+enabled-by: true
+links:
+- role: requirement-refinement
+  uid: ../../req/perf-runtime
+non-functional-type: performance
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+  The runtime of ${../if/group:/name} directives shall be measured.
+type: requirement
diff --git a/spec/rtems/task/val/perf.yml b/spec/rtems/task/val/perf.yml
new file mode 100644
index 0000000..364bfc0
--- /dev/null
+++ b/spec/rtems/task/val/perf.yml
@@ -0,0 +1,31 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: validation
+  uid: ../req/perf-runtime
+params:
+  sample-count: 1000
+test-brief: |
+  This test case provides a context to run ${../if/group:/name} performance
+  tests.
+test-cleanup: null
+test-context:
+- brief: |
+    This member provides a status code.
+  description: null
+  member: |
+    rtems_status_code status
+test-context-support: null
+test-description: null
+test-includes:
+- rtems.h
+test-local-includes: []
+test-prepare: null
+test-setup: null
+test-stop: null
+test-support: null
+test-target: testsuites/validation/tc-task-performance.c
+test-teardown: null
+type: runtime-measurement-test
diff --git a/spec/testsuites/performance-0.yml b/spec/testsuites/performance-0.yml
index 4810432..c972202 100644
--- a/spec/testsuites/performance-0.yml
+++ b/spec/testsuites/performance-0.yml
@@ -11,6 +11,8 @@ test-brief: |
 test-code: |
   const char rtems_test_name[] = "${.:/test-suite-name}";
 
+  #define CONFIGURE_MAXIMUM_PROCESSORS 4
+
   #include "ts-default.h"
 test-description: |
   In SMP configurations, up to three scheduler instances using the SMP EDF



More information about the vc mailing list