[PATCH v9 5/5] eal: add option to put timestamp on console output
Morten Brørup
mb at smartsharesystems.com
Tue Mar 19 17:13:35 CET 2024
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Tuesday, 19 March 2024 16.52
>
> On Tue, 19 Mar 2024 08:37:30 +0100
> Morten Brørup <mb at smartsharesystems.com> wrote:
>
> > > static ssize_t
> > > console_log_write(__rte_unused void *c, const char *buf, size_t
> size)
> > > {
> > > + struct timespec ts;
> > > ssize_t ret;
> > >
> > > - /* write on stderr */
> > > - ret = fwrite(buf, 1, size, stderr);
> > > + if (timestamp_enabled) {
> > > + clock_gettime(CLOCK_MONOTONIC, &ts);
> > > + ts.tv_sec -= log_started.tv_sec;
> > > + ts.tv_nsec -= log_started.tv_nsec;
> >
> > Please log the absolute CLOCK_MONOTONIC instead of subtracting
> log_started, so timestamps can be easily compared with timestamps from
> other processes.
>
>
> No, was trying to do what kernel dmesg does.
What do you mean? Doesn't the kernel output CLOCK_MONOTONIC timestamps (without offset)?
And by "timestamps from other processes" I also mean timestamps in log messages from the kernel itself.
More information about the dev
mailing list