naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
592caf
From 5b5a590c5a8bbaebbecf4ab4797334a09a870287 Mon Sep 17 00:00:00 2001
592caf
From: Lennart Poettering <lennart@poettering.net>
592caf
Date: Mon, 23 Nov 2020 15:33:50 +0100
592caf
Subject: [PATCH] sd-event: let's suffix last_run/last_log with "_usec"
592caf
592caf
Otherwise it's a bit confusing what this is about: two timestamps.
592caf
592caf
(cherry picked from commit e6a7bee538f6638c2d5ca2afc66bf47cba3f075c)
592caf
592caf
Related: #1819868
592caf
---
592caf
 src/libsystemd/sd-event/sd-event.c | 12 ++++++------
592caf
 1 file changed, 6 insertions(+), 6 deletions(-)
592caf
592caf
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
592caf
index 9d42157206..88641879cc 100644
592caf
--- a/src/libsystemd/sd-event/sd-event.c
592caf
+++ b/src/libsystemd/sd-event/sd-event.c
592caf
@@ -301,7 +301,7 @@ struct sd_event {
592caf
 
592caf
         LIST_HEAD(sd_event_source, sources);
592caf
 
592caf
-        usec_t last_run, last_log;
592caf
+        usec_t last_run_usec, last_log_usec;
592caf
         unsigned delays[sizeof(usec_t) * 8];
592caf
 };
592caf
 
592caf
@@ -3579,19 +3579,19 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
592caf
         assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
592caf
         assert_return(e->state == SD_EVENT_INITIAL, -EBUSY);
592caf
 
592caf
-        if (e->profile_delays && e->last_run) {
592caf
+        if (e->profile_delays && e->last_run_usec != 0) {
592caf
                 usec_t this_run;
592caf
                 unsigned l;
592caf
 
592caf
                 this_run = now(CLOCK_MONOTONIC);
592caf
 
592caf
-                l = u64log2(this_run - e->last_run);
592caf
+                l = u64log2(this_run - e->last_run_usec);
592caf
                 assert(l < ELEMENTSOF(e->delays));
592caf
                 e->delays[l]++;
592caf
 
592caf
-                if (this_run - e->last_log >= 5*USEC_PER_SEC) {
592caf
+                if (this_run - e->last_log_usec >= 5*USEC_PER_SEC) {
592caf
                         event_log_delays(e);
592caf
-                        e->last_log = this_run;
592caf
+                        e->last_log_usec = this_run;
592caf
                 }
592caf
         }
592caf
 
592caf
@@ -3601,7 +3601,7 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
592caf
                 r = sd_event_wait(e, timeout);
592caf
 
592caf
         if (e->profile_delays)
592caf
-                e->last_run = now(CLOCK_MONOTONIC);
592caf
+                e->last_run_usec = now(CLOCK_MONOTONIC);
592caf
 
592caf
         if (r > 0) {
592caf
                 /* There's something now, then let's dispatch it */