diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-07-13 15:23:25 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-07-13 15:23:25 +0000 |
commit | 02a7789c7756f84a61efe4d4fd4d0159febc2a49 (patch) | |
tree | 0868dadc8f68efcf60dea84cb2967823523b8aa9 /testsuites/psxtmtests/psxtmmutex01 | |
parent | 2011-07-12 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff) | |
download | rtems-02a7789c7756f84a61efe4d4fd4d0159febc2a49.tar.bz2 |
2011-07-13 Ricardo Aguirre <el.mastin@ymail.com>
PR 1831/tests
* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of
mutex init and destroy.
* psxtmmutex01/.cvsignore, psxtmmutex01/Makefile.am,
psxtmmutex01/init.c, psxtmmutex01/psxtmmutex01.doc: New files.
Diffstat (limited to 'testsuites/psxtmtests/psxtmmutex01')
-rw-r--r-- | testsuites/psxtmtests/psxtmmutex01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmmutex01/Makefile.am | 30 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmmutex01/init.c | 89 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmmutex01/psxtmmutex01.doc | 15 |
4 files changed, 136 insertions, 0 deletions
diff --git a/testsuites/psxtmtests/psxtmmutex01/.cvsignore b/testsuites/psxtmtests/psxtmmutex01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtmtests/psxtmmutex01/Makefile.am b/testsuites/psxtmtests/psxtmmutex01/Makefile.am new file mode 100644 index 0000000000..2ec2bfd6ad --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex01/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtmmutex01 +psxtmmutex01_SOURCES = init.c ../../tmtests/include/timesys.h \ + ../../support/src/tmtests_empty_function.c \ + ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = psxtmmutex01.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 = $(psxtmmutex01_OBJECTS) $(psxtmmutex01_LDADD) +LINK_LIBS = $(psxtmmutex01_LDLIBS) + +psxtmmutex01$(EXEEXT): $(psxtmmutex01_OBJECTS) $(psxtmmutex01_DEPENDENCIES) + @rm -f psxtmmutex01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtmtests/psxtmmutex01/init.c b/testsuites/psxtmtests/psxtmmutex01/init.c new file mode 100644 index 0000000000..418f35bcec --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex01/init.c @@ -0,0 +1,89 @@ +/* + * 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_mutex_t MutexId; + +void test_mutex_create(void) +{ + long end_time; + int status; + + benchmark_timer_initialize(); + status = pthread_mutex_init( &MutexId, NULL ); + end_time = benchmark_timer_read(); + rtems_test_assert( status == 0 ); + + put_time( + "pthread_mutex_init", + end_time, + 1, + 0, + 0 + ); +} + +void test_mutex_destroy(void) +{ + long end_time; + int status; + + benchmark_timer_initialize(); + status = pthread_mutex_destroy( &MutexId ); + end_time = benchmark_timer_read(); + rtems_test_assert( status == 0 ); + + put_time( + "pthread_mutex_destroy", + end_time, + 1, + 0, + 0 + ); +} + +void *POSIX_Init( + void *argument +) +{ + + puts( "\n\n*** POSIX TIME TEST PSXTMMUTEX01 ***" ); + + test_mutex_create(); + test_mutex_destroy(); + + puts( "*** END OF POSIX TIME TEST PSXTMMUTEX01 ***" ); + + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 +#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +/* end of file */ diff --git a/testsuites/psxtmtests/psxtmmutex01/psxtmmutex01.doc b/testsuites/psxtmtests/psxtmmutex01/psxtmmutex01.doc new file mode 100644 index 0000000000..9e8113c507 --- /dev/null +++ b/testsuites/psxtmtests/psxtmmutex01/psxtmmutex01.doc @@ -0,0 +1,15 @@ +# +# $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_mutex_init ++ phtread_mutex_destroy |