diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-05-22 10:19:24 -0500 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-05-22 10:21:44 -0500 |
commit | 4350081f85da91dd70cedde7f1fc086842b445f8 (patch) | |
tree | c27b3a29efd1624c387bdec72779f331431719da /schedsim/shell/shared | |
parent | cpus4_exercise_affinity_api.scen: Reword comment (diff) | |
download | rtems-schedsim-4350081f85da91dd70cedde7f1fc086842b445f8.tar.bz2 |
cpus4_affinity_case1.scen: Specify affinity in hexadecimal
Diffstat (limited to 'schedsim/shell/shared')
-rw-r--r-- | schedsim/shell/shared/main_dump_all_cpus.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/schedsim/shell/shared/main_dump_all_cpus.c b/schedsim/shell/shared/main_dump_all_cpus.c new file mode 100644 index 0000000..dfe3bc6 --- /dev/null +++ b/schedsim/shell/shared/main_dump_all_cpus.c @@ -0,0 +1,51 @@ +/* + * COPYRIGHT (c) 1989-2013. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <newlib/getopt.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include "shell.h" +#include "rtems_sched.h" + +// #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ +#include <rtems.h> +#include <rtems/score/percpu.h> +#include <rtems/score/smp.h> +#include <rtems/score/schedulerpriority.h> + +int main_dump_all_cpus(int argc, char **argv) +{ + uint32_t cpu; + Thread_Control *h; + Thread_Control *i; + Thread_Control *e; + + printf( + "=== CPU Status\n" + " EXECUTING / HEIR / SWITCH NEEDED\n" + ); + for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) { + e = _Per_CPU_Information[cpu].per_cpu.executing; + h = _Per_CPU_Information[cpu].per_cpu.heir; + printf( + " CPU %d: 0x%08x @%3ld / 0x%08x @%3ld %s\n", + cpu, + e->Object.id, (long) e->current_priority, + h->Object.id, (long) h->current_priority, + ((_Per_CPU_Information[cpu].per_cpu.dispatch_necessary) ? + "true" : "false") + ); + } + printf( "=== End of Ready Set of Threads\n" ); + + return 0; +} |