[PATCH v23 11/15] log: add timestamp option

Stephen Hemminger stephen at networkplumber.org
Wed Sep 18 17:05:00 CEST 2024


On Wed, 18 Sep 2024 15:37:49 +0800
fengchengwen <fengchengwen at huawei.com> wrote:

> ...
> 
> > +
> > +static enum {
> > +	LOG_TIMESTAMP_NONE = 0,
> > +	LOG_TIMESTAMP_TIME,	/* time since start */
> > +	LOG_TIMESTAMP_DELTA,	/* time since last message */
> > +	LOG_TIMESTAMP_RELTIME,  /* relative time since last message */
> > +	LOG_TIMESTAMP_CTIME,	/* Unix standard time format */
> > +	LOG_TIMESTAMP_ISO,	/* ISO8601 time format */  
> 
> Some of the impl should consider multiple-thread safety.
> 
> And for multiple-process, how about the secondary-processes align the main-process.


As much as possible, they are thread safe, that is why locatime_r is used.
Of course if multiple threads are printing it is possible that time stamps
could be out of order.  I.e CPU A got timestamp and is formatting message,
and CPU B got timestamp is formatting message. The formatting might take longer for A.


More information about the dev mailing list