source: examples-v2/posix_api/psx_sched_report/test.c @ 108ea77

Last change on this file since 108ea77 was 108ea77, checked in by Joel Sherrill <joel@…>, on Aug 7, 2016 at 5:17:41 PM

posix_api/psx_sched_report/test.c: Uses default configuration now.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  Program to print POSIX Scheduler Characteristics
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
33int main()
34{
35  print_sched_info( "SCHED_OTHER", SCHED_OTHER );
36  print_sched_info( "SCHED_FIFO", SCHED_FIFO );
37  print_sched_info( "SCHED_RR", SCHED_RR );
38#if defined(SCHED_SPORADIC)
39  print_sched_info( "SCHED_SPORADIC", SCHED_RR );
40#else
41  printf( "SCHED_SPORADIC is not supported\n" );
42#endif
43
44  exit( 0 );
45}
Note: See TracBrowser for help on using the repository browser.