]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: let's suffix last_run/last_log with "_usec"
authorLennart Poettering <lennart@poettering.net>
Mon, 23 Nov 2020 14:33:50 +0000 (15:33 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Dec 2020 14:10:50 +0000 (15:10 +0100)
Otherwise it's a bit confusing what this is about: two timestamps.

src/libsystemd/sd-event/sd-event.c

index 9bcd22f90131b08f0fd5b635503e483c7cbfd442..d5a3cb79a368a81b7625210b948921ac1434b028 100644 (file)
@@ -120,7 +120,7 @@ struct sd_event {
 
         LIST_HEAD(sd_event_source, sources);
 
-        usec_t last_run, last_log;
+        usec_t last_run_usec, last_log_usec;
         unsigned delays[sizeof(usec_t) * 8];
 };
 
@@ -3755,19 +3755,19 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
         assert_return(e->state != SD_EVENT_FINISHED, -ESTALE);
         assert_return(e->state == SD_EVENT_INITIAL, -EBUSY);
 
-        if (e->profile_delays && e->last_run) {
+        if (e->profile_delays && e->last_run_usec != 0) {
                 usec_t this_run;
                 unsigned l;
 
                 this_run = now(CLOCK_MONOTONIC);
 
-                l = u64log2(this_run - e->last_run);
+                l = u64log2(this_run - e->last_run_usec);
                 assert(l < ELEMENTSOF(e->delays));
                 e->delays[l]++;
 
-                if (this_run - e->last_log >= 5*USEC_PER_SEC) {
+                if (this_run - e->last_log_usec >= 5*USEC_PER_SEC) {
                         event_log_delays(e);
-                        e->last_log = this_run;
+                        e->last_log_usec = this_run;
                 }
         }
 
@@ -3777,7 +3777,7 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
                 r = sd_event_wait(e, timeout);
 
         if (e->profile_delays)
-                e->last_run = now(CLOCK_MONOTONIC);
+                e->last_run_usec = now(CLOCK_MONOTONIC);
 
         if (r > 0) {
                 /* There's something now, then let's dispatch it */