[rtems-central commit] spec: Add performance requirements

Sebastian Huber sebh at rtems.org
Thu Nov 25 15:49:51 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 25 13:55:40 2021 +0100

spec: Add performance requirements

---

 .../barrier/req/perf-release-auto-other-cpu.yml    | 10 +++---
 .../barrier/req/perf-release-manual-preempt.yml    | 11 +++---
 spec/rtems/event/req/perf-other-cpu.yml            |  4 +--
 .../message/req/perf-receive-wait-forever.yml      |  1 +
 spec/rtems/message/req/perf-receive-wait-timed.yml |  1 +
 spec/rtems/message/req/perf-send-other-cpu.yml     |  4 +--
 .../sem/req/perf-mtx-pi-release-other-cpu.yml      |  5 +--
 spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml |  1 +
 spec/rtems/task/req/perf-construct.yml             | 40 ++++++++++++++++++++++
 spec/rtems/task/val/perf.yml                       | 27 +++++++++++++--
 ...erformance-0.yml => performance-no-clock-0.yml} |  6 ++--
 11 files changed, 90 insertions(+), 20 deletions(-)

diff --git a/spec/rtems/barrier/req/perf-release-auto-other-cpu.yml b/spec/rtems/barrier/req/perf-release-auto-other-cpu.yml
index 98c74fe..37960a7 100644
--- a/spec/rtems/barrier/req/perf-release-auto-other-cpu.yml
+++ b/spec/rtems/barrier/req/perf-release-auto-other-cpu.yml
@@ -48,19 +48,17 @@ test-prepare:
     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-setup: null
 test-teardown:
   brief: |
-    Set the measured runtime.  Discard samples interrupted by a clock tick.
+    Make sure the worker waits for the next event.  Set the measured runtime.
+    Discard samples interrupted by a clock tick.
   code: |
     T_quiet_rsc_success( ctx->status );
 
+    WaitForNextTask( 1, ctx->worker_id );
     *delta = ctx->end - ctx->begin;
 
     return tic == toc;
diff --git a/spec/rtems/barrier/req/perf-release-manual-preempt.yml b/spec/rtems/barrier/req/perf-release-manual-preempt.yml
index d59bb9e..2cb6691 100644
--- a/spec/rtems/barrier/req/perf-release-manual-preempt.yml
+++ b/spec/rtems/barrier/req/perf-release-manual-preempt.yml
@@ -19,6 +19,7 @@ test-body:
   code: |
     uint32_t count;
 
+    ctx->begin = T_tick();
     ctx->status = rtems_barrier_release( ctx->barrier_id, &count );
   description: null
 test-cleanup:
@@ -69,8 +70,10 @@ text: |
   ${../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}.
+  :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/event/req/perf-other-cpu.yml b/spec/rtems/event/req/perf-other-cpu.yml
index ccc2dae..b2efd3e 100644
--- a/spec/rtems/event/req/perf-other-cpu.yml
+++ b/spec/rtems/event/req/perf-other-cpu.yml
@@ -35,13 +35,13 @@ test-prepare:
 test-setup: null
 test-teardown:
   brief: |
-    Set the measured runtime.  Make sure the worker waits for the next event.
+    Make sure the worker waits for the next event.  Set the measured runtime.
     Discard samples interrupted by a clock tick.
   code: |
     T_quiet_rsc_success( ctx->status );
 
-    *delta = ctx->end - ctx->begin;
     WaitForNextTask( 1, ctx->worker_id );
+    *delta = ctx->end - ctx->begin;
 
     return tic == toc;
   description: null
diff --git a/spec/rtems/message/req/perf-receive-wait-forever.yml b/spec/rtems/message/req/perf-receive-wait-forever.yml
index 953d131..7f37625 100644
--- a/spec/rtems/message/req/perf-receive-wait-forever.yml
+++ b/spec/rtems/message/req/perf-receive-wait-forever.yml
@@ -20,6 +20,7 @@ test-body:
     uint64_t message;
     size_t   size;
 
+    ctx->begin = T_tick();
     ctx->status = rtems_message_queue_receive(
       ctx->queue_id,
       &message,
diff --git a/spec/rtems/message/req/perf-receive-wait-timed.yml b/spec/rtems/message/req/perf-receive-wait-timed.yml
index 169113e..0c41999 100644
--- a/spec/rtems/message/req/perf-receive-wait-timed.yml
+++ b/spec/rtems/message/req/perf-receive-wait-timed.yml
@@ -20,6 +20,7 @@ test-body:
     uint64_t message;
     size_t   size;
 
+    ctx->begin = T_tick();
     ctx->status = rtems_message_queue_receive(
       ctx->queue_id,
       &message,
diff --git a/spec/rtems/message/req/perf-send-other-cpu.yml b/spec/rtems/message/req/perf-send-other-cpu.yml
index 5fc8b9d..5b0b1c6 100644
--- a/spec/rtems/message/req/perf-send-other-cpu.yml
+++ b/spec/rtems/message/req/perf-send-other-cpu.yml
@@ -47,13 +47,13 @@ test-setup:
   description: null
 test-teardown:
   brief: |
-    Set the measured runtime.  Make sure the worker waits for the next event.
+    Make sure the worker waits for the next event.  Set the measured runtime.
     Discard samples interrupted by a clock tick.
   code: |
     T_quiet_rsc_success( ctx->status );
 
-    *delta = ctx->end - ctx->begin;
     WaitForNextTask( 1, ctx->worker_id );
+    *delta = ctx->end - ctx->begin;
 
     return tic == toc;
   description: null
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
index 792b509..a11b767 100644
--- a/spec/rtems/sem/req/perf-mtx-pi-release-other-cpu.yml
+++ b/spec/rtems/sem/req/perf-mtx-pi-release-other-cpu.yml
@@ -17,6 +17,7 @@ test-body:
   brief: |
     Release the mutex.
   code: |
+    ctx->begin = T_tick();
     ctx->status = rtems_semaphore_release( ctx->mutex_id );
   description: null
 test-cleanup:
@@ -41,13 +42,13 @@ test-setup:
   description: null
 test-teardown:
   brief: |
-    Set the measured runtime.  Make sure the worker waits for the next event.
+    Make sure the worker waits for the next event.  Set the measured runtime.
     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 );
+    *delta = ctx->end - ctx->begin;
 
     return tic == toc;
   description: null
diff --git a/spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml b/spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml
index 070385d..d277abd 100644
--- a/spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml
+++ b/spec/rtems/sem/req/perf-mtx-pi-release-preempt.yml
@@ -17,6 +17,7 @@ test-body:
   brief: |
     Release the mutex.
   code: |
+    ctx->begin = T_tick();
     ctx->status = rtems_semaphore_release( ctx->mutex_id );
   description: null
 test-cleanup: null
diff --git a/spec/rtems/task/req/perf-construct.yml b/spec/rtems/task/req/perf-construct.yml
new file mode 100644
index 0000000..83ed57d
--- /dev/null
+++ b/spec/rtems/task/req/perf-construct.yml
@@ -0,0 +1,40 @@
+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: |
+    Construct a task.
+  code: |
+    ctx->status = rtems_task_construct( &config, &ctx->worker_id );
+  description: null
+test-cleanup: null
+test-prepare: null
+test-setup: null
+test-teardown:
+  brief: |
+    Delete the worker.  Discard samples interrupted by a clock tick.
+  code: |
+    T_quiet_rsc_success( ctx->status );
+
+    DeleteTask( ctx->worker_id );
+
+    return tic == toc;
+  description: null
+text: |
+  While the execution environment is ${.:/environment}, while the measurement
+  sample is the runtime of exactly one successful call to
+  ${../if/construct:/name}, when exactly ${../val/perf:/params/sample-count}
+  samples are collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
+type: requirement
diff --git a/spec/rtems/task/val/perf.yml b/spec/rtems/task/val/perf.yml
index 364bfc0..e1228c0 100644
--- a/spec/rtems/task/val/perf.yml
+++ b/spec/rtems/task/val/perf.yml
@@ -13,6 +13,11 @@ test-brief: |
 test-cleanup: null
 test-context:
 - brief: |
+    This member provides a worker identifier.
+  description: null
+  member: |
+    rtems_id worker_id
+- brief: |
     This member provides a status code.
   description: null
   member: |
@@ -21,11 +26,29 @@ test-context-support: null
 test-description: null
 test-includes:
 - rtems.h
-test-local-includes: []
+test-local-includes:
+- ts-config.h
+- tx-support.h
 test-prepare: null
 test-setup: null
 test-stop: null
-test-support: null
+test-support: |
+  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
+  };
 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-no-clock-0.yml
similarity index 82%
rename from spec/testsuites/performance-0.yml
rename to spec/testsuites/performance-no-clock-0.yml
index c972202..bb1c209 100644
--- a/spec/testsuites/performance-0.yml
+++ b/spec/testsuites/performance-no-clock-0.yml
@@ -13,6 +13,8 @@ test-code: |
 
   #define CONFIGURE_MAXIMUM_PROCESSORS 4
 
+  #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+
   #include "ts-default.h"
 test-description: |
   In SMP configurations, up to three scheduler instances using the SMP EDF
@@ -20,6 +22,6 @@ test-description: |
 test-includes:
 - rtems/test-info.h
 test-local-includes: []
-test-suite-name: Performance0
-test-target: testsuites/validation/ts-performance-0.c
+test-suite-name: PerformanceNoClock0
+test-target: testsuites/validation/ts-performance-no-clock-0.c
 type: test-suite



More information about the vc mailing list