From 43469aff7c49b1ecd8cae2e78f32287152e749eb Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 19 Jul 2011 13:04:20 +0000 Subject: 2011-07-19 Ricardo Aguirre 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. --- testsuites/psxtmtests/psxtmkey02/.cvsignore | 2 + testsuites/psxtmtests/psxtmkey02/Makefile.am | 30 ++++++++ testsuites/psxtmtests/psxtmkey02/init.c | 99 +++++++++++++++++++++++++ testsuites/psxtmtests/psxtmkey02/psxtmkey02.doc | 16 ++++ 4 files changed, 147 insertions(+) create mode 100644 testsuites/psxtmtests/psxtmkey02/.cvsignore create mode 100644 testsuites/psxtmtests/psxtmkey02/Makefile.am create mode 100644 testsuites/psxtmtests/psxtmkey02/init.c create mode 100644 testsuites/psxtmtests/psxtmkey02/psxtmkey02.doc (limited to 'testsuites/psxtmtests/psxtmkey02') diff --git a/testsuites/psxtmtests/psxtmkey02/.cvsignore b/testsuites/psxtmtests/psxtmkey02/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtmtests/psxtmkey02/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtmtests/psxtmkey02/Makefile.am b/testsuites/psxtmtests/psxtmkey02/Makefile.am new file mode 100644 index 0000000000..f54ff6af39 --- /dev/null +++ b/testsuites/psxtmtests/psxtmkey02/Makefile.am @@ -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 diff --git a/testsuites/psxtmtests/psxtmkey02/init.c b/testsuites/psxtmtests/psxtmkey02/init.c new file mode 100644 index 0000000000..fb6c27778d --- /dev/null +++ b/testsuites/psxtmtests/psxtmkey02/init.c @@ -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 +#include +#include +#include +#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 +/* end of file */ diff --git a/testsuites/psxtmtests/psxtmkey02/psxtmkey02.doc b/testsuites/psxtmtests/psxtmkey02/psxtmkey02.doc new file mode 100644 index 0000000000..1f30e34c1c --- /dev/null +++ b/testsuites/psxtmtests/psxtmkey02/psxtmkey02.doc @@ -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 + -- cgit v1.2.3