From bf89c76217d64bcf6372486f111b2bd9174e732e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 17 Nov 2006 22:55:51 +0000 Subject: 2006-11-17 Joel Sherrill * libmisc/rtmonuse/rtmonuse.c: Do not use float for calculations. --- cpukit/ChangeLog | 4 ++++ cpukit/libmisc/rtmonuse/rtmonuse.c | 27 +++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 0d80208c13..795e7a2627 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,7 @@ +2006-11-17 Joel Sherrill + + * libmisc/rtmonuse/rtmonuse.c: Do not use float for calculations. + 2006-11-17 Joel Sherrill * libcsupport/src/sync.c: Do not dereference NULL reent. diff --git a/cpukit/libmisc/rtmonuse/rtmonuse.c b/cpukit/libmisc/rtmonuse/rtmonuse.c index 4b8c2cbfe4..b954fae988 100644 --- a/cpukit/libmisc/rtmonuse/rtmonuse.c +++ b/cpukit/libmisc/rtmonuse/rtmonuse.c @@ -135,6 +135,8 @@ void Period_usage_Dump( void ) char *cname; char name[5]; uint32_t api_index; + uint32_t ival_cpu, fval_cpu; + uint32_t ival_wall, fval_wall; Objects_Information *information; if ( !Period_usage_Information ) { @@ -142,8 +144,10 @@ void Period_usage_Dump( void ) return; } - fprintf(stdout, "Period information by period\n" ); - fprintf(stdout, " ID OWNER PERIODS MISSED CPU TIME WALL TIME\n" ); + fprintf(stdout, + "Period information by period\n" + " ID OWNER PERIODS MISSED CPU TIME WALL TIME\n" + ); /* * RTEMS does not use an index of zero for object ids. @@ -192,19 +196,30 @@ void Period_usage_Dump( void ) if ( !isprint(name[3]) ) name[3] = '*'; + ival_cpu = the_usage->total_cpu_time * 100 / the_usage->count; + fval_cpu = ival_cpu % 100; + ival_cpu /= 100; + ival_wall = the_usage->total_wall_time * 100 / the_usage->count; + fval_wall = ival_wall % 100; + ival_wall /= 100; fprintf(stdout, - "0x%08" PRIx32 " %4s %6" PRId32 " %3" PRId32 " %" PRId32 - "/%" PRId32 "/%5.2f %" PRId32 "/%" PRId32 "/%3.2f\n", + "0x%08" PRIx32 " %4s %6" PRId32 " %3" PRId32 " " + "%" PRId32 "/%" PRId32 "/%" PRId32 ".%02" PRId32 " " + "%" PRId32 "/%" PRId32 "/%" PRId32 ".%02" PRId32 "\n", the_usage->id, name, the_usage->count, the_usage->missed_count, + the_usage->min_cpu_time, the_usage->max_cpu_time, - (double) the_usage->total_cpu_time / (double) the_usage->count, + ival_cpu, fval_cpu, + /* (double) the_usage->total_cpu_time / (double) the_usage->count, */ + the_usage->min_wall_time, the_usage->max_wall_time, - (double) the_usage->total_wall_time / (double) the_usage->count + ival_wall, fval_wall + /* (double) the_usage->total_wall_time / (double) the_usage->count */ ); } } -- cgit v1.2.3