File indexing completed on 2025-05-11 08:24:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifdef HAVE_CONFIG_H
0012 #include "config.h"
0013 #endif
0014
0015 #include <timesys.h>
0016 #include <pthread.h>
0017 #include <sched.h>
0018 #include <rtems/btimer.h>
0019 #include "test_support.h"
0020
0021 const char rtems_test_name[] = "PSXTMTHREAD 06";
0022
0023
0024 void *POSIX_Init(void *argument);
0025 void benchmark_pthread_create(void);
0026 void benchmark_pthread_setschedparam(void);
0027 void *test_thread(void *argument);
0028
0029 void benchmark_pthread_setschedparam(void)
0030 {
0031 int status;
0032 int policy;
0033 struct sched_param param;
0034 pthread_t thread_ID;
0035
0036 status = pthread_create(&thread_ID, NULL, test_thread, NULL);
0037 rtems_test_assert( status == 0 );
0038
0039
0040 pthread_getschedparam(pthread_self(), &policy, ¶m);
0041 pthread_setschedparam(thread_ID, policy, ¶m);
0042
0043
0044
0045 param.sched_priority = sched_get_priority_max(policy) - 1;
0046
0047 benchmark_timer_initialize();
0048 pthread_setschedparam(thread_ID, policy, ¶m);
0049 }
0050
0051 void *test_thread(
0052 void *argument
0053 )
0054 {
0055 uint32_t end_time;
0056
0057
0058 sched_yield();
0059
0060 end_time = benchmark_timer_read();
0061
0062 put_time(
0063 "pthread_setschedparam: raise other priority preempt",
0064 end_time,
0065 1,
0066 0,
0067 0
0068 );
0069
0070 TEST_END();
0071 rtems_test_exit(0);
0072
0073 return NULL;
0074 }
0075
0076 void *POSIX_Init(
0077 void *argument
0078 )
0079 {
0080
0081 TEST_BEGIN();
0082 benchmark_pthread_setschedparam();
0083
0084 rtems_test_assert( 1 );
0085 return NULL;
0086 }
0087
0088
0089
0090 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
0091 #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
0092
0093 #define CONFIGURE_MAXIMUM_POSIX_THREADS 2
0094 #define CONFIGURE_POSIX_INIT_THREAD_TABLE
0095
0096 #define CONFIGURE_INIT
0097
0098 #include <rtems/confdefs.h>
0099