From 519928c33386f1d6d5ef6cb9d34d93d2ef89c8a0 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 6 Dec 2010 16:35:31 +0000 Subject: 2010-12-06 Joel Sherrill * .cvsignore, ChangeLog, Makefile.am, README, configure.ac, psxtmtests_plan.csv, psxtmmutex02/.cvsignore, psxtmmutex02/Makefile.am, psxtmmutex02/init.c, psxtmmutex02/psxtmmutex02.doc, psxtmthread01/.cvsignore, psxtmthread01/Makefile.am, psxtmthread01/init.c, psxtmthread01/psxtmthread01.doc, psxtmthread03/.cvsignore, psxtmthread03/Makefile.am, psxtmthread03/init.c, psxtmthread03/psxtmthread03.doc: New files. --- testsuites/psxtmtests/.cvsignore | 14 +++ testsuites/psxtmtests/ChangeLog | 11 ++ testsuites/psxtmtests/Makefile.am | 17 +++ testsuites/psxtmtests/README | 25 +++++ testsuites/psxtmtests/configure.ac | 85 ++++++++++++++ testsuites/psxtmtests/psxtmmutex02/.cvsignore | 2 + testsuites/psxtmtests/psxtmmutex02/Makefile.am | 30 +++++ testsuites/psxtmtests/psxtmmutex02/init.c | 124 +++++++++++++++++++++ .../psxtmtests/psxtmmutex02/psxtmmutex02.doc | 14 +++ testsuites/psxtmtests/psxtmtests_plan.csv | 80 +++++++++++++ testsuites/psxtmtests/psxtmthread01/.cvsignore | 2 + testsuites/psxtmtests/psxtmthread01/Makefile.am | 30 +++++ testsuites/psxtmtests/psxtmthread01/init.c | 71 ++++++++++++ .../psxtmtests/psxtmthread01/psxtmthread01.doc | 14 +++ testsuites/psxtmtests/psxtmthread03/.cvsignore | 2 + testsuites/psxtmtests/psxtmthread03/Makefile.am | 30 +++++ testsuites/psxtmtests/psxtmthread03/init.c | 107 ++++++++++++++++++ .../psxtmtests/psxtmthread03/psxtmthread03.doc | 14 +++ 18 files changed, 672 insertions(+) create mode 100644 testsuites/psxtmtests/.cvsignore create mode 100644 testsuites/psxtmtests/ChangeLog create mode 100644 testsuites/psxtmtests/Makefile.am create mode 100644 testsuites/psxtmtests/README create mode 100644 testsuites/psxtmtests/configure.ac create mode 100644 testsuites/psxtmtests/psxtmmutex02/.cvsignore create mode 100644 testsuites/psxtmtests/psxtmmutex02/Makefile.am create mode 100644 testsuites/psxtmtests/psxtmmutex02/init.c create mode 100644 testsuites/psxtmtests/psxtmmutex02/psxtmmutex02.doc create mode 100644 testsuites/psxtmtests/psxtmtests_plan.csv create mode 100644 testsuites/psxtmtests/psxtmthread01/.cvsignore create mode 100644 testsuites/psxtmtests/psxtmthread01/Makefile.am create mode 100644 testsuites/psxtmtests/psxtmthread01/init.c create mode 100644 testsuites/psxtmtests/psxtmthread01/psxtmthread01.doc create mode 100644 testsuites/psxtmtests/psxtmthread03/.cvsignore create mode 100644 testsuites/psxtmtests/psxtmthread03/Makefile.am create mode 100644 testsuites/psxtmtests/psxtmthread03/init.c create mode 100644 testsuites/psxtmtests/psxtmthread03/psxtmthread03.doc (limited to 'testsuites') diff --git a/testsuites/psxtmtests/.cvsignore b/testsuites/psxtmtests/.cvsignore new file mode 100644 index 0000000000..bfdfd995be --- /dev/null +++ b/testsuites/psxtmtests/.cvsignore @@ -0,0 +1,14 @@ +aclocal.m4 +autom4te*.cache +config.cache +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +Makefile +Makefile.in +missing +mkinstalldirs diff --git a/testsuites/psxtmtests/ChangeLog b/testsuites/psxtmtests/ChangeLog new file mode 100644 index 0000000000..8ef9b848e4 --- /dev/null +++ b/testsuites/psxtmtests/ChangeLog @@ -0,0 +1,11 @@ +2010-12-06 Joel Sherrill + + * .cvsignore, ChangeLog, Makefile.am, README, configure.ac, + psxtmtests_plan.csv, psxtmmutex02/.cvsignore, + psxtmmutex02/Makefile.am, psxtmmutex02/init.c, + psxtmmutex02/psxtmmutex02.doc, psxtmthread01/.cvsignore, + psxtmthread01/Makefile.am, psxtmthread01/init.c, + psxtmthread01/psxtmthread01.doc, psxtmthread03/.cvsignore, + psxtmthread03/Makefile.am, psxtmthread03/init.c, + psxtmthread03/psxtmthread03.doc: New files. + diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am new file mode 100644 index 0000000000..9a9e269a6b --- /dev/null +++ b/testsuites/psxtmtests/Makefile.am @@ -0,0 +1,17 @@ +## +## $Id$ +## + +ACLOCAL_AMFLAGS = -I ../aclocal + +if HAS_POSIX +SUBDIRS = \ + psxtmmutex02 \ + psxtmthread01 psxtmthread03 +endif + +DIST_SUBDIRS = $(SUBDIRS) +# EXTRA_DIST = psxfatal_support/init.c psxfatal_support/system.h + +include $(top_srcdir)/../automake/subdirs.am +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtmtests/README b/testsuites/psxtmtests/README new file mode 100644 index 0000000000..428c41eaac --- /dev/null +++ b/testsuites/psxtmtests/README @@ -0,0 +1,25 @@ +# +# $Id$ +# + +This directory contains the RTEMS POSIX Timing Test Suite. +The tests in this directory are used to measure the execution +time of RTEMS directive and some critical internal functions. +The results of these test are useful for comparison of RTEMS +performance + ++ between versions of RTEMS ++ between different boards ++ across different architectures + +These tests attempt to benchmark RTEMS as the user would. They measure +the execution time for a directive (under various circumstances) +from the time RTEMS is entered until it is executed. Where possible, +the time is the average of at least 100 invocations of the directive. + +The accuracy of the times reported by these benchmarks is very dependent +on the resolution of the timer being used. It is also important to +insure that all sources of hardware interrupts are disabled during +execution of the tests. This insures that the directive time reported +does not include any interrupt time. + diff --git a/testsuites/psxtmtests/configure.ac b/testsuites/psxtmtests/configure.ac new file mode 100644 index 0000000000..fb8fa75022 --- /dev/null +++ b/testsuites/psxtmtests/configure.ac @@ -0,0 +1,85 @@ +## Process this file with autoconf to produce a configure script. +## +## $Id$ + +AC_PREREQ(2.60) +AC_INIT([rtems-c-src-tests-psxtmtests],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla]) +AC_CONFIG_SRCDIR([psxtmmutex02]) +RTEMS_TOP([../..],[..]) + +RTEMS_CANONICAL_TARGET_CPU + +AM_INIT_AUTOMAKE([no-define foreign 1.10]) +AM_MAINTAINER_MODE + +RTEMS_ENV_RTEMSBSP + +RTEMS_PROJECT_ROOT + +RTEMS_PROG_CC_FOR_TARGET + +RTEMS_CANONICALIZE_TOOLS + +RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) + +RTEMS_CHECK_CPUOPTS([RTEMS_POSIX_API]) +AM_CONDITIONAL(HAS_POSIX,test x"${rtems_cv_RTEMS_POSIX_API}" = x"yes") + +# but newlib doesn't have sys/mman.h +AC_CHECK_HEADERS([sys/mman.h]) + +# FIXME: newlib should supply declaration of pthread_rwlock_unlock() +AC_CHECK_DECLS([pthread_rwlock_unlock],[],[],[[#include ]]) + +# FIXME: newlib should supply declaration of pthread_atfork() +AC_CHECK_DECLS([pthread_atfork],[],[],[[#include ]]) + +# FIXME: RTEMS presumes pthread_attr_getcputime to be IEEE Std 1003.1 +# Likely an anachronism in RTEMS. +AC_CHECK_DECLS([pthread_attr_getcputime],[],[],[[#include ]]) + +# FIXME: RTEMS presumes pthread_attr_getcputime to be IEEE Std 1003.1 +# Likely an anachronism in RTEMS. +AC_CHECK_DECLS([pthread_attr_getcputime],[],[],[[#include ]]) + +# FIXME: RTEMS presumes pthread_attr_setcputime to be IEEE Std 1003.1 +# Likely an anachronism in RTEMS. +AC_CHECK_DECLS([pthread_attr_setcputime],[],[],[[#include ]]) + +# Added to pthreads after initial revision. May not be in toolset +AC_CHECK_DECLS([pthread_attr_getstack],[],[],[[#include ]]) + +# Added to pthreads after initial revision. May not be in toolset +AC_CHECK_DECLS([pthread_attr_setstack],[],[],[[#include ]]) + +# Added to pthreads after initial revision. May not be in toolset +AC_CHECK_DECLS([pthread_attr_getguardsize],[],[],[[#include ]]) + +# Added to pthreads after initial revision. May not be in toolset +AC_CHECK_DECLS([pthread_attr_setguardsize],[],[],[[#include ]]) + +# FIXME: adjtime is a non-standardized BSD/Linux extension +# RTEMS should not rely on adjtime +AC_CHECK_DECLS([adjtime],[],[],[[#include ]]) + +# FIXME: IEEE Std 1003.1-2008 mandates mprotect in sys/mman.h, +# RTEMS provides a stub, despite newlib doesn't have sys/mman.h +AC_CHECK_DECLS([mprotect],[],[],[[#include ]]) + +# FIXME: IEEE Std 1003.1-2008 mandates seteuid in unistd.h +# RTEMS provides it, despite newlib doesn't declare it. +AC_CHECK_DECLS([seteuid],[],[],[#include ]) + +# FIXME: We should get rid of this. It's a cludge. +AC_CHECK_SIZEOF([off_t]) + +OPERATION_COUNT=${OPERATION_COUNT-100} +AC_SUBST(OPERATION_COUNT) + +# Explicitly list all Makefiles here +AC_CONFIG_FILES([Makefile +psxtmmutex02/Makefile +psxtmthread01/Makefile +psxtmthread03/Makefile +]) +AC_OUTPUT diff --git a/testsuites/psxtmtests/psxtmmutex02/.cvsignore b/testsuites/psxtmtests/psxtmmutex02/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex02/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtmtests/psxtmmutex02/Makefile.am b/testsuites/psxtmtests/psxtmmutex02/Makefile.am new file mode 100644 index 0000000000..8072e1806d --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex02/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtmmutex02 +psxtmmutex02_SOURCES = init.c ../../tmtests/include/timesys.h \ + ../../support/src/tmtests_empty_function.c \ + ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = psxtmmutex02.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +OPERATION_COUNT = @OPERATION_COUNT@ +AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include +AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT) +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxtmmutex02_OBJECTS) $(psxtmmutex02_LDADD) +LINK_LIBS = $(psxtmmutex02_LDLIBS) + +psxtmmutex02$(EXEEXT): $(psxtmmutex02_OBJECTS) $(psxtmmutex02_DEPENDENCIES) + @rm -f psxtmmutex02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtmtests/psxtmmutex02/init.c b/testsuites/psxtmtests/psxtmmutex02/init.c new file mode 100644 index 0000000000..d505757be8 --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex02/init.c @@ -0,0 +1,124 @@ +/* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include +#include +#include +#include "test_support.h" +#include +#include +#include + +pthread_mutex_t MutexId; + +void *Low( + void *argument +) +{ + long end_time; + + /* + * Now we have finished the thread startup overhead, + * so let other threads run. When we return, we can + * finish the benchmark. + */ + sched_yield(); + /* let other threads run */ + + end_time = benchmark_timer_read(); + + put_time( + "pthread_mutex_lock (unavailable)", + end_time, + OPERATION_COUNT, + 0, + 0 + ); + + puts( "*** END OF POSIX TIME TEST MUTEX 02 ***" ); + + rtems_test_exit( 0 ); + return NULL; +} + +void *Middle( + void *argument +) +{ + int status; + + /* + * Now we have finished the thread startup overhead, + * so let other threads run. When we return, we can + * finish the benchmark. + */ + sched_yield(); + /* let other threads run */ + + status = pthread_mutex_lock( &MutexId ); + rtems_test_assert( !status ); + + return NULL; +} + +void *POSIX_Init( + void *argument +) +{ + int i; + int status; + pthread_t threadId; + + puts( "\n\n*** POSIX TIME TEST MUTEX 02 ***" ); + + for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) { + status = pthread_create( &threadId, NULL, Middle, NULL ); + rtems_test_assert( !status ); + } + + status = pthread_create( &threadId, NULL, Low, NULL ); + rtems_test_assert( !status ); + + /* + * Deliberately create the mutex after the threads. This way if the + * threads do run before we intend, they will get an error. + */ + status = pthread_mutex_init( &MutexId, NULL ); + rtems_test_assert( !status ); + + /* + * Let the other threads start so the thread startup overhead, + * is accounted for. When we return, we can start the benchmark. + */ + sched_yield(); + /* let other threads run */ + + /* start the timer and switch through all the other tasks */ + benchmark_timer_initialize(); + status = pthread_mutex_lock( &MutexId ); + rtems_test_assert( !status ); + + return NULL; +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2 +#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include + /* end of file */ diff --git a/testsuites/psxtmtests/psxtmmutex02/psxtmmutex02.doc b/testsuites/psxtmtests/psxtmmutex02/psxtmmutex02.doc new file mode 100644 index 0000000000..1520da7e57 --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex02/psxtmmutex02.doc @@ -0,0 +1,14 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# On-Line Applications Research Corporation (OAR). +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.rtems.com/license/LICENSE. +# + +This test benchmarks the following operations: + ++ TBD diff --git a/testsuites/psxtmtests/psxtmtests_plan.csv b/testsuites/psxtmtests/psxtmtests_plan.csv new file mode 100644 index 0000000000..d3e5323932 --- /dev/null +++ b/testsuites/psxtmtests/psxtmtests_plan.csv @@ -0,0 +1,80 @@ +"Test Case","Test","Template","Implemented" +"pthread_mutex_init","psxtmmutex01","psxtmtest_init_destroy", +"pthread_mutex_destroy","psxtmmutex01","psxtmtest_init_destroy", +"pthread_mutex_lock - available","psxtmmutex03","psxtmtest_single", +"pthread_mutex_lock - not available, block","psxtmmutex02","psxtmtest_blocking","Yes" +"pthread_mutex_trylock - available","psxtmmutex03","psxtmtest_single", +"pthread_mutex_trylock - not available","psxtmmutex03","psxtmtest_single", +"pthread_mutex_unlock - no threads waiting","psxtmmutex03","psxtmtest_single", +"pthread_mutex_unlock - thread waiting, no preempt","psxtmmutex04",, +"pthread_mutex_unlock - thread waiting, preempt","psxtmmutex05",, +"pthread_mutex_timedlock - available","psxtmmutex03","psxtmtest_single", +"pthread_mutex_timedlock - not available, block","psxtmmutex06","psxtmtest_blocking", +"pthread_mutex_setprioceiling",,, +"pthread_mutex_getprioceiling",,, +,,, +"pthread_cond_init",,"psxtmtest_init_destroy", +"pthread_cond_destroy",,"psxtmtest_init_destroy", +"pthread_cond_signal - no threads waiting",,, +"pthread_cond_signal - thread waiting, no preempt",,, +"pthread_cond_signal - thread waiting, preempt",,, +"pthread_cond_broadcast",,, +"pthread_cond_wait - blocks",,, +"pthread_cond_timedwait - blocks",,, +,,, +"pthread_create - no preempt","psxtmthread01","psxtmtest_single","Yes" +"pthread_create - preempt","psxtmthread02","psxtmtest_single", +"pthread_join","psxtmthread03",, +"pthread_detach",,, +"pthread_exit",,, +"pthread_self",,, +"pthread_equal",,, +"pthread_getschedparam",,, +"pthread_setschedparam - no thread switch",,, +"pthread_setschedparam - lower own priority, preempt",,, +"pthread_setschedparam - raise other priority, preempt",,, +,,, +"pthread_once",,, +,,, +"pthread_key_create",,"psxtmtest_init_destroy", +"pthread_setspecific",,, +"pthread_getspecific",,, +"pthread_key_delete",,"psxtmtest_init_destroy", +,,, +"pthread_cancel",,, +"pthread_setcancelstate",,, +"pthread_setcanceltype",,, +"pthread_testcancel",,, +"pthread_cleanup_push",,, +"pthread_cleanup_pop",,, +,,, +"pthread_getcpuclockid",,, +,,, +"pthread_barrier_init",,"psxtmtest_init_destroy", +"pthread_barrier_destroy",,"psxtmtest_init_destroy", +"pthread_barrier_wait",,, +,,, +"pthread_spin_init",,"psxtmtest_init_destroy", +"pthread_spin_destroy",,"psxtmtest_init_destroy", +"pthread_spin_lock - available",,, +"pthread_spin_trylock - available",,, +"pthread_spin_trylock - not available",,, +"pthread_spin_unlock",,, +,,, +"pthread_rwlock_init",,"psxtmtest_init_destroy", +"pthread_rwlock_destroy",,"psxtmtest_init_destroy", +"pthread_rwlock_rdlock - available",,, +"pthread_rwlock_rdlock - not available, blocks",,"psxtmtest_blocking", +"pthread_rwlock_tryrdlock - available",,, +"pthread_rwlock_tryrdlock - not available",,, +"pthread_rwlock_timedrdlock - available",,, +"pthread_rwlock_timedrdlock - not available, blocks",,"psxtmtest_blocking", +"pthread_rwlock_unlock - no threads waiting",,, +"pthread_rwlock_unlock - thread waiting, no preempt",,, +"pthread_rwlock_unlock - thread waiting, preempt",,, +"pthread_rwlock_wrlock - available",,, +"pthread_rwlock_wrlock - not available, blocks",,"psxtmtest_blocking", +"pthread_rwlock_trywrlock - available",,, +"pthread_rwlock_trywrlock - not available",,, +"pthread_rwlock_timedwrlock - available",,, +"pthread_rwlock_timedwrlock - not available, blocks",,"psxtmtest_blocking", diff --git a/testsuites/psxtmtests/psxtmthread01/.cvsignore b/testsuites/psxtmtests/psxtmthread01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtmtests/psxtmthread01/Makefile.am b/testsuites/psxtmtests/psxtmthread01/Makefile.am new file mode 100644 index 0000000000..b46d1a3351 --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread01/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtmthread01 +psxtmthread01_SOURCES = init.c ../../tmtests/include/timesys.h \ + ../../support/src/tmtests_empty_function.c \ + ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = psxtmthread01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +OPERATION_COUNT = @OPERATION_COUNT@ +AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include +AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT) +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxtmthread01_OBJECTS) $(psxtmthread01_LDADD) +LINK_LIBS = $(psxtmthread01_LDLIBS) + +psxtmthread01$(EXEEXT): $(psxtmthread01_OBJECTS) $(psxtmthread01_DEPENDENCIES) + @rm -f psxtm01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtmtests/psxtmthread01/init.c b/testsuites/psxtmtests/psxtmthread01/init.c new file mode 100644 index 0000000000..97a4a49a30 --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread01/init.c @@ -0,0 +1,71 @@ +/* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include +#include +#include +#include "test_support.h" + +#include + +pthread_t ThreadId; + +void *TestThread( + void *argument +) +{ + return NULL; +} + + +void benchmark_pthread_create( + int iteration, + void *argument +) +{ + int status; + + status = pthread_create( &ThreadId, NULL, TestThread, NULL ); + rtems_test_assert( !status ); +} + +void *POSIX_Init( + void *argument +) +{ + puts( "\n\n*** POSIX TIME TEST THREAD 01 ***" ); + + rtems_time_test_measure_operation( + "pthread_create", + benchmark_pthread_create, + NULL, + 1, + 0 + ); + + + puts( "*** END OF POSIX TIME TEST THREAD 01 ***" ); + + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include +/* end of file */ diff --git a/testsuites/psxtmtests/psxtmthread01/psxtmthread01.doc b/testsuites/psxtmtests/psxtmthread01/psxtmthread01.doc new file mode 100644 index 0000000000..1520da7e57 --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread01/psxtmthread01.doc @@ -0,0 +1,14 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# On-Line Applications Research Corporation (OAR). +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.rtems.com/license/LICENSE. +# + +This test benchmarks the following operations: + ++ TBD diff --git a/testsuites/psxtmtests/psxtmthread03/.cvsignore b/testsuites/psxtmtests/psxtmthread03/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread03/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtmtests/psxtmthread03/Makefile.am b/testsuites/psxtmtests/psxtmthread03/Makefile.am new file mode 100644 index 0000000000..46a4de404a --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread03/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtmthread03 +psxtmthread03_SOURCES = init.c ../../tmtests/include/timesys.h \ + ../../support/src/tmtests_empty_function.c \ + ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = psxtmthread03.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +OPERATION_COUNT = @OPERATION_COUNT@ +AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include +AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT) +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxtmthread03_OBJECTS) $(psxtmthread03_LDADD) +LINK_LIBS = $(psxtmthread03_LDLIBS) + +psxtmthread03$(EXEEXT): $(psxtmthread03_OBJECTS) $(psxtmthread03_DEPENDENCIES) + @rm -f psxtmthread03$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtmtests/psxtmthread03/init.c b/testsuites/psxtmtests/psxtmthread03/init.c new file mode 100644 index 0000000000..084650b664 --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread03/init.c @@ -0,0 +1,107 @@ +/* + * COPYRIGHT (c) 1989-2010. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include +#include +#include +#include "test_support.h" +#include +#include +#include + +void *Low( + void *argument +) +{ + long end_time; + + /* + * Now we have finished the thread startup overhead, + * so let other threads run. When we return, we can + * finish the benchmark. + */ + sched_yield(); + /* let other threads run */ + + end_time = benchmark_timer_read(); + + put_time( + "pthread_exit", + end_time, + OPERATION_COUNT, + 0, + 0 + ); + + puts( "*** END OF POSIX TIME TEST TM02 ***" ); + rtems_test_exit( 0 ); + return NULL; +} + +void *Middle( + void *argument +) +{ + /* + * Now we have finished the thread startup overhead, + * so let other threads run. When we return, we can + * finish the benchmark. + */ + sched_yield(); + /* let other threads run */ + + pthread_exit( NULL ); + return NULL; +} + +void *POSIX_Init( + void *argument +) +{ + int i; + int status; + pthread_t threadId; + + puts( "\n\n*** POSIX TIME TEST TM02 ***" ); + + for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) { + status = pthread_create( &threadId, NULL, Middle, NULL ); + rtems_test_assert( !status ); + } + + status = pthread_create( &threadId, NULL, Low, NULL ); + rtems_test_assert( !status ); + + /* + * Let the other threads start so the thread startup overhead, + * is accounted for. When we return, we can start the benchmark. + */ + sched_yield(); + /* let other threads run */ + + /* start the timer and switch through all the other tasks */ + benchmark_timer_initialize(); + pthread_exit( NULL ); + return NULL; +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include + /* end of file */ diff --git a/testsuites/psxtmtests/psxtmthread03/psxtmthread03.doc b/testsuites/psxtmtests/psxtmthread03/psxtmthread03.doc new file mode 100644 index 0000000000..1520da7e57 --- /dev/null +++ b/testsuites/psxtmtests/psxtmthread03/psxtmthread03.doc @@ -0,0 +1,14 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2010. +# On-Line Applications Research Corporation (OAR). +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.rtems.com/license/LICENSE. +# + +This test benchmarks the following operations: + ++ TBD -- cgit v1.2.3