source: rtems-schedsim/schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c @ 49fbe09

Last change on this file since 49fbe09 was 49fbe09, checked in by Jennifer Averett <jennifer.averett@…>, on May 8, 2014 at 3:17:03 PM

schedsim_smpsimple: Fix output of cpu dump.

  • Property mode set to 100644
File size: 1.3 KB
Line 
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/score/percpu.h>
22#include <rtems/score/smp.h>
23#include <rtems/score/schedulerpriority.h>
24
25int main_dump_all_cpus(int argc, char **argv)
26{
27  uint32_t        cpu;
28  Thread_Control *h;
29  Thread_Control *i;
30  Thread_Control *e;
31
32  printf(
33    "=== CPU Status\n"
34    "          EXECUTING      /   HEIR             / SWITCH NEEDED\n"
35  );
36  for ( cpu=0 ; cpu < _SMP_Processor_count ; cpu++ ) {
37    e = _Per_CPU_Information[cpu].per_cpu.executing;
38    h = _Per_CPU_Information[cpu].per_cpu.heir;
39    printf(
40      "  CPU %d: 0x%08x @%3ld / 0x%08x @%3ld          %s\n",
41      cpu,
42      e->Object.id, (long) e->current_priority,
43      h->Object.id, (long) h->current_priority,
44      ((_Per_CPU_Information[cpu].per_cpu.dispatch_necessary) ?
45         "true" : "false")
46    );
47  }
48  printf( "=== End of Ready Set of Threads\n" );
49 
50  return 0;
51}
Note: See TracBrowser for help on using the repository browser.