forked from Imagelibrary/rtems
2010-12-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* .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.
This commit is contained in:
14
testsuites/psxtmtests/.cvsignore
Normal file
14
testsuites/psxtmtests/.cvsignore
Normal file
@@ -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
|
||||
11
testsuites/psxtmtests/ChangeLog
Normal file
11
testsuites/psxtmtests/ChangeLog
Normal file
@@ -0,0 +1,11 @@
|
||||
2010-12-06 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* .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.
|
||||
|
||||
17
testsuites/psxtmtests/Makefile.am
Normal file
17
testsuites/psxtmtests/Makefile.am
Normal file
@@ -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
|
||||
25
testsuites/psxtmtests/README
Normal file
25
testsuites/psxtmtests/README
Normal file
@@ -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.
|
||||
|
||||
85
testsuites/psxtmtests/configure.ac
Normal file
85
testsuites/psxtmtests/configure.ac
Normal file
@@ -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 <pthread.h>]])
|
||||
|
||||
# FIXME: newlib should supply declaration of pthread_atfork()
|
||||
AC_CHECK_DECLS([pthread_atfork],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# FIXME: RTEMS presumes pthread_attr_getcputime to be IEEE Std 1003.1
|
||||
# Likely an anachronism in RTEMS.
|
||||
AC_CHECK_DECLS([pthread_attr_getcputime],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# FIXME: RTEMS presumes pthread_attr_getcputime to be IEEE Std 1003.1
|
||||
# Likely an anachronism in RTEMS.
|
||||
AC_CHECK_DECLS([pthread_attr_getcputime],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# FIXME: RTEMS presumes pthread_attr_setcputime to be IEEE Std 1003.1
|
||||
# Likely an anachronism in RTEMS.
|
||||
AC_CHECK_DECLS([pthread_attr_setcputime],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# Added to pthreads after initial revision. May not be in toolset
|
||||
AC_CHECK_DECLS([pthread_attr_getstack],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# Added to pthreads after initial revision. May not be in toolset
|
||||
AC_CHECK_DECLS([pthread_attr_setstack],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# Added to pthreads after initial revision. May not be in toolset
|
||||
AC_CHECK_DECLS([pthread_attr_getguardsize],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# Added to pthreads after initial revision. May not be in toolset
|
||||
AC_CHECK_DECLS([pthread_attr_setguardsize],[],[],[[#include <pthread.h>]])
|
||||
|
||||
# FIXME: adjtime is a non-standardized BSD/Linux extension
|
||||
# RTEMS should not rely on adjtime
|
||||
AC_CHECK_DECLS([adjtime],[],[],[[#include <sys/time.h>]])
|
||||
|
||||
# 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 <sys/mman.h>]])
|
||||
|
||||
# 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 <unistd.h>])
|
||||
|
||||
# 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
|
||||
2
testsuites/psxtmtests/psxtmmutex02/.cvsignore
Normal file
2
testsuites/psxtmtests/psxtmmutex02/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
30
testsuites/psxtmtests/psxtmmutex02/Makefile.am
Normal file
30
testsuites/psxtmtests/psxtmmutex02/Makefile.am
Normal file
@@ -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
|
||||
124
testsuites/psxtmtests/psxtmmutex02/init.c
Normal file
124
testsuites/psxtmtests/psxtmmutex02/init.c
Normal file
@@ -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 <coverhd.h>
|
||||
#include <tmacros.h>
|
||||
#include <timesys.h>
|
||||
#include "test_support.h"
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <rtems/timerdrv.h>
|
||||
|
||||
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 <rtems/confdefs.h>
|
||||
/* end of file */
|
||||
14
testsuites/psxtmtests/psxtmmutex02/psxtmmutex02.doc
Normal file
14
testsuites/psxtmtests/psxtmmutex02/psxtmmutex02.doc
Normal file
@@ -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
|
||||
80
testsuites/psxtmtests/psxtmtests_plan.csv
Normal file
80
testsuites/psxtmtests/psxtmtests_plan.csv
Normal file
@@ -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",
|
||||
|
2
testsuites/psxtmtests/psxtmthread01/.cvsignore
Normal file
2
testsuites/psxtmtests/psxtmthread01/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
30
testsuites/psxtmtests/psxtmthread01/Makefile.am
Normal file
30
testsuites/psxtmtests/psxtmthread01/Makefile.am
Normal file
@@ -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
|
||||
71
testsuites/psxtmtests/psxtmthread01/init.c
Normal file
71
testsuites/psxtmtests/psxtmthread01/init.c
Normal file
@@ -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 <coverhd.h>
|
||||
#include <tmacros.h>
|
||||
#include <timesys.h>
|
||||
#include "test_support.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
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 <rtems/confdefs.h>
|
||||
/* end of file */
|
||||
14
testsuites/psxtmtests/psxtmthread01/psxtmthread01.doc
Normal file
14
testsuites/psxtmtests/psxtmthread01/psxtmthread01.doc
Normal file
@@ -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
|
||||
2
testsuites/psxtmtests/psxtmthread03/.cvsignore
Normal file
2
testsuites/psxtmtests/psxtmthread03/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
30
testsuites/psxtmtests/psxtmthread03/Makefile.am
Normal file
30
testsuites/psxtmtests/psxtmthread03/Makefile.am
Normal file
@@ -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
|
||||
107
testsuites/psxtmtests/psxtmthread03/init.c
Normal file
107
testsuites/psxtmtests/psxtmthread03/init.c
Normal file
@@ -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 <coverhd.h>
|
||||
#include <tmacros.h>
|
||||
#include <timesys.h>
|
||||
#include "test_support.h"
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <rtems/timerdrv.h>
|
||||
|
||||
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 <rtems/confdefs.h>
|
||||
/* end of file */
|
||||
14
testsuites/psxtmtests/psxtmthread03/psxtmthread03.doc
Normal file
14
testsuites/psxtmtests/psxtmthread03/psxtmthread03.doc
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user