Added osmonweb support functionality to monitor

This commit is contained in:
Thomas Doerfler
2007-09-05 20:35:36 +00:00
parent 7d7d2e9326
commit 501ab69168
8 changed files with 352 additions and 4 deletions
+8
View File
@@ -1,3 +1,11 @@
2007-09-05 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
* libmisc/monitor/mon-object.c,
* libmisc/monitor/monitor.h, libmisc/monitor/mon-part.c,
* libmisc/monitor/mon-region.c, libmisc/monitor/mon-sema.c,
* libmisc/monitor/mon-task, libmisc/Makefile.am:
Added functionality for osmonweb support
2007-09-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-object.c,
+32 -4
View File
@@ -160,6 +160,33 @@ rtems_monitor_command_entry_t rtems_monitor_commands[] = {
{ RTEMS_MONITOR_OBJECT_QUEUE },
&rtems_monitor_commands[11],
},
{ "sema",
"sema [id [id ... ] ]\n"
" display information about the specified semaphores\n"
" Default is to display information about all semaphores on this node\n"
,
0,
rtems_monitor_object_cmd,
RTEMS_MONITOR_OBJECT_SEMAPHORE,
},
{ "region",
"region [id [id ... ] ]\n"
" display information about the specified regions\n"
" Default is to display information about all regions on this node\n"
,
0,
rtems_monitor_object_cmd,
RTEMS_MONITOR_OBJECT_REGION,
},
{ "part",
"part [id [id ... ] ]\n"
" display information about the specified partitions\n"
" Default is to display information about all partitions on this node\n"
,
0,
rtems_monitor_object_cmd,
RTEMS_MONITOR_OBJECT_SEMAPHORE,
},
{ "object",
"Display information about specified RTEMS objects. "
"Object id's must include 'type' information. "
@@ -505,6 +532,10 @@ rtems_monitor_task(
}
}
if (!(monitor_flags & RTEMS_MONITOR_NOSYMLOAD)) {
rtems_monitor_symbols_loadup();
}
if (monitor_flags & RTEMS_MONITOR_SUSPEND)
(void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
@@ -573,10 +604,7 @@ rtems_monitor_init(
rtems_monitor_node = rtems_get_node(rtems_monitor_task_id);
rtems_monitor_default_node = rtems_monitor_node;
rtems_monitor_symbols_loadup();
if (monitor_flags & RTEMS_MONITOR_GLOBAL)
rtems_monitor_server_init(monitor_flags);
rtems_monitor_server_init(monitor_flags);
if (!(monitor_flags & RTEMS_MONITOR_NOTASK)) {
/*
+24
View File
@@ -84,6 +84,30 @@ rtems_monitor_object_info_t rtems_monitor_object_info[] =
(rtems_monitor_object_dump_header_fn) rtems_monitor_queue_dump_header,
(rtems_monitor_object_dump_fn) rtems_monitor_queue_dump,
},
{ RTEMS_MONITOR_OBJECT_SEMAPHORE,
(void *) &_Semaphore_Information,
sizeof(rtems_monitor_sema_t),
(rtems_monitor_object_next_fn) rtems_monitor_manager_next,
(rtems_monitor_object_canonical_fn) rtems_monitor_sema_canonical,
(rtems_monitor_object_dump_header_fn) rtems_monitor_sema_dump_header,
(rtems_monitor_object_dump_fn) rtems_monitor_sema_dump,
},
{ RTEMS_MONITOR_OBJECT_REGION,
(void *) &_Region_Information,
sizeof(rtems_monitor_region_t),
(rtems_monitor_object_next_fn) rtems_monitor_manager_next,
(rtems_monitor_object_canonical_fn) rtems_monitor_region_canonical,
(rtems_monitor_object_dump_header_fn) rtems_monitor_region_dump_header,
(rtems_monitor_object_dump_fn) rtems_monitor_region_dump,
},
{ RTEMS_MONITOR_OBJECT_PARTITION,
(void *) &_Partition_Information,
sizeof(rtems_monitor_part_t),
(rtems_monitor_object_next_fn) rtems_monitor_manager_next,
(rtems_monitor_object_canonical_fn) rtems_monitor_part_canonical,
(rtems_monitor_object_dump_header_fn) rtems_monitor_part_dump_header,
(rtems_monitor_object_dump_fn) rtems_monitor_part_dump,
},
{ RTEMS_MONITOR_OBJECT_EXTENSION,
(void *) &_Extension_Information,
sizeof(rtems_monitor_extension_t),
+68
View File
@@ -0,0 +1,68 @@
/*
* RTEMS Monitor partition support
*
* $Id$
*/
#include <rtems.h>
#include "monitor.h"
#include <rtems/rtems/attr.inl>
#include <stdio.h>
#include <string.h> /* memcpy() */
void
rtems_monitor_part_canonical(
rtems_monitor_part_t *canonical_part,
void *part_void
)
{
Partition_Control *rtems_part = (Partition_Control *) part_void;
canonical_part->attribute = rtems_part->attribute_set;
canonical_part->start_addr = rtems_part->starting_address;
canonical_part->length = rtems_part->length;
canonical_part->buf_size = rtems_part->buffer_size;
canonical_part->used_blocks = rtems_part->number_of_used_blocks;
}
void
rtems_monitor_part_dump_header(
boolean verbose
)
{
printf("\
ID NAME ATTR STARTADDR LENGTH BUF_SIZE USED_BLOCKS\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
1 2 3 4 5 6 7 */
rtems_monitor_separator();
}
/*
*/
void
rtems_monitor_part_dump(
rtems_monitor_part_t *monitor_part,
boolean verbose
)
{
int length = 0;
length += rtems_monitor_dump_id(monitor_part->id);
length += rtems_monitor_pad(11, length);
length += rtems_monitor_dump_name(monitor_part->name);
length += rtems_monitor_pad(18, length);
length += rtems_monitor_dump_attributes(monitor_part->attribute);
length += rtems_monitor_pad(30, length);
length += rtems_monitor_dump_hex((uint32_t)monitor_part->start_addr);
length += rtems_monitor_pad(40, length);
length += rtems_monitor_dump_hex(monitor_part->length);
length += rtems_monitor_pad(50, length);
length += rtems_monitor_dump_hex(monitor_part->buf_size);
length += rtems_monitor_pad(60, length);
length += rtems_monitor_dump_hex(monitor_part->used_blocks);
printf("\n");
}
+69
View File
@@ -0,0 +1,69 @@
/*
* RTEMS Monitor region support
*
* $Id$
*/
#include <rtems.h>
#include "monitor.h"
#include <rtems/rtems/attr.inl>
#include <stdio.h>
#include <string.h> /* memcpy() */
void
rtems_monitor_region_canonical(
rtems_monitor_region_t *canonical_region,
void *region_void
)
{
Region_Control *rtems_region = (Region_Control *) region_void;
canonical_region->attribute = rtems_region->attribute_set;
canonical_region->start_addr = rtems_region->starting_address;
canonical_region->length = rtems_region->length;
canonical_region->page_size = rtems_region->page_size;
canonical_region->max_seg_size = rtems_region->maximum_segment_size;
canonical_region->used_blocks = rtems_region->number_of_used_blocks;
}
void
rtems_monitor_region_dump_header(
boolean verbose
)
{
printf("\
ID NAME ATTR STARTADDR LENGTH PAGE_SIZE USED_BLOCKS\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
1 2 3 4 5 6 7 */
rtems_monitor_separator();
}
/*
*/
void
rtems_monitor_region_dump(
rtems_monitor_region_t *monitor_region,
boolean verbose
)
{
int length = 0;
length += rtems_monitor_dump_id(monitor_region->id);
length += rtems_monitor_pad(11, length);
length += rtems_monitor_dump_name(monitor_region->name);
length += rtems_monitor_pad(18, length);
length += rtems_monitor_dump_attributes(monitor_region->attribute);
length += rtems_monitor_pad(30, length);
length += rtems_monitor_dump_hex((uint32_t)monitor_region->start_addr);
length += rtems_monitor_pad(40, length);
length += rtems_monitor_dump_hex(monitor_region->length);
length += rtems_monitor_pad(50, length);
length += rtems_monitor_dump_hex(monitor_region->page_size);
length += rtems_monitor_pad(60, length);
length += rtems_monitor_dump_hex(monitor_region->used_blocks);
printf("\n");
}
+80
View File
@@ -0,0 +1,80 @@
/*
* RTEMS Monitor semaphore support
*
* $Id$
*/
#include <rtems.h>
#include "monitor.h"
#include <rtems/rtems/attr.inl>
#include <stdio.h>
#include <string.h> /* memcpy() */
void
rtems_monitor_sema_canonical(
rtems_monitor_sema_t *canonical_sema,
void *sema_void
)
{
Semaphore_Control *rtems_sema = (Semaphore_Control *) sema_void;
canonical_sema->attribute = rtems_sema->attribute_set;
canonical_sema->priority_ceiling =
rtems_sema->Core_control.mutex.Attributes.priority_ceiling;
canonical_sema->holder_id =
rtems_sema->Core_control.mutex.holder_id;
if (_Attributes_Is_counting_semaphore(canonical_sema->attribute)) {
/* we have a counting semaphore */
canonical_sema->cur_count =
rtems_sema->Core_control.semaphore.count;
canonical_sema->max_count =
rtems_sema->Core_control.semaphore.Attributes.maximum_count;
}
else {
/* we have a binary semaphore (mutex) */
canonical_sema->cur_count = rtems_sema->Core_control.mutex.lock;
canonical_sema->max_count = 1; /* mutex is either 0 or 1 */
}
}
void
rtems_monitor_sema_dump_header(
boolean verbose
)
{
printf("\
ID NAME ATTR PRICEIL CURR_CNT HOLDID \n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 1234
1 2 3 4 5 6 7 */
rtems_monitor_separator();
}
/*
*/
void
rtems_monitor_sema_dump(
rtems_monitor_sema_t *monitor_sema,
boolean verbose
)
{
int length = 0;
length += rtems_monitor_dump_id(monitor_sema->id);
length += rtems_monitor_pad(11, length);
length += rtems_monitor_dump_name(monitor_sema->name);
length += rtems_monitor_pad(18, length);
length += rtems_monitor_dump_attributes(monitor_sema->attribute);
length += rtems_monitor_pad(30, length);
length += rtems_monitor_dump_priority(monitor_sema->priority_ceiling);
length += rtems_monitor_pad(38, length);
length += rtems_monitor_dump_decimal(monitor_sema->cur_count);
length += rtems_monitor_pad(47, length);
length += rtems_monitor_dump_id(monitor_sema->holder_id);
printf("\n");
}
+8
View File
@@ -33,6 +33,14 @@ rtems_monitor_task_canonical(
canonical_task->state = rtems_thread->current_state;
canonical_task->wait_id = rtems_thread->Wait.id;
canonical_task->events = api->pending_events;
/*
* FIXME: make this optionally cpu_time_executed
*/
#if 0
canonical_task->ticks = rtems_thread->ticks_executed;
#else
canonical_task->ticks = 0;
#endif
/* XXX modes and attributes only exist in the RTEMS API .. */
/* XXX not directly in the core thread.. they will have to be derived */
+63
View File
@@ -105,6 +105,7 @@ typedef struct {
uint32_t notepad[RTEMS_NUMBER_NOTEPADS];
rtems_id wait_id;
uint32_t wait_args;
uint32_t ticks;
} rtems_monitor_task_t;
/*
@@ -137,6 +138,20 @@ typedef struct {
uint32_t maximum_message_size;
} rtems_monitor_queue_t;
/*
* Semaphore
*/
typedef struct {
rtems_id id;
rtems_name name;
/* end of common portion */
rtems_attribute attribute;
rtems_task_priority priority_ceiling;
uint32_t max_count;
uint32_t cur_count;
rtems_id holder_id;
} rtems_monitor_sema_t;
/*
* Extension
*/
@@ -154,6 +169,35 @@ typedef struct {
rtems_monitor_symbol_t e_fatal;
} rtems_monitor_extension_t;
/*
* Region
*/
typedef struct {
rtems_id id;
rtems_name name;
/* end of common portion */
rtems_attribute attribute;
void * start_addr;
uint32_t length;
uint32_t page_size;
uint32_t max_seg_size;
uint32_t used_blocks;
} rtems_monitor_region_t;
/*
* Partition
*/
typedef struct {
rtems_id id;
rtems_name name;
/* end of common portion */
rtems_attribute attribute;
void * start_addr;
uint32_t length;
uint32_t buf_size;
uint32_t used_blocks;
} rtems_monitor_part_t;
/*
* Device driver
*/
@@ -220,9 +264,12 @@ typedef union {
rtems_monitor_generic_t generic;
rtems_monitor_task_t task;
rtems_monitor_queue_t queue;
rtems_monitor_sema_t sema;
rtems_monitor_extension_t extension;
rtems_monitor_driver_t driver;
rtems_monitor_config_t config;
rtems_monitor_region_t region;
rtems_monitor_part_t part;
#if defined(RTEMS_MULTIPROCESSING)
rtems_monitor_mpci_t mpci;
#endif
@@ -364,6 +411,7 @@ int rtems_monitor_dump_notepad(uint32_t *notepad);
/* object.c */
rtems_id rtems_monitor_id_fixup(rtems_id, uint32_t , rtems_monitor_object_type_t);
rtems_monitor_object_info_t *rtems_monitor_object_lookup(rtems_monitor_object_type_t type);
rtems_id rtems_monitor_object_canonical_get(rtems_monitor_object_type_t, rtems_id, void *, size_t *size_p);
rtems_id rtems_monitor_object_canonical_next(rtems_monitor_object_info_t *, rtems_id, void *);
void *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *);
@@ -403,11 +451,26 @@ void rtems_monitor_task_canonical(rtems_monitor_task_t *, void *);
void rtems_monitor_task_dump_header(boolean verbose);
void rtems_monitor_task_dump(rtems_monitor_task_t *, boolean);
/* sema.c */
void rtems_monitor_sema_canonical(rtems_monitor_sema_t *, void *);
void rtems_monitor_sema_dump_header(boolean verbose);
void rtems_monitor_sema_dump(rtems_monitor_sema_t *, boolean);
/* queue.c */
void rtems_monitor_queue_canonical(rtems_monitor_queue_t *, void *);
void rtems_monitor_queue_dump_header(boolean verbose);
void rtems_monitor_queue_dump(rtems_monitor_queue_t *, boolean);
/* region.c */
void rtems_monitor_region_canonical(rtems_monitor_region_t *, void *);
void rtems_monitor_region_dump_header(boolean verbose);
void rtems_monitor_region_dump(rtems_monitor_region_t *, boolean);
/* partition.c */
void rtems_monitor_part_canonical(rtems_monitor_part_t *, void *);
void rtems_monitor_part_dump_header(boolean verbose);
void rtems_monitor_part_dump(rtems_monitor_part_t *, boolean);
/* driver.c */
void *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *);
void rtems_monitor_driver_canonical(rtems_monitor_driver_t *, void *);