2011-07-29 Ricardo Aguirre <el.mastin@ymail.com>

PR 1863/tests
	* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of
	pthread_barrier_wait - releasing, no preempt
	* psxtmbarrier03/.cvsignore, psxtmbarrier03/Makefile.am,
	psxtmbarrier03/init.c, psxtmbarrier03/psxtmbarrier03.doc: New files.
This commit is contained in:
Joel Sherrill
2011-07-29 16:54:32 +00:00
parent e694c2d423
commit 4f6cc11d36
8 changed files with 160 additions and 1 deletions
+8
View File
@@ -1,3 +1,11 @@
2011-07-29 Ricardo Aguirre <el.mastin@ymail.com>
PR 1863/tests
* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of
pthread_barrier_wait - releasing, no preempt
* psxtmbarrier03/.cvsignore, psxtmbarrier03/Makefile.am,
psxtmbarrier03/init.c, psxtmbarrier03/psxtmbarrier03.doc: New files.
2011-07-29 Ricardo Aguirre <el.mastin@ymail.com>
PR 1859/tests
+1
View File
@@ -9,6 +9,7 @@ SUBDIRS =
if HAS_POSIX
SUBDIRS += psxtmbarrier01
SUBDIRS += psxtmbarrier02
SUBDIRS += psxtmbarrier03
SUBDIRS += psxtmkey01
SUBDIRS += psxtmkey02
SUBDIRS += psxtmmutex01
+1
View File
@@ -81,6 +81,7 @@ AC_SUBST(OPERATION_COUNT)
AC_CONFIG_FILES([Makefile
psxtmbarrier01/Makefile
psxtmbarrier02/Makefile
psxtmbarrier03/Makefile
psxtmkey01/Makefile
psxtmkey02/Makefile
psxtmmutex01/Makefile
@@ -0,0 +1,2 @@
Makefile
Makefile.in
@@ -0,0 +1,30 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = psxtmbarrier03
psxtmbarrier03_SOURCES = init.c ../../tmtests/include/timesys.h \
../../support/src/tmtests_empty_function.c \
../../support/src/tmtests_support.c
dist_rtems_tests_DATA = psxtmbarrier03.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 = $(psxtmbarrier03_OBJECTS) $(psxtmbarrier03_LDADD)
LINK_LIBS = $(psxtmbarrier03_LDLIBS)
psxtmbarrier03$(EXEEXT): $(psxtmbarrier03_OBJECTS) $(psxtmbarrier03_DEPENDENCIES)
@rm -f psxtmbarrier03$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am
+103
View File
@@ -0,0 +1,103 @@
/*
* COPYRIGHT (c) 1989-2011.
* 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$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <coverhd.h>
#include <tmacros.h>
#include <timesys.h>
#include "test_support.h"
#include <pthread.h>
#include <sched.h>
#include <rtems/timerdrv.h>
#define N 2
pthread_barrier_t barrier;
void *Blocker(
void *argument
)
{
(void) pthread_barrier_wait( &barrier );
rtems_test_assert( FALSE );
return NULL;
}
void *POSIX_Init(
void *argument
)
{
int status;
pthread_t threadId;
long end_time;
puts( "\n\n*** POSIX TIME TEST PSXTMBARRIER 03 ***" );
status = pthread_create( &threadId, NULL, Blocker, NULL );
rtems_test_assert( status == 0 );
/*
* Deliberately create the barrier after the threads. This way if the
* threads do run before we intend, they will get an error.
* The barrier will be released on the Nth thread blocking.
*/
status = pthread_barrier_init( &barrier, NULL, N );
rtems_test_assert( status == 0 );
/*
* Let the other thread start so the thread startup overhead,
* is accounted for. When we return, we can start the benchmark.
*/
sched_yield();
/* let other thread run */
/*
* Because this is the Nth thread at the barrier, this is an
* unblocking operation.
*/
benchmark_timer_initialize();
status = pthread_barrier_wait( &barrier );
end_time = benchmark_timer_read();
/*
* Upon successful completion return value, the status should be
* PTHREAD_BARRIER_SERIAL_THREAD.
*/
rtems_test_assert( status == PTHREAD_BARRIER_SERIAL_THREAD );
put_time(
"pthread_barrier_wait releasing, no preempt",
end_time,
1,
0,
0
);
puts( "*** END OF POSIX TIME TEST PSXTMBARRIER 03 ***" );
rtems_test_exit( 0 );
return NULL;
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
#define CONFIGURE_MAXIMUM_POSIX_BARRIERS 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */
@@ -0,0 +1,14 @@
#
# $Id$
#
# COPYRIGHT (c) 1989-2011.
# 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:
+ pthread_barrier_wait releasing, no preempt
+1 -1
View File
@@ -53,7 +53,7 @@
"pthread_barrier_init","psxtmbarrier01","psxtmtest_init_destroy","Yes"
"pthread_barrier_destroy","psxtmbarrier01","psxtmtest_init_destroy","Yes"
"pthread_barrier_wait - blocking","psxtmbarrier02","psxtmtest_blocking","Yes"
"pthread_barrier_wait - releasing, no preempt","psxtmbarrier03","psxtmtest_unblocking_nopreempt",
"pthread_barrier_wait - releasing, no preempt","psxtmbarrier03","psxtmtest_unblocking_nopreempt","Yes"
"pthread_barrier_wait - releasing, preempt","psxtmbarrier04","psxtmtest_unblocking_preempt",
,,,
"pthread_spin_init",,"psxtmtest_init_destroy",
1 Test Case Test Template Implemented
53 pthread_barrier_init psxtmbarrier01 psxtmtest_init_destroy Yes
54 pthread_barrier_destroy psxtmbarrier01 psxtmtest_init_destroy Yes
55 pthread_barrier_wait - blocking psxtmbarrier02 psxtmtest_blocking Yes
56 pthread_barrier_wait - releasing, no preempt psxtmbarrier03 psxtmtest_unblocking_nopreempt Yes
57 pthread_barrier_wait - releasing, preempt psxtmbarrier04 psxtmtest_unblocking_preempt
58
59 pthread_spin_init psxtmtest_init_destroy