[PATCH v9 5/5] eal: add option to put timestamp on console output

Stephen Hemminger stephen at networkplumber.org
Tue Mar 19 16:51:36 CET 2024


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.


More information about the dev mailing list