GCI: Create POSIX Timing Test psxtmcond01

This commit is contained in:
Christopher Kerl
2013-01-09 09:24:10 -06:00
committed by Joel Sherrill
parent 1f0d013dd2
commit cc2857a2fe
5 changed files with 130 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ if HAS_POSIX
SUBDIRS += psxtmbarrier01
SUBDIRS += psxtmbarrier02
SUBDIRS += psxtmbarrier03
SUBDIRS += psxtmcond01
SUBDIRS += psxtmkey01
SUBDIRS += psxtmkey02
SUBDIRS += psxtmmq01

View File

@@ -80,6 +80,7 @@ AC_CONFIG_FILES([Makefile
psxtmbarrier01/Makefile
psxtmbarrier02/Makefile
psxtmbarrier03/Makefile
psxtmcond01/Makefile
psxtmkey01/Makefile
psxtmkey02/Makefile
psxtmmq01/Makefile

View File

@@ -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

View File

@@ -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 <coverhd.h>
#include <tmacros.h>
#include <timesys.h>
#include "test_support.h"
#include <pthread.h>
#include <sched.h>
#include <rtems/timerdrv.h>
/* 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 <rtems/confdefs.h>
/* end of file */

View File

@@ -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)