source: rtems/cpukit/libmisc/monitor/mon-task.c @ 501ab691

4.104.114.84.95
Last change on this file since 501ab691 was 501ab691, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 09/05/07 at 20:35:36

Added osmonweb support functionality to monitor

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * RTEMS Monitor task support
3 *
4 *  $Id$
5 */
6
7#ifdef HAVE_CONFIG_H
8#include "config.h"
9#endif
10
11#include <rtems.h>
12#include <rtems/monitor.h>
13
14#include <stdio.h>
15#include <string.h>    /* memcpy() */
16
17void
18rtems_monitor_task_canonical(
19    rtems_monitor_task_t  *canonical_task,
20    void                  *thread_void
21)
22{
23    Thread_Control       *rtems_thread = (Thread_Control *) thread_void;
24    RTEMS_API_Control    *api;
25
26    api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
27
28    canonical_task->entry = rtems_thread->Start.entry_point;
29    canonical_task->argument = rtems_thread->Start.numeric_argument;
30    canonical_task->stack = rtems_thread->Start.Initial_stack.area;
31    canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
32    canonical_task->priority = rtems_thread->current_priority;
33    canonical_task->state = rtems_thread->current_state;
34    canonical_task->wait_id = rtems_thread->Wait.id;
35    canonical_task->events = api->pending_events;
36    /*
37     * FIXME: make this optionally cpu_time_executed
38     */
39#if 0
40    canonical_task->ticks = rtems_thread->ticks_executed;
41#else
42    canonical_task->ticks = 0;
43#endif
44
45/* XXX modes and attributes only exist in the RTEMS API .. */
46/* XXX not directly in the core thread.. they will have to be derived */
47/* XXX if they are important enough to include anymore.   */
48    canonical_task->modes = 0; /* XXX FIX ME.... rtems_thread->current_modes; */
49    canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->API_Extensions[ THREAD_API_RTEMS ]->attribute_set */;
50    (void) memcpy(canonical_task->notepad, api ->Notepads, sizeof(canonical_task->notepad));
51/* XXX more to fix */
52/*
53    (void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
54*/
55}
56
57
58void
59rtems_monitor_task_dump_header(
60    boolean verbose
61)
62{
63    fprintf(stdout,"\
64  ID       NAME   PRIO   STAT   MODES  EVENTS   WAITID  WAITARG  NOTES\n");
65/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
660         1         2         3         4         5         6         7       */
67
68    rtems_monitor_separator();
69}
70
71/*
72 */
73
74void
75rtems_monitor_task_dump(
76    rtems_monitor_task_t *monitor_task,
77    boolean  verbose
78)
79{
80    int length = 0;
81
82    length += rtems_monitor_dump_id(monitor_task->id);
83    length += rtems_monitor_pad(11, length);
84    length += rtems_monitor_dump_name(monitor_task->name);
85    length += rtems_monitor_pad(18, length);
86    length += rtems_monitor_dump_priority(monitor_task->priority);
87    length += rtems_monitor_pad(24, length);
88    length += rtems_monitor_dump_state(monitor_task->state);
89    length += rtems_monitor_pad(31, length);
90    length += rtems_monitor_dump_modes(monitor_task->modes);
91    length += rtems_monitor_pad(39, length);
92    length += rtems_monitor_dump_events(monitor_task->events);
93    if (monitor_task->wait_id)
94    {
95        length += rtems_monitor_pad(47, length);
96        length += rtems_monitor_dump_id(monitor_task->wait_id);
97        length += rtems_monitor_pad(57, length);
98        length += rtems_monitor_dump_hex(monitor_task->wait_args);
99    }
100
101    length += rtems_monitor_pad(65, length);
102    length += rtems_monitor_dump_notepad(monitor_task->notepad);
103    fprintf(stdout,"\n");
104}
Note: See TracBrowser for help on using the repository browser.