summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2003-12-11 14:21:00 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2003-12-11 14:21:00 +0000
commite482c592854fd8a54f23d908ef79b1a35d314f95 (patch)
treea70bc2e119d26f37e56c85adb3e4897bc54b626b /cpukit
parent2003-12-11 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-e482c592854fd8a54f23d908ef79b1a35d314f95.tar.bz2
2003-12-11 Joel Sherrill <joel@OARcorp.com>
PR 540/rtems_misc * cpuuse/cpuuse.c, rtmonuse/rtmonuse.c: Correct object name printing.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libmisc/ChangeLog5
-rw-r--r--cpukit/libmisc/cpuuse/cpuuse.c24
-rw-r--r--cpukit/libmisc/rtmonuse/rtmonuse.c44
3 files changed, 55 insertions, 18 deletions
diff --git a/cpukit/libmisc/ChangeLog b/cpukit/libmisc/ChangeLog
index 419d2563e5..157ca092b5 100644
--- a/cpukit/libmisc/ChangeLog
+++ b/cpukit/libmisc/ChangeLog
@@ -1,5 +1,10 @@
2003-12-11 Joel Sherrill <joel@OARcorp.com>
+ PR 540/rtems_misc
+ * cpuuse/cpuuse.c, rtmonuse/rtmonuse.c: Correct object name printing.
+
+2003-12-11 Joel Sherrill <joel@OARcorp.com>
+
PR 531/rtems_misc
* rtmonuse/rtmonuse.c, stackchk/check.c: Correct indexing.
diff --git a/cpukit/libmisc/cpuuse/cpuuse.c b/cpukit/libmisc/cpuuse/cpuuse.c
index 739321a005..bf4f674fce 100644
--- a/cpukit/libmisc/cpuuse/cpuuse.c
+++ b/cpukit/libmisc/cpuuse/cpuuse.c
@@ -40,6 +40,7 @@ void CPU_usage_Dump( void )
Thread_Control *the_thread;
Objects_Information *information;
unsigned32 u32_name;
+ char *cname;
char name[5];
unsigned32 total_units = 0;
@@ -79,16 +80,21 @@ void CPU_usage_Dump( void )
if ( !the_thread )
continue;
- if ( information->is_string )
- u32_name = *(unsigned32 *)the_thread->Object.name;
- else
+ if ( information->is_string ) {
+ cname = the_thread->Object.name;
+ name[ 0 ] = cname[0];
+ name[ 1 ] = cname[1];
+ name[ 2 ] = cname[2];
+ name[ 3 ] = cname[3];
+ name[ 4 ] = '\0';
+ } else {
u32_name = (unsigned32)the_thread->Object.name;
-
- name[ 0 ] = (u32_name >> 24) & 0xff;
- name[ 1 ] = (u32_name >> 16) & 0xff;
- name[ 2 ] = (u32_name >> 8) & 0xff;
- name[ 3 ] = (u32_name >> 0) & 0xff;
- name[ 4 ] = '\0';
+ name[ 0 ] = (u32_name >> 24) & 0xff;
+ name[ 1 ] = (u32_name >> 16) & 0xff;
+ name[ 2 ] = (u32_name >> 8) & 0xff;
+ name[ 3 ] = (u32_name >> 0) & 0xff;
+ name[ 4 ] = '\0';
+ }
if ( !isprint(name[0]) ) name[0] = '*';
if ( !isprint(name[1]) ) name[1] = '*';
diff --git a/cpukit/libmisc/rtmonuse/rtmonuse.c b/cpukit/libmisc/rtmonuse/rtmonuse.c
index 52c272828d..bd1d4b38b0 100644
--- a/cpukit/libmisc/rtmonuse/rtmonuse.c
+++ b/cpukit/libmisc/rtmonuse/rtmonuse.c
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
+#include <ctype.h>
#include <rtems/rtmonuse.h>
@@ -130,7 +131,10 @@ void Period_usage_Dump( void )
Period_usage_t *the_usage;
Rate_monotonic_Control *the_period;
unsigned32 u32_name;
+ char *cname;
char name[5];
+ unsigned32 api_index;
+ Objects_Information *information;
if ( !Period_usage_Information ) {
printf( "Period statistics library is not initialized\n" );
@@ -154,17 +158,39 @@ void Period_usage_Dump( void )
the_period =
(Rate_monotonic_Control *)_Rate_monotonic_Information.local_table[ i ];
- if ( the_period->owner )
- u32_name = *(unsigned32 *)the_period->owner->Object.name;
- else
- u32_name = rtems_build_name(' ', ' ', ' ', ' ');
-
- name[ 0 ] = (u32_name >> 24) & 0xff;
- name[ 1 ] = (u32_name >> 16) & 0xff;
- name[ 2 ] = (u32_name >> 8) & 0xff;
- name[ 3 ] = (u32_name >> 0) & 0xff;
+ name[ 0 ] = ' ';
+ name[ 1 ] = ' ';
+ name[ 2 ] = ' ';
+ name[ 3 ] = ' ';
name[ 4 ] = '\0';
+ if ( the_period->owner ) {
+ api_index = _Objects_Get_API(the_period->owner->Object.id);
+ information = _Objects_Information_table[ api_index ][ 1 ];
+
+ if ( information->is_string ) {
+ cname = the_period->owner->Object.name;
+ name[ 0 ] = cname[0];
+ name[ 1 ] = cname[1];
+ name[ 2 ] = cname[2];
+ name[ 3 ] = cname[3];
+ name[ 4 ] = '\0';
+ } else {
+ u32_name = (unsigned32)the_period->owner->Object.name;
+ name[ 0 ] = (u32_name >> 24) & 0xff;
+ name[ 1 ] = (u32_name >> 16) & 0xff;
+ name[ 2 ] = (u32_name >> 8) & 0xff;
+ name[ 3 ] = (u32_name >> 0) & 0xff;
+ name[ 4 ] = '\0';
+ }
+ }
+
+ if ( !isprint(name[0]) ) name[0] = '*';
+ if ( !isprint(name[1]) ) name[1] = '*';
+ if ( !isprint(name[2]) ) name[2] = '*';
+ if ( !isprint(name[3]) ) name[3] = '*';
+
+
printf(
"0x%08x %4s %6d %3d %d/%d/%5.2f %d/%d/%3.2f\n",
the_usage->id,