Changeset f4ce641 in examples-v2


Ignore:
Timestamp:
Sep 26, 2018, 2:43:51 PM (7 months ago)
Author:
Joel Sherrill <joel@…>
Branches:
286403d7a3d0e521179e677c0d2fd7549c9ceab4
Children:
a5c981d
Parents:
4b7512a
git-author:
Joel Sherrill <joel@…> (09/26/18 14:43:51)
git-committer:
Joel Sherrill <joel@…> (09/26/18 23:03:33)
Message:

Add various programs to report default attributes for various POSIX objects

Closes #3531.

Location:
posix_api
Files:
24 added
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • posix_api/Makefile

    r4b7512a rf4ce641  
    55# If the POSIX API isn't enabled, we can't build these
    66ifeq ($(RTEMS_HAS_POSIX_API),yes)
    7   SUBDIRS = psx_example_1 psx_example_2 psx_example_3 psx_sched_report
     7  SUBDIRS  = psx_example_1
     8  SUBDIRS += psx_example_2
     9  SUBDIRS += psx_example_3
     10  SUBDIRS += psx_barrier_report
     11  SUBDIRS += psx_condvar_report
     12  SUBDIRS += psx_mqueue_report
     13  SUBDIRS += psx_mutex_report
     14  SUBDIRS += psx_pthread_report
     15  SUBDIRS += psx_rwlock_report
     16  SUBDIRS += psx_sched_report
    817endif
  • posix_api/psx_sched_report/Makefile

    r4b7512a rf4ce641  
    1 #
    2 #  Makefile
    3 #
    4 
    51#
    62#  RTEMS_MAKEFILE_PATH is typically set in an environment variable
    73#
    84
    9 EXEC=psx_sched_report.exe
    10 PGM=${ARCH}/$(EXEC)
    11 
    12 # optional managers required
    13 MANAGERS=all
     5PGM=${ARCH}/psx_sched_report.exe
    146
    157# C source names
    16 CSRCS = test.c
    17 COBJS_ = $(CSRCS:.c=.o)
    18 COBJS = $(COBJS_:%=${ARCH}/%)
    19 
    20 # C++ source names
    21 CXXSRCS =
    22 CXXOBJS_ = $(CXXSRCS:.cc=.o)
    23 CXXOBJS = $(CXXOBJS_:%=${ARCH}/%)
    24 
    25 # AS source names
    26 ASSRCS =
    27 ASOBJS_ = $(ASSRCS:.s=.o)
    28 ASOBJS = $(ASOBJS_:%=${ARCH}/%)
    29 
    30 # Libraries
    31 LIBS = -lrtemsall -lc
     8CSRCS = psx_sched_report.c rtems_config.c
     9COBJS = $(CSRCS:%.c=${ARCH}/%.o)
    3210
    3311include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
    34 
    3512include $(RTEMS_CUSTOM)
    3613include $(PROJECT_ROOT)/make/leaf.cfg
     
    4219$(PGM): $(OBJS)
    4320        $(make-exe)
    44 
  • posix_api/psx_sched_report/psx_sched_report.c

    r4b7512a rf4ce641  
    11/*
    22 *  Program to print POSIX Scheduler Characteristics
     3 */
     4
     5/*
     6 * Copyright 2018 Joel Sherrill (joel@rtems.org)
     7 *
     8 * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file.
    39 */
    410
     
    612#include <stdio.h>
    713#include <sched.h>
    8 #include <stdlib.h>
     14/* FreeBSD 10 needs this for struct timespec which seems wrong */
     15#include <time.h>
    916
    1017void print_sched_info(
     
    2027  max = sched_get_priority_max( policy );
    2128  (void) sched_rr_get_interval( 1, &t );
    22   levels = max - min;
     29  levels = abs(max - min + 1);
    2330  printf( "\tSupports %d priority levels (%d - %d)\n", levels, min, max  );
    2431  if ( levels >= 32 )
     
    2936  printf( "\tScheduling quantum is %ld seconds and %ld nanoseconds\n",
    3037              (long)t.tv_sec, (long)t.tv_nsec );
     38  puts( "" );
    3139}
    3240
    3341int main()
    3442{
     43  puts( "*** POSIX Scheduler Characteristics Report ***" );
    3544  print_sched_info( "SCHED_OTHER", SCHED_OTHER );
    3645  print_sched_info( "SCHED_FIFO", SCHED_FIFO );
    3746  print_sched_info( "SCHED_RR", SCHED_RR );
    3847#if defined(SCHED_SPORADIC)
    39   print_sched_info( "SCHED_SPORADIC", SCHED_RR );
     48  print_sched_info( "SCHED_SPORADIC", SCHED_SPORADIC );
    4049#else
    4150  printf( "SCHED_SPORADIC is not supported\n" );
    4251#endif
     52  puts( "*** END OF POSIX Scheduler Characteristics Report ***" );
    4353
    4454  exit( 0 );
  • posix_api/psx_sched_report/rtems_config.c

    r4b7512a rf4ce641  
     1/*
     2 * This file contains the RTEMS Configuration for this example.
     3 */
     4
     5/*
     6 * Copyright 2018 Joel Sherrill (joel@rtems.org)
     7 *
     8 * This file's license is 2-clause BSD as in this distribution's LICENSE.2 file.
     9 */
    110
    211#include <stdlib.h>
     
    514
    615static char *argv_list[] = {
    7   "psx_sched_report",
     16  "report",
    817  ""
    918};
  • posix_api/psx_sched_report/wscript

    r4b7512a rf4ce641  
    44#
    55
    6 # Waf build script for an RTEMS Hello
    76import rtems_waf.rtems as rtems
    87
     
    1211    bld(features = 'c cprogram',
    1312        target = 'psx_sched_report.exe',
    14         source = ['test.c','rtems_config.c'],
     13        source = ['psx_sched_report.c','rtems_config.c'],
    1514        lib = ['c'])
    1615
  • posix_api/wscript

    r4b7512a rf4ce641  
    1111        bld.recurse('psx_example_2')
    1212        bld.recurse('psx_example_3')
     13        bld.recurse('psx_barrier_report')
     14        bld.recurse('psx_condvar_report')
     15        bld.recurse('psx_mqueue_report')
     16        bld.recurse('psx_mutex_report')
     17        bld.recurse('psx_pthread_report')
     18        bld.recurse('psx_rwlock_report')
    1319        bld.recurse('psx_sched_report')
    14 
Note: See TracChangeset for help on using the changeset viewer.