forked from Imagelibrary/rtems
psxtmtests: added new psxtmthread04 test
This commit is contained in:
committed by
Gedare Bloom
parent
8d830fae23
commit
064820c874
@@ -45,6 +45,7 @@ SUBDIRS += psxtmsleep02
|
|||||||
SUBDIRS += psxtmthread01
|
SUBDIRS += psxtmthread01
|
||||||
SUBDIRS += psxtmthread02
|
SUBDIRS += psxtmthread02
|
||||||
SUBDIRS += psxtmthread03
|
SUBDIRS += psxtmthread03
|
||||||
|
SUBDIRS += psxtmthread04
|
||||||
SUBDIRS += psxtmthread05
|
SUBDIRS += psxtmthread05
|
||||||
SUBDIRS += psxtmthread06
|
SUBDIRS += psxtmthread06
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ psxtmsleep02/Makefile
|
|||||||
psxtmthread01/Makefile
|
psxtmthread01/Makefile
|
||||||
psxtmthread02/Makefile
|
psxtmthread02/Makefile
|
||||||
psxtmthread03/Makefile
|
psxtmthread03/Makefile
|
||||||
|
psxtmthread04/Makefile
|
||||||
psxtmthread05/Makefile
|
psxtmthread05/Makefile
|
||||||
psxtmthread06/Makefile
|
psxtmthread06/Makefile
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
"pthread_detach",,,
|
"pthread_detach",,,
|
||||||
"pthread_exit",,,
|
"pthread_exit",,,
|
||||||
"pthread_exit","psxtmthread03","psxtmtest_single","Yes"
|
"pthread_exit","psxtmthread03","psxtmtest_single","Yes"
|
||||||
"pthread_getschedparam","psxtmthread04","psxtmtest_single w/multiple timings","No"
|
"pthread_getschedparam","psxtmthread04","psxtmtest_single w/multiple timings","Yes"
|
||||||
"pthread_setschedparam - no thread switch","psxtmthread04","psxtmtest_single w/multiple timings","No"
|
"pthread_setschedparam - no thread switch","psxtmthread04","psxtmtest_single w/multiple timings","Yes"
|
||||||
"pthread_setschedparam - lower own priority: preempt","psxtmthread05","psxtmtest_single","Yes"
|
"pthread_setschedparam - lower own priority: preempt","psxtmthread05","psxtmtest_single","Yes"
|
||||||
"pthread_setschedparam - raise other priority: preempt","psxtmthread06","psxtmtest_single","Yes"
|
"pthread_setschedparam - raise other priority: preempt","psxtmthread06","psxtmtest_single","Yes"
|
||||||
,,,
|
,,,
|
||||||
|
|||||||
|
27
testsuites/psxtmtests/psxtmthread04/Makefile.am
Normal file
27
testsuites/psxtmtests/psxtmthread04/Makefile.am
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
MANAGERS = all
|
||||||
|
|
||||||
|
rtems_tests_PROGRAMS = psxtmthread04
|
||||||
|
psxtmthread04_SOURCES = init.c
|
||||||
|
psxtmthread04_SOURCES += ../../tmtests/include/timesys.h
|
||||||
|
psxtmthread04_SOURCES += ../../support/src/tmtests_empty_function.c
|
||||||
|
psxtmthread04_SOURCES += ../../support/src/tmtests_support.c
|
||||||
|
|
||||||
|
dist_rtems_tests_DATA = psxtmthread04.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 = $(psxtmthread04_OBJECTS) $(psxtmthread04_LDADD)
|
||||||
|
LINK_LIBS = $(psxtmthread04_LDLIBS)
|
||||||
|
|
||||||
|
psxtmthread04$(EXEEXT): $(psxtmthread04_OBJECTS) $(psxtmthread04_DEPENDENCIES)
|
||||||
|
@rm -f psxtmthread04$(EXEEXT)
|
||||||
|
$(make-exe)
|
||||||
|
|
||||||
|
include $(top_srcdir)/../automake/local.am
|
||||||
98
testsuites/psxtmtests/psxtmthread04/init.c
Normal file
98
testsuites/psxtmtests/psxtmthread04/init.c
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1989-2013.
|
||||||
|
* 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 <sched.h>
|
||||||
|
#include <rtems/timerdrv.h>
|
||||||
|
#include "test_support.h"
|
||||||
|
|
||||||
|
/* forward declarations to avoid warnings */
|
||||||
|
void benchmark_pthread_setschedparam(void);
|
||||||
|
void benchmark_pthread_getschedparam(void);
|
||||||
|
void *POSIX_Init(void *argument);
|
||||||
|
|
||||||
|
void benchmark_pthread_getschedparam(void)
|
||||||
|
{
|
||||||
|
long end_time;
|
||||||
|
int status;
|
||||||
|
int policy;
|
||||||
|
struct sched_param param;
|
||||||
|
|
||||||
|
benchmark_timer_initialize();
|
||||||
|
status = pthread_getschedparam( pthread_self(), &policy, ¶m );
|
||||||
|
end_time = benchmark_timer_read();
|
||||||
|
rtems_test_assert( status == 0 );
|
||||||
|
|
||||||
|
put_time(
|
||||||
|
"pthread_getschedparam",
|
||||||
|
end_time,
|
||||||
|
1, /* Only executed once */
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void benchmark_pthread_setschedparam(void)
|
||||||
|
{
|
||||||
|
long end_time;
|
||||||
|
int status;
|
||||||
|
int policy;
|
||||||
|
struct sched_param param;
|
||||||
|
|
||||||
|
status = pthread_getschedparam( pthread_self(), &policy, ¶m );
|
||||||
|
rtems_test_assert( status == 0 );
|
||||||
|
|
||||||
|
/* Arbitrary priority, no other threads to preempt us so it doesn't matter. */
|
||||||
|
param.sched_priority = 5;
|
||||||
|
benchmark_timer_initialize();
|
||||||
|
status = pthread_setschedparam( pthread_self(), policy, ¶m );
|
||||||
|
end_time = benchmark_timer_read();
|
||||||
|
rtems_test_assert( status == 0 );
|
||||||
|
|
||||||
|
put_time(
|
||||||
|
"pthread_setschedparam - no thread switch",
|
||||||
|
end_time,
|
||||||
|
1, /* Only executed once */
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *POSIX_Init(
|
||||||
|
void *argument
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
puts( "\n\n*** POSIX TIME TEST PSXTMTHREAD04 ***" );
|
||||||
|
|
||||||
|
benchmark_pthread_getschedparam();
|
||||||
|
benchmark_pthread_setschedparam();
|
||||||
|
|
||||||
|
puts( "*** END OF POSIX TIME TEST PSXTMTHREAD04 ***" );
|
||||||
|
rtems_test_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* configuration information */
|
||||||
|
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
|
||||||
|
|
||||||
|
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
|
||||||
|
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
|
||||||
|
|
||||||
|
#define CONFIGURE_INIT
|
||||||
|
|
||||||
|
#include <rtems/confdefs.h>
|
||||||
|
/* end of file */
|
||||||
24
testsuites/psxtmtests/psxtmthread04/psxtmthread04.doc
Normal file
24
testsuites/psxtmtests/psxtmthread04/psxtmthread04.doc
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# COPYRIGHT (c) 1989-2013.
|
||||||
|
# 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:
|
||||||
|
|
||||||
|
+ pthread_getschedparam
|
||||||
|
+ pthread_setschedparam - no thread switch
|
||||||
|
|
||||||
|
This file describes the directives and concepts tested by this test set.
|
||||||
|
|
||||||
|
test set name: psxtmthread
|
||||||
|
|
||||||
|
directives:
|
||||||
|
+ pthread_getschedparam
|
||||||
|
+ pthread_setschedparam
|
||||||
|
|
||||||
|
concepts:
|
||||||
|
+ Benchmark the call pthread_getschedparam and pthread_setschedparam without
|
||||||
|
triggering a context switch.
|
||||||
Reference in New Issue
Block a user