From cc2857a2fee85f686634f406a46dc4b7691acdda Mon Sep 17 00:00:00 2001 From: Christopher Kerl Date: Wed, 9 Jan 2013 09:24:10 -0600 Subject: GCI: Create POSIX Timing Test psxtmcond01 --- testsuites/psxtmtests/Makefile.am | 1 + testsuites/psxtmtests/configure.ac | 1 + testsuites/psxtmtests/psxtmcond01/Makefile.am | 28 +++++++ testsuites/psxtmtests/psxtmcond01/init.c | 94 +++++++++++++++++++++++ testsuites/psxtmtests/psxtmcond01/psxtmcond01.doc | 6 ++ 5 files changed, 130 insertions(+) create mode 100644 testsuites/psxtmtests/psxtmcond01/Makefile.am create mode 100644 testsuites/psxtmtests/psxtmcond01/init.c create mode 100644 testsuites/psxtmtests/psxtmcond01/psxtmcond01.doc diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am index 72340ab0c7..afd97bdf08 100644 --- a/testsuites/psxtmtests/Makefile.am +++ b/testsuites/psxtmtests/Makefile.am @@ -6,6 +6,7 @@ if HAS_POSIX SUBDIRS += psxtmbarrier01 SUBDIRS += psxtmbarrier02 SUBDIRS += psxtmbarrier03 +SUBDIRS += psxtmcond01 SUBDIRS += psxtmkey01 SUBDIRS += psxtmkey02 SUBDIRS += psxtmmq01 diff --git a/testsuites/psxtmtests/configure.ac b/testsuites/psxtmtests/configure.ac index 9e59681a7f..952d5cc9ed 100644 --- a/testsuites/psxtmtests/configure.ac +++ b/testsuites/psxtmtests/configure.ac @@ -80,6 +80,7 @@ AC_CONFIG_FILES([Makefile psxtmbarrier01/Makefile psxtmbarrier02/Makefile psxtmbarrier03/Makefile +psxtmcond01/Makefile psxtmkey01/Makefile psxtmkey02/Makefile psxtmmq01/Makefile diff --git a/testsuites/psxtmtests/psxtmcond01/Makefile.am b/testsuites/psxtmtests/psxtmcond01/Makefile.am new file mode 100644 index 0000000000..29fa1ceb42 --- /dev/null +++ b/testsuites/psxtmtests/psxtmcond01/Makefile.am @@ -0,0 +1,28 @@ +MANAGERS = all + +rtems_tests_PROGRAMS = psxtmcond01 +psxtmcond01_SOURCES = init.c +psxtmcond01_SOURCES += ../../tmtests/include/timesys.h +psxtmcond01_SOURCES += ../../support/src/tmtests_empty_function.c +psxtmcond01_SOURCES += ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = psxtmcond01.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 = $(psxtmcond01_OBJECTS) $(psxtmcond01_LDADD) +LINK_LIBS = $(psxtmcond01_LDLIBS) + +psxtmcond01$(EXEEXT): $(psxtmcond01_OBJECTS) $(psxtmcond01_DEPENDENCIES) + @rm -f psxtmcond01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am + diff --git a/testsuites/psxtmtests/psxtmcond01/init.c b/testsuites/psxtmtests/psxtmcond01/init.c new file mode 100644 index 0000000000..bbfaa894f1 --- /dev/null +++ b/testsuites/psxtmtests/psxtmcond01/init.c @@ -0,0 +1,94 @@ +/* + * COPYRIGHT (c) 1989-2012. + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include "test_support.h" +#include +#include +#include + +/* forward declarations to avoid warnings */ +void *POSIX_Init(void *argument); +void benchmark_create_cond_var(void); +void benchmark_destroy_cond_var(void); + +pthread_cond_t mycondvar; + +void benchmark_create_cond_var(void) +{ + long end_time; + int status; + + benchmark_timer_initialize(); + status = pthread_cond_init(&mycondvar, NULL); + end_time = benchmark_timer_read(); + rtems_test_assert( status == 0 ); + + put_time( + "pthread_cond_init (single invocation)", + end_time, + 1, + 0, + 0 + ); +} + +void benchmark_destroy_cond_var(void) +{ + long end_time; + int status; + + benchmark_timer_initialize(); + status = pthread_cond_destroy(&mycondvar); + end_time = benchmark_timer_read(); + rtems_test_assert( status == 0 ); + + put_time( + "pthread_cond_destroy (single invocation)", + end_time, + 1, + 0, + 0 + ); +} + +void *POSIX_Init( + void *argument +) +{ + puts( "\n\n*** POSIX TIME TEST PSXTMCOND01 ***" ); + + benchmark_create_cond_var(); + benchmark_destroy_cond_var(); + + puts( "*** END OF POSIX TIME TEST PSXTMCOND01 ***" ); + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +/* configure an instance of the condition variable created and destroyed */ +#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1 + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include +/* end of file */ diff --git a/testsuites/psxtmtests/psxtmcond01/psxtmcond01.doc b/testsuites/psxtmtests/psxtmcond01/psxtmcond01.doc new file mode 100644 index 0000000000..9ea2348c7d --- /dev/null +++ b/testsuites/psxtmtests/psxtmcond01/psxtmcond01.doc @@ -0,0 +1,6 @@ +This test benchmarks the following cases: + ++ single invocation of creating a POSIX condition variable + (e.g pthread_cond_init) ++ single invocation of deleting a POSIX condition variable + (e.g pthread_cond_destroy) -- cgit v1.2.3