source: rtems-schedsim/schedsim/shell/schedsim_smpsimple/main_dump_all_cpus.c @ 726b27c

Last change on this file since 726b27c was 726b27c, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 13, 2013 at 5:01:48 PM

schedsim: Update to latest RTEMS. Works Uniprocessor

  • 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/bspsmp.h>
22#include <rtems/score/percpu.h>
23#include <rtems/score/smp.h>
24#include <rtems/score/schedulerpriority.h>
25
26int 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].per_cpu.executing;
40    h = _Per_CPU_Information[cpu].per_cpu.heir;
41    printf(
42      "  CPU %d: 0x%08x @%3ld / 0x%08x @%3ld          %s\n",
43      cpu,
44      e->Object.id, (long) e->current_priority,
45      h->Object.id, (long) h->current_priority,
46      ((_Per_CPU_Information[cpu].per_cpu.dispatch_necessary) ?
47         "true" : "false")
48    );
49  }
50  printf( "=== End of Ready Set of Threads\n" );
51 
52  return 0;
53}
Note: See TracBrowser for help on using the repository browser.