]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Loops track also locking time
authorMaria Matejka <mq@ucw.cz>
Wed, 26 Apr 2023 17:34:29 +0000 (19:34 +0200)
committerMaria Matejka <mq@ucw.cz>
Wed, 26 Apr 2023 17:34:29 +0000 (19:34 +0200)
sysdep/unix/io-loop.c
sysdep/unix/io-loop.h

index db8556a624f0f64db8d251ece4419821e4977d0e..b3d930cb12a90704a5907da584b7d8f845e17c53 100644 (file)
@@ -974,10 +974,10 @@ bird_thread_show(void *data)
            (cs - i > fs) ? 0 : loop->time_by_sec_ns[(cs - i) % TIME_BY_SEC_SIZE]);
       bptr[-1] = 0; /* Drop the trailing space */
 
-      cli_printf(tsd->cli, -1026, "  Loop %s total time: %t",
-         domain_name(loop->time.domain), loop->total_time_spent_ns NS);
-      cli_printf(tsd->cli, -1026, "    last %d secs [ns]: %s",
-         MIN(CURRENT_SEC+1, TIME_BY_SEC_SIZE), b);
+      cli_printf(tsd->cli, -1026, "  Loop %s", domain_name(loop->time.domain));
+      cli_printf(tsd->cli, -1026, "    Total time: %t s", loop->total_time_spent_ns NS);
+      cli_printf(tsd->cli, -1026, "    Total locking time: %t s", loop->total_time_locking_ns NS);
+      cli_printf(tsd->cli, -1026, "    Last %d secs [ns]: %s", MIN(CURRENT_SEC+1, TIME_BY_SEC_SIZE), b);
     }
 
     total_time_ns += loop->total_time_spent_ns;
@@ -1183,6 +1183,8 @@ birdloop_run(void *_loop)
   if (locked_time > end_time)
     LOOP_WARN(loop, "locked %luns after its scheduled end time", locked_time - end_time);
 
+  loop->total_time_locking_ns += (locked_time - start_time);
+
   uint repeat, loop_runs = 0;
   do {
     repeat = 0;
index b5da7aba97300572a36a02b50a2f7768583b5222..d60b52069c6463c2da932a9363a880742412ee10 100644 (file)
@@ -69,6 +69,7 @@ struct birdloop
   u64 time_by_sec_ns[TIME_BY_SEC_SIZE];
   u64 last_time_finished_ns;
   u64 total_time_spent_ns;
+  u64 total_time_locking_ns;
 };
 
 struct bird_thread