Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:19

0001 /*
0002  *  perioduse Command Implementation
0003  *
0004  *  COPYRIGHT (c) 1989-2008.
0005  *  On-Line Applications Research Corporation (OAR).
0006  *
0007  *  The license and distribution terms for this file may be
0008  *  found in the file LICENSE in this distribution or at
0009  *  http://www.rtems.org/license/LICENSE.
0010  */
0011 
0012 #ifdef HAVE_CONFIG_H
0013 #include "config.h"
0014 #endif
0015 
0016 #include <stdio.h>
0017 #include <string.h>
0018 
0019 #include <rtems.h>
0020 #include <rtems/printer.h>
0021 #include <rtems/shell.h>
0022 #include "internal.h"
0023 
0024 static int rtems_shell_main_perioduse(
0025   int   argc,
0026   char *argv[]
0027 )
0028 {
0029   /*
0030    *  When invoked with no arguments, print the report.
0031    */
0032   if ( argc == 1 ) {
0033     rtems_printer printer;
0034     rtems_print_printer_printf(&printer);
0035     rtems_rate_monotonic_report_statistics_with_plugin(
0036       &printer
0037     );
0038     return 0;
0039   }
0040 
0041   /*
0042    *  When invoked with the single argument -r, reset the statistics.
0043    */
0044   if ( argc == 2 && !strcmp( argv[1], "-r" ) ) {
0045     printf( "Resetting Period Usage information\n" );
0046     rtems_rate_monotonic_reset_all_statistics();
0047     return 0;
0048   }
0049 
0050   /*
0051    *  OK.  The user did something wrong.
0052    */
0053   fprintf( stderr, "%s: [-r]\n", argv[0] );
0054   return -1;
0055 }
0056 
0057 rtems_shell_cmd_t rtems_shell_PERIODUSE_Command = {
0058   "perioduse",                            /* name */
0059   "[-r] print or reset per period usage", /* usage */
0060   "rtems",                                /* topic */
0061   rtems_shell_main_perioduse,             /* command */
0062   NULL,                                   /* alias */
0063   NULL                                    /* next */
0064 };