]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: lib-event - Copy ru_last when making passthrough event
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 25 May 2021 07:38:46 +0000 (10:38 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 14 Jun 2021 14:56:40 +0000 (17:56 +0300)
Otherwise user_cpu_usecs does not get added to the sent events.

src/lib/lib-event.c
src/lib/lib-event.h

index 8f71b467a2bce7fc75428a66988676e1a66bbd7c..cb2d663a9242d35076785f1a502f51b61a9edf25 100644 (file)
@@ -423,6 +423,7 @@ event_create_passthrough(struct event *parent, const char *source_filename,
                   Use the parent's creation timestamp. */
                event->tv_created_ioloop = parent->tv_created_ioloop;
                event->tv_created = parent->tv_created;
+               memcpy(&event->ru_last, &parent->ru_last, sizeof(parent->ru_last));
                event_last_passthrough = &event->event_passthrough;
        } else {
                event_last_passthrough = &parent->event_passthrough;
index babacf0f39a97e6e2fc195c79d57e30036a43369..d66c2dd91ffad88d7e815643bb38b6f563c94665 100644 (file)
@@ -342,7 +342,11 @@ void event_send_abort(struct event *event);
 /* Enable "user_cpu_usecs" event field to event by getting current resource
    usage which will be used in consequent event_send() to calculate
    cpu time. This function can be called multiple times to update the current
-   resource usage. */
+   resource usage.
+
+   The "user_cpu_usecs" field is automatically inherited by passthrough events,
+   but not full events.
+*/
 void event_enable_user_cpu_usecs(struct event *event);
 
 void lib_event_init(void);