summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-05-24 15:37:32 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-05-24 15:37:32 +0000
commit2c8485b6632552095c3ed945fcec97ba75294c11 (patch)
tree915983fba369d5c963b18e383803d90919e11c94
parentSignificantly lowered the default memory requirements: (diff)
downloadrtems-2c8485b6632552095c3ed945fcec97ba75294c11.tar.bz2
Eliminated printing from switch extension.
-rw-r--r--c/src/tests/libtests/cpuuse/cpuuse.scn34
-rw-r--r--c/src/tests/libtests/cpuuse/system.h15
-rw-r--r--c/src/tests/libtests/cpuuse/task2.c21
-rw-r--r--c/src/tests/libtests/cpuuse/tswitch.c19
4 files changed, 68 insertions, 21 deletions
diff --git a/c/src/tests/libtests/cpuuse/cpuuse.scn b/c/src/tests/libtests/cpuuse/cpuuse.scn
index f104c0c482..b45cf91136 100644
--- a/c/src/tests/libtests/cpuuse/cpuuse.scn
+++ b/c/src/tests/libtests/cpuuse/cpuuse.scn
@@ -1,24 +1,34 @@
-*** TEST 4 ***
-TA1 - 09:15:00 12/31/1988
+*** CPU USAGE LIBRARY TEST ***
TA1 - rtems_task_suspend - on Task 2
TA1 - rtems_task_suspend - on Task 3
TA1 - killing time
TA1 - rtems_task_resume - on Task 2
TA1 - rtems_task_resume - on Task 3
-TA2 - 09:15:03 12/31/1988
-TA3 - 09:15:04 12/31/1988
-TA1 - 09:15:05 12/31/1988
-TA2 - 09:15:06 12/31/1988
-TA3 - 09:15:07 12/31/1988
-TA1 - 09:15:08 12/31/1988
TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT
-TA1 - 09:15:09 12/31/1988
TA1 - 09:15:10 12/31/1988
TA1 - 09:15:11 12/31/1988
TA1 - 09:15:12 12/31/1988
TA1 - 09:15:13 12/31/1988
TA1 - 09:15:14 12/31/1988
+TA1 - 09:15:15 12/31/1988
TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT
-TA2 - 09:15:15 12/31/1988
-TA3 - 09:15:16 12/31/1988
-*** END OF TEST 4 ***
+TA1 - 09:15:00 12/31/1988
+TA2 - 09:15:04 12/31/1988
+TA3 - 09:15:05 12/31/1988
+TA1 - 09:15:06 12/31/1988
+TA2 - 09:15:07 12/31/1988
+TA3 - 09:15:08 12/31/1988
+TA1 - 09:15:09 12/31/1988
+TA2 - 09:15:16 12/31/1988
+CPU Usage by thread
+ ID NAME TICKS PERCENT
+0x04010001 IDLE 0 0.000
+0x08010002 TA1 1203 0.748
+0x08010003 TA2 204 0.127
+0x08010004 TA3 202 0.126
+
+Ticks since last reset = 1601
+
+Total Units = 1609
+*** END OF CPU USAGE LIBRARY TEST ***
+NOTE: Actual time per task will vary but there should be no IDLE time.
diff --git a/c/src/tests/libtests/cpuuse/system.h b/c/src/tests/libtests/cpuuse/system.h
index a83431c614..f99c6eb647 100644
--- a/c/src/tests/libtests/cpuuse/system.h
+++ b/c/src/tests/libtests/cpuuse/system.h
@@ -44,6 +44,7 @@ void Task_switch(
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
@@ -62,5 +63,19 @@ TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
/* array of task run counts */
TEST_EXTERN volatile rtems_unsigned32 Run_count[ 4 ];
+
+/*
+ * Keep track of task switches
+ */
+
+struct taskSwitchLog {
+ int taskIndex;
+ rtems_time_of_day when;
+};
+
+extern struct taskSwitchLog taskSwitchLog[];
+extern int taskSwitchLogIndex;
+volatile extern int testsFinished;
+
/* end of include file */
diff --git a/c/src/tests/libtests/cpuuse/task2.c b/c/src/tests/libtests/cpuuse/task2.c
index 5dbdda331d..8a9880d0ba 100644
--- a/c/src/tests/libtests/cpuuse/task2.c
+++ b/c/src/tests/libtests/cpuuse/task2.c
@@ -20,9 +20,28 @@
#include "system.h"
+#include <rtems/cpuuse.h>
+
+static void
+showTaskSwitches (void)
+{
+ int i;
+ int switches = taskSwitchLogIndex;
+
+ for (i = 0 ; i < switches ; i++) {
+ put_name( Task_name[taskSwitchLog[i].taskIndex], FALSE );
+ print_time( "- ", &taskSwitchLog[i].when, "\n" );
+ }
+}
+
rtems_task Task_2(
rtems_task_argument argument
)
{
- while( FOREVER );
+ while ( !testsFinished );
+
+ showTaskSwitches ();
+ CPU_usage_Dump();
+ puts( "*** END OF CPU USAGE LIBRARY TEST ***" );
+ exit( 0 );
}
diff --git a/c/src/tests/libtests/cpuuse/tswitch.c b/c/src/tests/libtests/cpuuse/tswitch.c
index 6b5d2f5548..56a53770a7 100644
--- a/c/src/tests/libtests/cpuuse/tswitch.c
+++ b/c/src/tests/libtests/cpuuse/tswitch.c
@@ -22,7 +22,9 @@
#include "system.h"
-#include <rtems/cpuuse.h>
+struct taskSwitchLog taskSwitchLog[1000];
+int taskSwitchLogIndex;
+volatile int testsFinished;;
rtems_extension Task_switch(
rtems_tcb *unused,
@@ -45,14 +47,15 @@ rtems_extension Task_switch(
fatal_directive_status_with_level( status, RTEMS_SUCCESSFUL,
"rtems_clock_get", 1 );
- put_name( Task_name[ index ], FALSE );
- print_time( "- ", &time, "\n" );
-
- if ( time.second >= 16 ) {
- CPU_usage_Dump();
- puts( "*** END OF CPU USAGE LIBRARY TEST ***" );
- exit( 0 );
+ if (taskSwitchLogIndex <
+ (sizeof taskSwitchLog / sizeof taskSwitchLog[0])) {
+ taskSwitchLog[taskSwitchLogIndex].taskIndex = index;
+ taskSwitchLog[taskSwitchLogIndex].when = time;
+ taskSwitchLogIndex++;
}
+ if ( time.second >= 16 )
+ testsFinished = 1;
+
break;
case 0: