Eliminated printing from switch extension.

This commit is contained in:
Joel Sherrill
2000-05-24 15:37:32 +00:00
parent 2fbdbd4f14
commit 2c8485b663
4 changed files with 68 additions and 21 deletions

View File

@@ -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.

View File

@@ -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 */

View File

@@ -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 );
}

View File

@@ -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: