diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-06 21:26:29 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-06 21:26:29 +0000 |
commit | 1324bafd0d2d8856e106bc8d929e2d36b47b2273 (patch) | |
tree | 74518252efea6b4613ec1ca25da65a82f074f221 /posix_api/psx_sched_report/test.c | |
parent | 2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-examples-1324bafd0d2d8856e106bc8d929e2d36b47b2273.tar.bz2 |
2009-08-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* ChangeLog, Makefile, psx_example_1/Makefile, psx_example_1/test1.c,
psx_example_2/Makefile, psx_example_2/test2.c,
psx_example_3/Makefile, psx_example_3/test3.c,
psx_sched_report/Makefile, psx_sched_report/README,
psx_sched_report/test.c: New files.
Diffstat (limited to '')
-rw-r--r-- | posix_api/psx_sched_report/test.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/posix_api/psx_sched_report/test.c b/posix_api/psx_sched_report/test.c new file mode 100644 index 0000000..8d0b9b3 --- /dev/null +++ b/posix_api/psx_sched_report/test.c @@ -0,0 +1,68 @@ +/* + * Simple test program -- simplified version of sample test hello. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <sched.h> +#include <stdlib.h> + +void print_sched_info( + char *s, + int policy +) +{ + int min, max, levels; + struct timespec t; + + printf( "Information on %s\n", s ); + min = sched_get_priority_min( policy ); + max = sched_get_priority_max( policy ); + (void) sched_rr_get_interval( 1, &t ); + levels = max - min; + printf( "\tSupports %d priority levels (%d - %d)\n", levels, min, max ); + if ( levels >= 32 ) + printf( "\tImplementation is compliant on priority levels\n"); + else + printf( "\tImplementation is NOT compliant on priority levels\n" ); + + printf( "\tScheduling quantum is %ld seconds and %ld nanoseconds\n", + (long)t.tv_sec, (long)t.tv_nsec ); +} + + +#if defined(__rtems__) + #include <bsp.h> + +rtems_task Init( + rtems_task_argument ignored +) +#else +int main() +#endif +{ + print_sched_info( "SCHED_OTHER", SCHED_OTHER ); + print_sched_info( "SCHED_FIFO", SCHED_FIFO ); + print_sched_info( "SCHED_RR", SCHED_RR ); + + exit( 0 ); +} + +#if defined(__rtems__) +/* configuration information */ + +/* NOTICE: the clock driver is explicitly disabled */ +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE +#define CONFIGURE_MICROSECONDS_PER_TICK 1000 +#define CONFIGURE_TICKS_PER_TIMESLICE 1 +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +#endif + +/* end of file */ |