[dpdk-dev] [PATCH] eal: add option to put timestamp on console output

Dmitry Kozlyuk dmitry.kozliuk at gmail.com
Fri Aug 14 20:39:29 CEST 2020


On Fri, 14 Aug 2020 10:34:41 -0700, 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. The timestamp format is chosen to look
> like the default Linux dmesg timestamp.
> 
> Example:
> [       0.000040] EAL: Probing VFIO support...
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  doc/guides/linux_gsg/linux_eal_parameters.rst |  5 +++
>  lib/librte_eal/common/eal_common_options.c    |  5 +++
>  lib/librte_eal/common/eal_internal_cfg.h      |  1 +
>  lib/librte_eal/common/eal_options.h           |  2 +
>  lib/librte_eal/linux/eal_log.c                | 41 +++++++++++++++++--
>  5 files changed, 51 insertions(+), 3 deletions(-)
[snip]

> @@ -1945,6 +1949,7 @@ eal_common_usage(void)
>  	       "  --"OPT_PROC_TYPE"         Type of this process (primary|secondary|auto)\n"
>  #ifndef RTE_EXEC_ENV_WINDOWS
>  	       "  --"OPT_SYSLOG"            Set syslog facility\n"
> +	       "  --"OPT_LOG_TIMESTAMP"     Timestamp log output\n"
>  #endif

Seems like FreeBSD doesn't support this option as well.

It is clear that iovec approach saves a syscall on each write, but is it worth
implementing log timestamps on each platform instead of prepending it in
common code (with a second fwrite call)? For fast event stream with precise
timestamps, there is tracing framework.


More information about the dev mailing list