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

fengchengwen fengchengwen at huawei.com
Wed Sep 18 09:37:49 CEST 2024


On 2024/9/18 12:56, Stephen Hemminger wrote:
> When debugging driver or startup issues, it is useful to have
> a timestamp on each message printed. The messages in syslog
> already have a timestamp, but often syslog is not available
> during testing.
> 
> There are multiple timestamp formats similar to Linux dmesg.
> The default is time relative since startup (when first
> step of logging initialization is done by constructor).
> Other alternative formats are delta, ctime, reltime and iso formats.
> 
> Example:
> $ dpdk-testpmd --log-timestamp -- -i
> [     0.008610] EAL: Detected CPU lcores: 8
> [     0.008634] EAL: Detected NUMA nodes: 1
> [     0.008792] EAL: Detected static linkage of DPDK
> [     0.010620] EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> [     0.012618] EAL: Selected IOVA mode 'VA'
> [     0.016675] testpmd: No probed ethernet devices
> Interactive-mode selected
> 

...

> +
> +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.





More information about the dev mailing list