From 115e0591317481cb622913d46f4164d7db34fa1b Mon Sep 17 00:00:00 2001 From: Daniel Ramirez Date: Sat, 30 Nov 2013 15:42:38 -0600 Subject: fixed psxtmthread02 test, updated .csv to be in sync and added test .docs --- testsuites/psxtmtests/psxtmthread02/init.c | 34 ++++++++++++---------- .../psxtmtests/psxtmthread02/psxtmthread02.doc | 14 ++++++++- 2 files changed, 31 insertions(+), 17 deletions(-) (limited to 'testsuites/psxtmtests/psxtmthread02') 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, ¶m); + /* 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. -- cgit v1.2.3