diff options
Diffstat (limited to 'testsuites/ada/tmtests/tmck')
-rw-r--r-- | testsuites/ada/tmtests/tmck/Makefile.am | 13 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tmck/config.h | 32 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tmck/tmck.adb | 55 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tmck/tmtest.adb | 214 | ||||
-rw-r--r-- | testsuites/ada/tmtests/tmck/tmtest.ads | 96 |
5 files changed, 410 insertions, 0 deletions
diff --git a/testsuites/ada/tmtests/tmck/Makefile.am b/testsuites/ada/tmtests/tmck/Makefile.am new file mode 100644 index 0000000000..a2fa2956e0 --- /dev/null +++ b/testsuites/ada/tmtests/tmck/Makefile.am @@ -0,0 +1,13 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +noinst_PROGRAMS = ada_tmck +ada_tmck_SOURCES = tmck.adb config.h tmtest.adb tmtest.ads +ada_tmck_SOURCES += ../../support/init.c + +ada_tmck$(EXEEXT): tmck.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/tmtests/tmck/config.h b/testsuites/ada/tmtests/tmck/config.h new file mode 100644 index 0000000000..7730385b3c --- /dev/null +++ b/testsuites/ada/tmtests/tmck/config.h @@ -0,0 +1,32 @@ +/* config.h + * + * This include file defines the Configuration Table for this test. + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + + +/* configuration information */ + +#define CONFIGURE_TMTEST + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 +#define CONFIGURE_TICKS_PER_TIMESLICE 0 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/tmtests/tmck/tmck.adb b/testsuites/ada/tmtests/tmck/tmck.adb new file mode 100644 index 0000000000..c35d786517 --- /dev/null +++ b/testsuites/ada/tmtests/tmck/tmck.adb @@ -0,0 +1,55 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Test TMCK of the Timing Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with RTEMS; +with RTEMS.TASKS; +with TMTEST; +with TEST_SUPPORT; + +procedure TMCK is + INIT_ID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; +begin + + RTEMS.TASKS.CREATE( + RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ), + 1, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.NO_PREEMPT, + RTEMS.DEFAULT_ATTRIBUTES, + INIT_ID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" ); + + + RTEMS.TASKS.START( + INIT_ID, + TMTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end TMCK; + diff --git a/testsuites/ada/tmtests/tmck/tmtest.adb b/testsuites/ada/tmtests/tmck/tmtest.adb new file mode 100644 index 0000000000..8da1ff220a --- /dev/null +++ b/testsuites/ada/tmtests/tmck/tmtest.adb @@ -0,0 +1,214 @@ +-- +-- TMTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Timer Check Test of the RTEMS +-- Timing Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with TIMER_DRIVER; +with INTERFACES; use INTERFACES; +with TEST_SUPPORT; +with TEXT_IO; +with TIME_TEST_SUPPORT; +with UNSIGNED32_IO; + +package body TMTEST is + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT_LINE( "*** TIME TEST CHECK ***" ); + + TIMER_DRIVER.SET_FIND_AVERAGE_OVERHEAD( TRUE ); + + TMTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + + RTEMS.TASKS.CREATE( + TMTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + TMTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" ); + + RTEMS.TASKS.START( + TMTEST.TASK_ID( 1 ), + TMTEST.TASK_1'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- TASK_1 +-- + + procedure TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + begin + + TMTEST.CHECK_READ_TIMER; + +TEST_SUPPORT.PAUSE; + + TIMER_DRIVER.INITIALIZE; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "NULL timer stopped at", + TMTEST.END_TIME, + 1, + 0, + 0 + ); + + TIMER_DRIVER.INITIALIZE; + for INDEX in 0 .. 1000 + loop + TIMER_DRIVER.EMPTY_FUNCTION; + end loop; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "LOOP (1000) timer stopped at", + TMTEST.END_TIME, + 1, + 0, + 0 + ); + + TIMER_DRIVER.INITIALIZE; + for INDEX in 0 .. 10000 + loop + TIMER_DRIVER.EMPTY_FUNCTION; + end loop; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "LOOP (10000) timer stopped at", + TMTEST.END_TIME, + 1, + 0, + 0 + ); + + TIMER_DRIVER.INITIALIZE; + for INDEX in 0 .. 50000 + loop + TIMER_DRIVER.EMPTY_FUNCTION; + end loop; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "LOOP (50000) timer stopped at", + TMTEST.END_TIME, + 1, + 0, + 0 + ); + + TIMER_DRIVER.INITIALIZE; + for INDEX in 0 .. 100000 + loop + TIMER_DRIVER.EMPTY_FUNCTION; + end loop; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + TIME_TEST_SUPPORT.PUT_TIME( + "LOOP (100000) timer stopped at", + TMTEST.END_TIME, + 1, + 0, + 0 + ); + + TEXT_IO.PUT_LINE( "*** END OF TIME TEST CHECK ***" ); + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TASK_1; + +-- +-- CHECK_READ_TIMER +-- + + procedure CHECK_READ_TIMER + is + TIME : RTEMS.UNSIGNED32; + begin + + for INDEX in TMTEST.DISTRIBUTION'FIRST .. TMTEST.DISTRIBUTION'LAST + loop + TMTEST.DISTRIBUTION( INDEX ) := 0; + end loop; + + for INDEX in 1 .. TMTEST.OPERATION_COUNT + loop + + loop + TIMER_DRIVER.INITIALIZE; + TMTEST.END_TIME := TIMER_DRIVER.READ_TIMER; + + exit when + TMTEST.END_TIME <= RTEMS.UNSIGNED32( TMTEST.DISTRIBUTION'LAST ); + + TEXT_IO.PUT( "TOO LONG (" ); + UNSIGNED32_IO.PUT( TMTEST.END_TIME ); + TEXT_IO.PUT_LINE( ")!!!" ); + end loop; + + TMTEST.DISTRIBUTION( TMTEST.END_TIME ) := + TMTEST.DISTRIBUTION( TMTEST.END_TIME ) + 1; + + end loop; + + TEXT_IO.PUT_LINE( + "Units may not be in microseconds for this test!!!" + ); + + TIME := 0; + + for INDEX in TMTEST.DISTRIBUTION'FIRST .. TMTEST.DISTRIBUTION'LAST + loop + if TMTEST.DISTRIBUTION( INDEX ) /= 0 then + TIME := TIME + (TMTEST.DISTRIBUTION( INDEX ) * INDEX); + UNSIGNED32_IO.PUT( INDEX ); + TEXT_IO.PUT( " " ); + UNSIGNED32_IO.PUT( TMTEST.DISTRIBUTION( INDEX ) ); + TEXT_IO.NEW_LINE; + end if; + end loop; + + TEXT_IO.PUT( "Total time = " ); + UNSIGNED32_IO.PUT( TIME ); + TEXT_IO.NEW_LINE; + + end CHECK_READ_TIMER; + +end TMTEST; diff --git a/testsuites/ada/tmtests/tmck/tmtest.ads b/testsuites/ada/tmtests/tmck/tmtest.ads new file mode 100644 index 0000000000..6eef577910 --- /dev/null +++ b/testsuites/ada/tmtests/tmck/tmtest.ads @@ -0,0 +1,96 @@ +-- +-- TMTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Timer Check Test of the RTEMS +-- Timing Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with RTEMS; +with RTEMS.TASKS; + +package TMTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- The following variable is set to the execution time returned +-- by the timer. +-- + + END_TIME : RTEMS.UNSIGNED32; + +-- +-- The following defines the number of iterations of each timed +-- operation to perform. +-- + + OPERATION_COUNT : constant RTEMS.UNSIGNED32 := 100000; + +-- +-- The following array is used to determine how many times +-- each time between 0 and 1000 microseconds was returned +-- when simply starting and stopping the timer. + + DISTRIBUTION : array ( RTEMS.UNSIGNED32 range 0 .. 10000 ) of RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- TASK_1 +-- +-- DESCRIPTION: +-- +-- This RTEMS task invokes CHECK_READ_TIMER before demonstrating +-- that increasing the order of magnitude of the number of loop +-- iterations performed has a corresponding impact on the time +-- reported by the timer driver. +-- + + procedure TASK_1 ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, TASK_1); + +-- +-- CHECK_READ_TIMER +-- +-- DESCRIPTION: +-- +-- This subprogram is used to determine the overhead associated +-- with starting and stopping the timer. It is also useful +-- for determining if unexpected times will be reported. +-- + + procedure CHECK_READ_TIMER; + +end TMTEST; |