]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
show threads: displaying the same thread id's as in log
authorMaria Matejka <mq@ucw.cz>
Thu, 27 Jun 2024 12:04:26 +0000 (14:04 +0200)
committerMaria Matejka <mq@ucw.cz>
Fri, 28 Jun 2024 20:03:45 +0000 (22:03 +0200)
sysdep/unix/io-loop.c

index 7f45f541e9bcefd6cdbfd71b242ce10a6485ef5b..6dca5f3c9fa7b6f24fcbb08ca9ba193b17bde2d2 100644 (file)
@@ -1297,7 +1297,7 @@ bird_thread_show(struct bird_thread_syncer *sync)
     tsd->lp = lp_new(tsd->sync.pool);
 
   if (tsd->show_loops)
-    tsd_append("Thread %p%s (busy counter %d)", this_thread, this_thread->busy_active ? " [busy]" : "", this_thread->busy_counter);
+    tsd_append("Thread %04x %s (busy counter %d)", THIS_THREAD_ID, this_thread->busy_active ? " [busy]" : "", this_thread->busy_counter);
 
   u64 total_time_ns = 0;
   struct birdloop *loop;
@@ -1316,8 +1316,10 @@ bird_thread_show(struct bird_thread_syncer *sync)
     bird_thread_show_spent_time(tsd, "Idle    ", &this_thread->idle);
   }
   else
-    tsd_append("Thread %p working %t s overhead %t s",
-       this_thread, total_time_ns NS, this_thread->overhead.total_ns NS);
+    tsd_append("%04x%s     % 9.3t s   % 9.3t s   % 9.3t s",
+       THIS_THREAD_ID, this_thread->busy_active ? " [busy]" : "       ",
+       total_time_ns NS, this_thread->overhead.total_ns NS,
+       (ns_now() - this_thread->meta->last_transition_ns) NS);
 }
 
 static void
@@ -1362,6 +1364,9 @@ cmd_show_threads_done(struct bird_thread_syncer *sync)
     UNLOCK_DOMAIN(attrs, group->domain);
   }
 
+  if (!tsd->show_loops)
+    cli_printf(tsd->cli, -1027, "Thread ID       Working         Overhead        Last Pickup/Drop");
+
   for (uint i = 0; i < tsd->line_pos - 1; i++)
     cli_printf(tsd->cli, -1027, "%s", tsd->lines[i]);