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

Stephen Hemminger stephen at networkplumber.org
Fri Aug 14 20:45:49 CEST 2020


On Fri, 14 Aug 2020 21:39:29 +0300
Dmitry Kozlyuk <dmitry.kozliuk at gmail.com> wrote:

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

FreeBsd doesn't go through the same log code.

Iovec is to keep timestamp and message as an atomic message.
There is no good way to use fwrite to get anything atomic.
Fwrite is unnecessary here anyway saving a copy and avoid issues with library
getting corrupted is good.


More information about the dev mailing list