]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
timerDB dump: log how long it took
authorLibor Peltan <libor.peltan@nic.cz>
Sat, 27 Dec 2025 19:53:24 +0000 (20:53 +0100)
committerLibor Peltan <libor.peltan@nic.cz>
Mon, 29 Dec 2025 10:27:16 +0000 (11:27 +0100)
src/knot/server/server.c

index e8f8cc52e80d9cac402681606bf04de73bbc2cec..d44bb6daace0dc1c20ff16f919526f0600255640 100644 (file)
@@ -973,18 +973,30 @@ static int rdb_listener_run(struct dthread *thread)
 }
 #endif // ENABLE_REDIS
 
+static void duration_to_str(char res[64], struct timespec *beg)
+{
+        struct timespec end = time_now();
+        double duration = time_diff_ms(beg, &end) / 1000.0;
+        if (duration >= 1.0) {
+                snprintf(res, 64, " in %0.2f seconds", duration);
+       }
+}
+
 static int timer_db_do_sync(struct dthread *thread)
 {
        server_t *s = thread->data;
 
        while (thread->state & ThreadActive) {
+               struct timespec beg = time_now();
                rcu_read_lock();
                int ret = zone_timers_write_all(&s->timerdb, s->zone_db);
                rcu_read_unlock();
+               char dur_str[64] = "";
+               duration_to_str(dur_str, &beg);
                if (ret == KNOT_EOK) {
-                       log_info("updated persistent timer DB");
+                       log_info("updated persistent timer DB%s", dur_str);
                } else {
-                       log_error("failed to update persistent timer DB (%s)", knot_strerror(ret));
+                       log_error("failed to update persistent timer DB%s (%s)", dur_str, knot_strerror(ret));
                }
 
                if (conf()->cache.db_timer_db_sync <= 0) {