summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtmtests/psxtmthread02
diff options
context:
space:
mode:
authorDaniel Ramirez <javamonn@gmail.com>2013-11-30 15:42:38 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2013-11-30 15:50:25 -0600
commit115e0591317481cb622913d46f4164d7db34fa1b (patch)
tree95fa331add37a01d187a80b57bdddba9844b0aea /testsuites/psxtmtests/psxtmthread02
parentpsxtmtests_plan.csv: Replace comma with colon (diff)
downloadrtems-115e0591317481cb622913d46f4164d7db34fa1b.tar.bz2
fixed psxtmthread02 test, updated .csv to be in sync and added test .docs
Diffstat (limited to 'testsuites/psxtmtests/psxtmthread02')
-rw-r--r--testsuites/psxtmtests/psxtmthread02/init.c34
-rw-r--r--testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc14
2 files changed, 31 insertions, 17 deletions
diff --git a/testsuites/psxtmtests/psxtmthread02/init.c b/testsuites/psxtmtests/psxtmthread02/init.c
index 9e44873937..bfa3ab8c9a 100644
--- a/testsuites/psxtmtests/psxtmthread02/init.c
+++ b/testsuites/psxtmtests/psxtmthread02/init.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2013.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -23,19 +23,29 @@ void *thread(void *argument);
void benchmark_pthread_create(void)
{
- long end_time;
int status;
pthread_t thread_ID;
+ pthread_attr_t attr;
+ struct sched_param param;
+
+ pthread_attr_init(&attr);
+ pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
+ pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
+ param.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1;
+ pthread_attr_setschedparam(&attr, &param);
+ /* create second thread with max priority and get preempted on creation */
benchmark_timer_initialize();
-
- status = pthread_create(&thread_ID, NULL, thread, NULL);
- rtems_test_assert( status == 0 );
-
- end_time = benchmark_timer_read();
+ status = pthread_create(&thread_ID, &attr, thread, NULL);
+}
- rtems_test_assert( status == 0 );
+void *thread(
+ void *argument
+)
+{
+ long end_time;
+ end_time = benchmark_timer_read();
put_time(
"pthread_create - preempt",
end_time,
@@ -43,14 +53,6 @@ void benchmark_pthread_create(void)
0,
0
);
-
-}
-
-void *thread(
- void *argument
-)
-{
- //Empty thread used in pthread_create().
return NULL;
}
diff --git a/testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc b/testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc
index 865fc07091..0e2e18c936 100644
--- a/testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc
+++ b/testsuites/psxtmtests/psxtmthread02/psxtmthread02.doc
@@ -1,5 +1,6 @@
# COPYRIGHT (c) 1989-2011.
# On-Line Applications Research Corporation (OAR).
+# COPYRIGHT (c) 2013.
#
# The license and distribution terms for this file may be
# found in the file LICENSE in this distribution or at
@@ -8,4 +9,15 @@
This test benchmarks the following operations:
-+
++ pthread_create - preempt
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: psxtmthread
+
+directives:
++ pthread_create
+
+concepts:
++ Benchmark the call pthread_create for creating a thread with a higher priority
+ and the resulting preempt.