1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2013. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #include <newlib/getopt.h> |
---|
11 | #include <stdio.h> |
---|
12 | #include <stdlib.h> |
---|
13 | #include <string.h> |
---|
14 | #include <ctype.h> |
---|
15 | |
---|
16 | #include "shell.h" |
---|
17 | #include "rtems_sched.h" |
---|
18 | |
---|
19 | // #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
20 | #include <rtems.h> |
---|
21 | #include <rtems/bspsmp.h> |
---|
22 | #include <rtems/score/percpu.h> |
---|
23 | #include <rtems/score/smp.h> |
---|
24 | #include <rtems/score/schedulerpriority.h> |
---|
25 | |
---|
26 | int main_dump_all_cpus(int argc, char **argv) |
---|
27 | { |
---|
28 | uint32_t cpu; |
---|
29 | Thread_Control *h; |
---|
30 | Thread_Control *i; |
---|
31 | Thread_Control *e; |
---|
32 | |
---|
33 | printf( |
---|
34 | "=== CPU Status\n" |
---|
35 | " EXECUTING / HEIR / IDLE / " |
---|
36 | " SWITCH NEEDED\n" |
---|
37 | ); |
---|
38 | for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) { |
---|
39 | e = _Per_CPU_Information[cpu].executing; |
---|
40 | h = _Per_CPU_Information[cpu].heir; |
---|
41 | i = _Per_CPU_Information[cpu].idle; |
---|
42 | printf( |
---|
43 | " CPU %d: 0x%08x @%3ld / 0x%08x @%3ld / 0x%08x @%3ld %s\n", |
---|
44 | cpu, |
---|
45 | e->Object.id, (long) e->current_priority, |
---|
46 | h->Object.id, (long) h->current_priority, |
---|
47 | i->Object.id, (long) i->current_priority, |
---|
48 | ((_Per_CPU_Information[cpu].dispatch_necessary) ? "true" : "false") |
---|
49 | ); |
---|
50 | } |
---|
51 | printf( "=== End of Ready Set of Threads\n" ); |
---|
52 | |
---|
53 | return 0; |
---|
54 | } |
---|