summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-12 10:14:06 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-12 14:19:05 +0100
commit61c14a31c8adb44486584611dc0491751d3dcde8 (patch)
tree52343f491c6dd36237e2c88b3770e0eb3ff199b2
parentFix documentation comment (diff)
downloadrtems-61c14a31c8adb44486584611dc0491751d3dcde8.tar.bz2
cpuuse: Call printer only once
-rw-r--r--cpukit/libmisc/cpuuse/cpuusagereport.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c
index e3157e8387..1049296cbd 100644
--- a/cpukit/libmisc/cpuuse/cpuusagereport.c
+++ b/cpukit/libmisc/cpuuse/cpuusagereport.c
@@ -51,27 +51,20 @@ static bool cpu_usage_visitor( Thread_Control *the_thread, void *arg )
ctx = arg;
rtems_object_get_name( the_thread->Object.id, sizeof( name ), name );
- rtems_printf(
- ctx->printer,
- " 0x%08" PRIx32 " | %-38s |",
- the_thread->Object.id,
- name
- );
-
_Thread_Get_CPU_time_used( the_thread, &used );
_TOD_Get_uptime( &uptime );
_Timestamp_Subtract( &ctx->uptime_at_last_reset, &uptime, &ctx->total );
_Timestamp_Divide( &used, &ctx->total, &ival, &fval );
-
- /*
- * Print the information
- */
-
seconds = _Timestamp_Get_seconds( &used );
nanoseconds = _Timestamp_Get_nanoseconds( &used ) /
TOD_NANOSECONDS_PER_MICROSECOND;
- rtems_printf( ctx->printer,
- "%7" PRIu32 ".%06" PRIu32 " |%4" PRIu32 ".%03" PRIu32 "\n",
+
+ rtems_printf(
+ ctx->printer,
+ " 0x%08" PRIx32 " | %-38s |"
+ "%7" PRIu32 ".%06" PRIu32 " |%4" PRIu32 ".%03" PRIu32 "\n",
+ the_thread->Object.id,
+ name,
seconds, nanoseconds,
ival, fval
);