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

PR 1840/tests
	* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of key
	set and get.
	* psxtmkey02/.cvsignore, psxtmkey02/Makefile.am, psxtmkey02/init.c,
	psxtmkey02/psxtmkey02.doc: New files.
This commit is contained in:
Joel Sherrill
2011-07-19 13:04:20 +00:00
parent fe89930574
commit 43469aff7c
8 changed files with 159 additions and 2 deletions

View File

@@ -1,3 +1,11 @@
2011-07-19 Ricardo Aguirre <el.mastin@ymail.com>
PR 1840/tests
* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of key
set and get.
* psxtmkey02/.cvsignore, psxtmkey02/Makefile.am, psxtmkey02/init.c,
psxtmkey02/psxtmkey02.doc: New files.
2011-07-18 Jennifer Averett <Jennifer.Averett@OARcorp.com>
* configure.ac: Remove psxtmmutex04 until PR 1836 is processed.

View File

@@ -7,6 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS =
if HAS_POSIX
SUBDIRS += psxtmkey02
SUBDIRS += psxtmmutex01
SUBDIRS += psxtmmutex02
SUBDIRS += psxtmmutex03

View File

@@ -79,6 +79,7 @@ AC_SUBST(OPERATION_COUNT)
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
psxtmkey02/Makefile
psxtmmutex01/Makefile
psxtmmutex02/Makefile
psxtmmutex03/Makefile

View File

@@ -0,0 +1,2 @@
Makefile
Makefile.in

View File

@@ -0,0 +1,30 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = psxtmkey02
psxtmkey02_SOURCES = init.c ../../tmtests/include/timesys.h \
../../support/src/tmtests_empty_function.c \
../../support/src/tmtests_support.c
dist_rtems_tests_DATA = psxtmkey02.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 = $(psxtmkey02_OBJECTS) $(psxtmkey02_LDADD)
LINK_LIBS = $(psxtmkey02_LDLIBS)
psxtmkey02$(EXEEXT): $(psxtmkey02_OBJECTS) $(psxtmkey02_DEPENDENCIES)
@rm -f psxtmkey02$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,99 @@
/*
* 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 <timesys.h>
#include <rtems/timerdrv.h>
#include <errno.h>
#include <pthread.h>
#include "test_support.h"
pthread_key_t Key;
int Value1;
void benchmark_pthread_setspecific( void *value_p )
{
long end_time;
int status;
benchmark_timer_initialize();
status = pthread_setspecific( Key, value_p );
end_time = benchmark_timer_read();
rtems_test_assert( status == 0 );
put_time(
"pthread_setspecific",
end_time,
1, /* Only executed once */
0,
0
);
}
void benchmark_pthread_getspecific( void *expected )
{
long end_time;
void *value_p;
benchmark_timer_initialize();
value_p = pthread_getspecific( Key );
end_time = benchmark_timer_read();
rtems_test_assert( value_p == expected );
put_time(
"pthread_getspecific",
end_time,
1, /* Only executed once */
0,
0
);
}
void *POSIX_Init(
void *argument
)
{
int status;
puts( "\n\n*** POSIX TIME TEST PSXTMKEY02 ***" );
/* create the key */
status = pthread_key_create( &Key, NULL );
rtems_test_assert( status == 0 );
benchmark_pthread_getspecific( NULL );
benchmark_pthread_setspecific( &Value1 );
benchmark_pthread_getspecific( &Value1 );
/* destroy the key */
status = pthread_key_delete( Key );
rtems_test_assert( status == 0 );
puts( "*** END OF POSIX TIME TEST PSXTMKEY02 ***" );
rtems_test_exit(0);
}
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */

View File

@@ -0,0 +1,16 @@
#
# $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_setspecific
+ pthread_getspecific

View File

@@ -37,8 +37,8 @@
"pthread_once",,,
,,,
"pthread_key_create","psxtmkey01","psxtmtest_init_destroy",
"pthread_setspecific","psxtmkey02","psxtmtest_single",
"pthread_getspecific","psxtmkey02","psxtmtest_single",
"pthread_setspecific","psxtmkey02","psxtmtest_single","Yes"
"pthread_getspecific","psxtmkey02","psxtmtest_single","Yes"
"pthread_key_delete","psxtmkey01","psxtmtest_init_destroy",
,,,
"pthread_cancel",,,
1 Test Case Test Template Implemented
37 pthread_once
38
39 pthread_key_create psxtmkey01 psxtmtest_init_destroy
40 pthread_setspecific psxtmkey02 psxtmtest_single Yes
41 pthread_getspecific psxtmkey02 psxtmtest_single Yes
42 pthread_key_delete psxtmkey01 psxtmtest_init_destroy
43
44 pthread_cancel