summaryrefslogtreecommitdiffstats
path: root/schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-05-17 19:31:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-05-17 19:31:12 +0000
commitf40778b48660b589278898593c62cf2250d3fbab (patch)
tree09d84495b8a489f65e58819c8d77ec488da30571 /schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c
parent2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-schedsim-f40778b48660b589278898593c62cf2250d3fbab.tar.bz2
2011-05-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* .cvsignore, ChangeLog, Makefile.am, README, TODO, add_commands.c, config.c, main_current_cpu.c, main_dispatch.c, main_dump_all_cpus.c, main_dump_ready_tasks.c, printheir_executing.c, schedsim.cc, smp_stub.c, wrap_thread_dispatch.c, scenarios/.cvsignore, scenarios/cpus1_mode.expected, scenarios/cpus1_mode.scen, scenarios/cpus1_priority.expected, scenarios/cpus1_priority.scen, scenarios/cpus1_resume_on_primary.expected, scenarios/cpus1_resume_on_primary.scen, scenarios/cpus1_suspend_on_primary.expected, scenarios/cpus1_suspend_on_primary.scen, scenarios/cpus4_mode_case1.expected, scenarios/cpus4_mode_case1.scen, scenarios/cpus4_mode_case2.expected, scenarios/cpus4_mode_case2.scen, scenarios/cpus4_nonpreempt_case1.expected, scenarios/cpus4_nonpreempt_case1.scen, scenarios/cpus4_pick_older.expected, scenarios/cpus4_pick_older.scen, scenarios/cpus4_priority.expected, scenarios/cpus4_priority.scen, scenarios/cpus4_simple_nopreempt.expected, scenarios/cpus4_simple_nopreempt.scen, scenarios/cpus4_simple_preemption.expected, scenarios/cpus4_simple_preemption.scen, scenarios/cpus4_suspend_on_all.expected, scenarios/cpus4_suspend_on_all.scen, scenarios/cpus4_suspend_on_primary.expected, scenarios/cpus4_suspend_on_primary.scen, scenarios/cpus4_suspend_on_secondary.expected, scenarios/cpus4_suspend_on_secondary.scen: New files.
Diffstat (limited to 'schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c')
-rw-r--r--schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c b/schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c
new file mode 100644
index 0000000..06812d2
--- /dev/null
+++ b/schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c
@@ -0,0 +1,56 @@
+/*
+ * COPYRIGHT (c) 1989-2011.
+ * 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.
+ *
+ * $Id$
+ */
+
+#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/bspsmp.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 / IDLE / "
+ " SWITCH NEEDED\n"
+ );
+ for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
+ e = _Per_CPU_Information[cpu].executing;
+ h = _Per_CPU_Information[cpu].heir;
+ i = _Per_CPU_Information[cpu].idle;
+ printf(
+ " CPU %d: 0x%08x @%3ld / 0x%08x @%3ld / 0x%08x @%3ld %s\n",
+ cpu,
+ e->Object.id, (long) e->current_priority,
+ h->Object.id, (long) h->current_priority,
+ i->Object.id, (long) i->current_priority,
+ ((_Per_CPU_Information[cpu].dispatch_necessary) ? "true" : "false")
+ );
+ }
+ printf( "=== End of Ready Set of Threads\n" );
+
+ return 0;
+}