[rtems commit] Create POSIX Timing Test psxtmthread02

Jennifer Averett jennifer at rtems.org
Mon Jan 14 16:09:26 UTC 2013


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

Author:    Christopher Kerl <zargyyoyo at gmail.com>
Date:      Mon Jan 14 10:12:14 2013 -0600

Create POSIX Timing Test psxtmthread02
Minor modifications were made to the student version to
clearify methods and to clean up test output.

---

 testsuites/psxtmtests/Makefile.am                  |    1 +
 testsuites/psxtmtests/configure.ac                 |    1 +
 testsuites/psxtmtests/psxtmthread02/Makefile.am    |   27 +++++++
 testsuites/psxtmtests/psxtmthread02/init.c         |   80 ++++++++++++++++++++
 .../psxtmtests/psxtmthread02/psxtmthread02.doc     |   11 +++
 5 files changed, 120 insertions(+), 0 deletions(-)

diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am
index 3530eaf..be21fa2 100644
--- a/testsuites/psxtmtests/Makefile.am
+++ b/testsuites/psxtmtests/Makefile.am
@@ -40,6 +40,7 @@ SUBDIRS += psxtmsem05
 SUBDIRS += psxtmsleep01
 SUBDIRS += psxtmsleep02
 SUBDIRS += psxtmthread01
+SUBDIRS += psxtmthread02
 SUBDIRS += psxtmthread03
 endif
 
diff --git a/testsuites/psxtmtests/configure.ac b/testsuites/psxtmtests/configure.ac
index ab01acb..9eedb89 100644
--- a/testsuites/psxtmtests/configure.ac
+++ b/testsuites/psxtmtests/configure.ac
@@ -114,6 +114,7 @@ psxtmsem05/Makefile
 psxtmsleep01/Makefile
 psxtmsleep02/Makefile
 psxtmthread01/Makefile
+psxtmthread02/Makefile
 psxtmthread03/Makefile
 ])
 AC_OUTPUT
diff --git a/testsuites/psxtmtests/psxtmthread02/Makefile.am b/testsuites/psxtmtests/psxtmthread02/Makefile.am
new file mode 100644
index 0000000..c39e2c0
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmthread02/Makefile.am
@@ -0,0 +1,27 @@
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxtmthread02
+psxtmthread02_SOURCES  = init.c
+psxtmthread02_SOURCES += ../../tmtests/include/timesys.h
+psxtmthread02_SOURCES += ../../support/src/tmtests_empty_function.c
+psxtmthread02_SOURCES += ../../support/src/tmtests_support.c
+
+dist_rtems_tests_DATA = psxtmthread02.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 = $(psxtmthread02_OBJECTS) $(psxtmthread02_LDADD)
+LINK_LIBS = $(psxtmthread02_LDLIBS)
+
+psxtmthread02$(EXEEXT): $(psxtmthread02_OBJECTS) $(psxtmthread02_DEPENDENCIES)
+	@rm -f psxtmthread02$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtmtests/psxtmthread02/init.c b/testsuites/psxtmtests/psxtmthread02/init.c
new file mode 100644
index 0000000..41fb17f
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmthread02/init.c
@@ -0,0 +1,80 @@
+/*
+ *  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 <timesys.h>
+#include <pthread.h>
+#include <rtems/timerdrv.h>
+#include "test_support.h"
+
+/* forward declarations to avoid warnings */
+void *POSIX_Init(void *argument);
+void benchmark_pthread_create(void);
+void thread(void *argument);
+
+void benchmark_pthread_create(void)
+{
+  long end_time;
+  int  status;
+  pthread_t thread_ID;
+
+  benchmark_timer_initialize();
+  
+  status = pthread_create(&thread_ID, NULL, thread, NULL);
+  rtems_test_assert( status == 0 );
+ 
+  end_time = benchmark_timer_read();
+
+  rtems_test_assert( status == 0 );
+
+  put_time(
+    "pthread_create - preempt",
+    end_time,
+    1,        /* Only executed once */
+    0,
+    0
+  );
+
+}
+
+void thread(
+  void *argument
+)
+{
+  //Empty thread used in pthread_create().
+}
+
+void *POSIX_Init(
+  void *argument
+)
+{
+
+  puts( "\n\n*** POSIX TIME TEST PSXTMTHREAD02 ***" );
+
+  benchmark_pthread_create();
+
+  puts( "*** END OF POSIX TIME TEST PSXTMTHREAD02 ***" );
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS     2
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc b/testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc
new file mode 100644
index 0000000..865fc07
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc
@@ -0,0 +1,11 @@
+#  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:
+
++ 




More information about the vc mailing list