[rtems commit] GCI: Create POSIX Timing Test psxtmcond01

Joel Sherrill joel at rtems.org
Wed Jan 9 15:19:36 UTC 2013


Module:    rtems
Branch:    master
Commit:    cc2857a2fee85f686634f406a46dc4b7691acdda
Changeset: http://git.rtems.org/rtems/commit/?id=cc2857a2fee85f686634f406a46dc4b7691acdda

Author:    Christopher Kerl <zargyyoyo at gmail.com>
Date:      Wed Jan  9 09:24:10 2013 -0600

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(+), 0 deletions(-)

diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am
index 72340ab..afd97bd 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 9e59681..952d5cc 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 0000000..29fa1ce
--- /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 at .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 0000000..bbfaa89
--- /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 <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 */
diff --git a/testsuites/psxtmtests/psxtmcond01/psxtmcond01.doc b/testsuites/psxtmtests/psxtmcond01/psxtmcond01.doc
new file mode 100644
index 0000000..9ea2348
--- /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)




More information about the vc mailing list