source: rtems/cpukit/libmisc/shell/main_perioduse.c @ a3ddb08b

4.104.114.95
Last change on this file since a3ddb08b was a3ddb08b, checked in by Joel Sherrill <joel.sherrill@…>, on 03/05/08 at 02:49:35

2008-03-04 Joel Sherrill <joel.sherrill@…>

  • libmisc/Makefile.am, libmisc/shell/main_cp.c, libmisc/shell/main_cpuuse.c, libmisc/shell/main_date.c, libmisc/shell/main_mallocinfo.c, libmisc/shell/main_netstats.c, libmisc/shell/main_perioduse.c, libmisc/shell/main_stackuse.c, libmisc/shell/main_wkspaceinfo.c, libmisc/shell/print_heapinfo.c, libmisc/shell/shell.c, libmisc/shell/shell.h, libmisc/shell/shell_makeargs.c, libmisc/shell/shellconfig.c, libmisc/shell/shellconfig.h, libmisc/shell/write_file.c: Add initial capability to automatically execute a script from the filesystem. Add echo command from NetBSD and sleep command.
  • libmisc/shell/main_echo.c, libmisc/shell/main_sleep.c, libmisc/shell/shell_script.c: New files.
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  perioduse Command Implementation
3 *
4 *  COPYRIGHT (c) 1989-2008.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <stdio.h>
19
20#include <rtems.h>
21#include <rtems/shell.h>
22#include "internal.h"
23
24int rtems_shell_main_perioduse(
25  int   argc,
26  char *argv[]
27)
28{
29  /*
30   *  When invoked with no arguments, print the report.
31   */
32  if ( argc == 1 ) {
33    rtems_rate_monotonic_report_statistics_with_plugin(
34      stdout,
35      (rtems_printk_plugin_t)fprintf
36    );
37    return 0;
38  }
39
40  /*
41   *  When invoked with the single argument -r, reset the statistics.
42   */
43  if ( argc == 2 && !strcmp( argv[1], "-r" ) ) {
44    printf( "Resetting Period Usage information\n" );
45    rtems_rate_monotonic_reset_all_statistics();
46    return 0;
47  }
48
49  /*
50   *  OK.  The user did something wrong.
51   */
52  fprintf( stderr, "%s: [-r]\n", argv[0] );
53  return -1;
54}
55
56rtems_shell_cmd_t rtems_shell_PERIODUSE_Command = {
57  "perioduse",                            /* name */
58  "[-r] print or reset per period usage", /* usage */
59  "rtems",                                /* topic */
60  rtems_shell_main_perioduse,             /* command */
61  NULL,                                   /* alias */
62  NULL                                    /* next */
63};
Note: See TracBrowser for help on using the repository browser.