File indexing completed on 2025-05-11 08:24:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
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/cpuuse.h>
0021 #include <rtems/printer.h>
0022 #include <rtems/shell.h>
0023 #include "internal.h"
0024
0025 static int rtems_shell_main_top(
0026 int argc,
0027 char *argv[]
0028 )
0029 {
0030
0031
0032
0033 if ( argc == 1 ) {
0034 rtems_printer printer;
0035 rtems_print_printer_fprintf(&printer, stdout);
0036 rtems_cpu_usage_top_with_plugin(&printer);
0037 return 0;
0038 }
0039
0040
0041
0042
0043 if ( argc == 2 && !strcmp( argv[1], "-r" ) ) {
0044 printf( "Resetting CPU Usage information\n" );
0045 rtems_cpu_usage_reset();
0046 return 0;
0047 }
0048
0049
0050
0051
0052 fprintf( stderr, "%s: [-r]\n", argv[0] );
0053 return -1;
0054 }
0055
0056 rtems_shell_cmd_t rtems_shell_TOP_Command = {
0057 "top",
0058 "[-r] print or reset per thread cpu usage",
0059 "rtems",
0060 rtems_shell_main_top,
0061 NULL,
0062 NULL
0063 };