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/init.c | |
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/init.c')
-rw-r--r-- | testsuites/psxtmtests/psxtmmutex01/init.c | 89 |
1 files changed, 89 insertions, 0 deletions
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 */ |