[rtems commit] cpuuse: Call printer only once

Sebastian Huber sebh at rtems.org
Thu Jan 12 13:29:08 UTC 2017


Module:    rtems
Branch:    master
Commit:    61c14a31c8adb44486584611dc0491751d3dcde8
Changeset: http://git.rtems.org/rtems/commit/?id=61c14a31c8adb44486584611dc0491751d3dcde8

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Jan 12 10:14:06 2017 +0100

cpuuse: Call printer only once

---

 cpukit/libmisc/cpuuse/cpuusagereport.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/cpukit/libmisc/cpuuse/cpuusagereport.c b/cpukit/libmisc/cpuuse/cpuusagereport.c
index e3157e8..1049296 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
   );




More information about the vc mailing list