source: examples-v2/posix_api/psx_sched_report/test.c @ 1324baf

4.11examples-v2-4-10-branch
Last change on this file since 1324baf was 1324baf, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 6, 2009 at 9:26:29 PM

2009-08-06 Joel Sherrill <joel.sherrill@…>

  • ChangeLog?, Makefile, psx_example_1/Makefile, psx_example_1/test1.c, psx_example_2/Makefile, psx_example_2/test2.c, psx_example_3/Makefile, psx_example_3/test3.c, psx_sched_report/Makefile, psx_sched_report/README, psx_sched_report/test.c: New files.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Simple test program -- simplified version of sample test hello.
3 */
4
5#include <stdlib.h>
6#include <stdio.h>
7#include <sched.h>
8#include <stdlib.h>
9
10void print_sched_info(
11  char *s,
12  int policy
13)
14{
15  int min, max, levels;
16  struct timespec t;
17
18  printf( "Information on %s\n", s );
19  min = sched_get_priority_min( policy );
20  max = sched_get_priority_max( policy );
21  (void) sched_rr_get_interval( 1, &t );
22  levels = max - min;
23  printf( "\tSupports %d priority levels (%d - %d)\n", levels, min, max  );
24  if ( levels >= 32 )
25    printf( "\tImplementation is compliant on priority levels\n");
26  else
27    printf( "\tImplementation is NOT compliant on priority levels\n" );
28
29  printf( "\tScheduling quantum is %ld seconds and %ld nanoseconds\n",
30              (long)t.tv_sec, (long)t.tv_nsec );
31}
32
33
34#if defined(__rtems__)
35  #include <bsp.h>
36
37rtems_task Init(
38  rtems_task_argument ignored
39)
40#else
41int main()
42#endif
43{
44  print_sched_info( "SCHED_OTHER", SCHED_OTHER );
45  print_sched_info( "SCHED_FIFO", SCHED_FIFO );
46  print_sched_info( "SCHED_RR", SCHED_RR );
47
48  exit( 0 );
49}
50
51#if defined(__rtems__)
52/* configuration information */
53
54/* NOTICE: the clock driver is explicitly disabled */
55#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
56#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
57
58#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
59#define CONFIGURE_MICROSECONDS_PER_TICK 1000
60#define CONFIGURE_TICKS_PER_TIMESLICE   1
61#define CONFIGURE_MAXIMUM_TASKS 1
62
63#define CONFIGURE_INIT
64
65#include <rtems/confdefs.h>
66#endif
67
68/* end of file */
Note: See TracBrowser for help on using the repository browser.