4.115
Last change
on this file since c499856 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 | * CPUUSE 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/cpuuse.h> |
---|
21 | #include <rtems/shell.h> |
---|
22 | #include "internal.h" |
---|
23 | |
---|
24 | static int rtems_shell_main_cpuuse( |
---|
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_cpu_usage_report_with_plugin(stdout, (rtems_printk_plugin_t)fprintf); |
---|
34 | return 0; |
---|
35 | } |
---|
36 | |
---|
37 | /* |
---|
38 | * When invoked with the single argument -r, reset the statistics. |
---|
39 | */ |
---|
40 | if ( argc == 2 && !strcmp( argv[1], "-r" ) ) { |
---|
41 | printf( "Resetting CPU Usage information\n" ); |
---|
42 | rtems_cpu_usage_reset(); |
---|
43 | return 0; |
---|
44 | } |
---|
45 | |
---|
46 | /* |
---|
47 | * OK. The user did something wrong. |
---|
48 | */ |
---|
49 | fprintf( stderr, "%s: [-r]\n", argv[0] ); |
---|
50 | return -1; |
---|
51 | } |
---|
52 | |
---|
53 | rtems_shell_cmd_t rtems_shell_CPUUSE_Command = { |
---|
54 | "cpuuse", /* name */ |
---|
55 | "[-r] print or reset per thread cpu usage", /* usage */ |
---|
56 | "rtems", /* topic */ |
---|
57 | rtems_shell_main_cpuuse, /* command */ |
---|
58 | NULL, /* alias */ |
---|
59 | NULL /* next */ |
---|
60 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.