source: rtems/cpukit/libmisc/shell/main_perioduse.c @ 7eada71

4.115
Last change on this file since 7eada71 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • 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.org/license/LICENSE.
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <stdio.h>
17#include <string.h>
18
19#include <rtems.h>
20#include <rtems/shell.h>
21#include "internal.h"
22
23static int rtems_shell_main_perioduse(
24  int   argc,
25  char *argv[]
26)
27{
28  /*
29   *  When invoked with no arguments, print the report.
30   */
31  if ( argc == 1 ) {
32    rtems_rate_monotonic_report_statistics_with_plugin(
33      stdout,
34      (rtems_printk_plugin_t)fprintf
35    );
36    return 0;
37  }
38
39  /*
40   *  When invoked with the single argument -r, reset the statistics.
41   */
42  if ( argc == 2 && !strcmp( argv[1], "-r" ) ) {
43    printf( "Resetting Period Usage information\n" );
44    rtems_rate_monotonic_reset_all_statistics();
45    return 0;
46  }
47
48  /*
49   *  OK.  The user did something wrong.
50   */
51  fprintf( stderr, "%s: [-r]\n", argv[0] );
52  return -1;
53}
54
55rtems_shell_cmd_t rtems_shell_PERIODUSE_Command = {
56  "perioduse",                            /* name */
57  "[-r] print or reset per period usage", /* usage */
58  "rtems",                                /* topic */
59  rtems_shell_main_perioduse,             /* command */
60  NULL,                                   /* alias */
61  NULL                                    /* next */
62};
Note: See TracBrowser for help on using the repository browser.