<div dir="ltr">Hi Paul:<div><br></div><div>properties on the manager object, you can get them with: </div><div><br></div><div><div>[~] sudo systemctl show -p InitRDTimestampMonotonic</div><div>InitRDTimestampMonotonic=0</div><div><br></div><div>there is also the long way:</div><div><br></div><div><div>[~] busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager InitRDTimestampMonotonic</div><div>t 0</div></div><div><br></div><div>if you want to get this value from a shell script, you can use either, but i recommend `systemctl show`. if you can aford not to run this on shell, and do it in c, just bind against libsystemd and call methods in systemd/sd-bus.h , and if you can run stuff on high level languages like python... try pystemd (but i'm bias against the last one because i'm the author and its not a official systemd tool)</div><div><br></div><div>best of lucks</div><div><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><br>Alvaro Leiva<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 3, 2018 at 10:24 PM Paul Menzel <<a href="mailto:pmenzel%2Bsystemd-devel@molgen.mpg.de">pmenzel+systemd-devel@molgen.mpg.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear systemd folks,<br>
<br>
<br>
Debian uses a shell script as `/init` in initrd, and I like to extend <br>
that, to set the time stamps for the initrd execution.<br>
<br>
`systemd-analyze` built from `src/analyze/analyze.c` uses D-Bus to get <br>
the time stamp to display that.<br>
<br>
```<br>
            bus_get_uint64_property(bus,<br>
                                     "/org/freedesktop/systemd1",<br>
                                     "org.freedesktop.systemd1.Manager",<br>
                                     "InitRDTimestampMonotonic",<br>
                                     &times.initrd_time) < 0<br>
```<br>
<br>
In `src/core/manager.c` the value is set like below.<br>
<br>
```<br>
                 if <br>
(dual_timestamp_is_set(&m->timestamps[MANAGER_TIMESTAMP_INITRD])) {<br>
<br>
                         /* The initrd case on bare-metal*/<br>
                         kernel_usec = <br>
m->timestamps[MANAGER_TIMESTAMP_INITRD].monotonic - <br>
m->timestamps[MANAGER_TIMESTAMP_KERNEL].monotonic;<br>
                         initrd_usec = <br>
m->timestamps[MANAGER_TIMESTAMP_USERSPACE].monotonic - <br>
m->timestamps[MANAGER_TIMESTAMP_INITRD].monotonic;<br>
<br>
                         log_struct(LOG_INFO,<br>
                                    "MESSAGE_ID=" <br>
SD_MESSAGE_STARTUP_FINISHED_STR,<br>
                                    "KERNEL_USEC="USEC_FMT, kernel_usec,<br>
                                    "INITRD_USEC="USEC_FMT, initrd_usec,<br>
                                    "USERSPACE_USEC="USEC_FMT, <br>
userspace_usec,<br>
                                    LOG_MESSAGE("Startup finished in <br>
%s%s (kernel) + %s (initrd) + %s (userspace) = %s.",<br>
                                                buf,<br>
                                                format_timespan(kernel, <br>
sizeof(kernel), kernel_usec, USEC_PER_MSEC),<br>
                                                format_timespan(initrd, <br>
sizeof(initrd), initrd_usec, USEC_PER_MSEC),<br>
<br>
format_timespan(userspace, sizeof(userspace), userspace_usec, <br>
USEC_PER_MSEC),<br>
                                                format_timespan(sum, <br>
sizeof(sum), total_usec, USEC_PER_MSEC)));<br>
```<br>
<br>
<br>
<br>
<br>
Is it possible to set that value from a shell script? If yes, could you <br>
please tell me how?<br>
<br>
<br>
Kind regards,<br>
<br>
Paul<br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div>