forked from Imagelibrary/rtems
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:
@@ -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.
|
||||
|
||||
@@ -7,6 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
|
||||
SUBDIRS =
|
||||
|
||||
if HAS_POSIX
|
||||
SUBDIRS += psxtmkey02
|
||||
SUBDIRS += psxtmmutex01
|
||||
SUBDIRS += psxtmmutex02
|
||||
SUBDIRS += psxtmmutex03
|
||||
|
||||
@@ -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
|
||||
|
||||
2
testsuites/psxtmtests/psxtmkey02/.cvsignore
Normal file
2
testsuites/psxtmtests/psxtmkey02/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
30
testsuites/psxtmtests/psxtmkey02/Makefile.am
Normal file
30
testsuites/psxtmtests/psxtmkey02/Makefile.am
Normal 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
|
||||
99
testsuites/psxtmtests/psxtmkey02/init.c
Normal file
99
testsuites/psxtmtests/psxtmkey02/init.c
Normal 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 */
|
||||
16
testsuites/psxtmtests/psxtmkey02/psxtmkey02.doc
Normal file
16
testsuites/psxtmtests/psxtmkey02/psxtmkey02.doc
Normal 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
|
||||
|
||||
@@ -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",,,
|
||||
|
||||
|
Reference in New Issue
Block a user