[PATCH 4/5] monitor: Add current CPU of thread

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jul 23 07:14:53 UTC 2015


---
 cpukit/libmisc/monitor/mon-task.c | 8 ++++++--
 cpukit/libmisc/monitor/monitor.h  | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cpukit/libmisc/monitor/mon-task.c b/cpukit/libmisc/monitor/mon-task.c
index 57f506e..0d65557 100644
--- a/cpukit/libmisc/monitor/mon-task.c
+++ b/cpukit/libmisc/monitor/mon-task.c
@@ -8,6 +8,7 @@
 
 #include <rtems.h>
 #include <rtems/monitor.h>
+#include <rtems/score/threadimpl.h>
 #include <rtems/score/threadqimpl.h>
 
 #include <stdio.h>
@@ -28,6 +29,7 @@ rtems_monitor_task_canonical(
     canonical_task->argument = rtems_thread->Start.numeric_argument;
     canonical_task->stack = rtems_thread->Start.Initial_stack.area;
     canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
+    canonical_task->cpu = _Per_CPU_Get_index( _Thread_Get_CPU( rtems_thread ) );
     canonical_task->priority = rtems_thread->current_priority;
     canonical_task->state = rtems_thread->current_state;
     canonical_task->wait_id = rtems_thread->Wait.id;
@@ -57,8 +59,8 @@ rtems_monitor_task_dump_header(
 )
 {
     fprintf(stdout,"\
-ID         NAME           PRI STATE  MODES    EVENTS WAITID   WAITQUEUE\n"); /*
-0a010004   SHLL           100 READY  P:T:nA     NONE 00000000 00000000 [DFLT] */
+ID         NAME       CPU PRI STATE  MODES    EVENTS WAITID   WAITQUEUE\n"); /*
+0a010004   SHLL         0 100 READY  P:T:nA     NONE 00000000 00000000 [DFLT] */
 
     rtems_monitor_separator();
 }
@@ -77,6 +79,8 @@ rtems_monitor_task_dump(
     length += rtems_monitor_dump_id(monitor_task->id);
     length += rtems_monitor_pad(11, length);
     length += rtems_monitor_dump_name(monitor_task->id);
+    length += rtems_monitor_pad(21, length);
+    length += rtems_monitor_dump_decimal(monitor_task->cpu);
     length += rtems_monitor_pad(26, length);
     length += rtems_monitor_dump_priority(monitor_task->priority);
     length += rtems_monitor_pad(30, length);
diff --git a/cpukit/libmisc/monitor/monitor.h b/cpukit/libmisc/monitor/monitor.h
index 4cc86c7..ccd907b 100644
--- a/cpukit/libmisc/monitor/monitor.h
+++ b/cpukit/libmisc/monitor/monitor.h
@@ -99,6 +99,7 @@ typedef struct {
     Thread_Entry_numeric_type  argument;
     void                      *stack;
     uint32_t                   stack_size;
+    uint32_t                   cpu;
     rtems_task_priority        priority;
     States_Control             state;
     rtems_event_set            events;
-- 
1.8.4.5




More information about the devel mailing list