RTEMS | perioduse needs updated to use _Thread_Get_name (#5720)

Sam Price (@TheSamPrice) gitlab at rtems.org
Wed Aug 19 23:18:16 UTC 2026



Issue created by Sam Price: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5720



## Summary
<!--
Please provide as much information as possible such as error messages or attaching logs
-->


## Steps to reproduce

+++ b/cpukit/rtems/src/ratemonreportstatistics.c
@@ -42,6 +42,7 @@
 #include <rtems/rtems/ratemonimpl.h>
 #include <rtems/rtems/object.h>
 #include <rtems/printer.h>
+#include <rtems/score/thread.h>

 #include <inttypes.h>
 #include <rtems/inttypes.h>
@@ -60,7 +61,7 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
  rtems_id                id;
  rtems_rate_monotonic_period_statistics the_stats;
  rtems_rate_monotonic_period_status   the_status;
- char                  name[5];
+ char                  name[38]; /* Increased size for full thread names */

  rtems_printf( printer, "Period information by period\n" );
  rtems_printf( printer, "--- CPU times are in seconds ---\n" );
@@ -79,9 +80,9 @@ ididididid NNNN ccccc mmmmmm X
 \n");
 */
  rtems_printf( printer,
-   "  ID   OWNER COUNT MISSED   "
+   "  ID          OWNER          COUNT MISSED   "
    "   CPU TIME         WALL TIME\n"
-   "                "
+   "                                  "
    "   MIN/MAX/AVG        MIN/MAX/AVG\n"
  );

@@ -108,13 +109,22 @@ ididididid NNNN ccccc mmmmmm X
    (void) rtems_rate_monotonic_get_status( id, &the_status );
   #endif

-  rtems_object_get_name( the_status.owner, sizeof(name), name );
+  /* Get thread name - works for both RTEMS Classic and POSIX threads */
+  {
+   Thread_Control *the_thread = _Thread_Get_from_id( the_status.owner );
+   if ( the_thread != NULL ) {
+    _Thread_Get_name( the_thread, name, sizeof(name) );
+   } else {
+    /* Fallback to object name if thread lookup fails */
+    rtems_object_get_name( the_status.owner, sizeof(name), name );
+   }
+  }

   /*
   * Print part of report line that is not dependent on granularity
   */
   rtems_printf( printer,
-   "0x%08" PRIx32 " %4s %5" PRId32 " %6" PRId32 " ",
+   "0x%08" PRIx32 " %-38s %5" PRId32 " %6" PRId32 " ",
    id, name,
    the_stats.count, the_stats.missed_count
   );
<!-- Pre-set options
- milestone
-->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5720
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/sent_notifications/5-6fggaele85jsxyuxtbacebl83-1d/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260819/3e2f0452/attachment.htm>


More information about the bugs mailing list