richardphibel / rpms / systemd

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