[rtems-central commit] spec: Use correct number of idle tasks

Sebastian Huber sebh at rtems.org
Fri Oct 14 12:52:41 UTC 2022


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Oct 14 15:03:09 2022 +0200

spec: Use correct number of idle tasks

---

 spec/rtems/cpuuse/val/cpuuse.yml | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/spec/rtems/cpuuse/val/cpuuse.yml b/spec/rtems/cpuuse/val/cpuuse.yml
index 45bec8d3..0279dbcf 100644
--- a/spec/rtems/cpuuse/val/cpuuse.yml
+++ b/spec/rtems/cpuuse/val/cpuuse.yml
@@ -12,6 +12,21 @@ test-actions:
     Thread_Control   *other;
     Timestamp_Control cpu_usage_self;
     Timestamp_Control cpu_usage_other;
+    uint32_t          idle_tasks;
+    uint32_t          cpu_index;
+
+    idle_tasks = 0;
+
+    for ( cpu_index = 0; cpu_index < rtems_scheduler_get_processor_maximum(); ++cpu_index ) {
+      rtems_status_code sc;
+      rtems_id          unused;
+
+      sc = rtems_scheduler_ident_by_processor( cpu_index, &unused );
+
+      if ( sc == RTEMS_SUCCESSFUL ) {
+        ++idle_tasks;
+      }
+    }
 
     id = CreateTask( "WORK", GetSelfPriority() );
     StartTask( id, Worker, NULL );
@@ -43,7 +58,7 @@ test-actions:
       T_eq_i64( _Thread_Get_CPU_time_used_after_last_reset( self ), 4295 );
       T_eq_i64(
         _Thread_Get_CPU_time_used( self ),
-        cpu_usage_self + 12885 + rtems_scheduler_get_processor_maximum() * 4295
+        cpu_usage_self + 12885 + 4295 * idle_tasks
       );
 
       T_eq_i64( _Thread_Get_CPU_time_used_after_last_reset( other ), 0 );



More information about the vc mailing list