mbox series

[v3,0/2] Add option to timestamp console log

Message ID 20230306192810.106154-1-stephen@networkplumber.org (mailing list archive)
Headers
Series Add option to timestamp console log |

Message

Stephen Hemminger March 6, 2023, 7:28 p.m. UTC
  This is a reprise of earlier patch to add timestamp to console
messages.

Example:
# dpdk-testpmd -l 1-4 -n 4 --vdev net_null0 --log-timestamp -- -i
EAL: Detected CPU lcores: 16
EAL: Detected NUMA nodes: 1
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
Interactive-mode selected
[       0.191407] testpmd: create a new mbuf pool <mb_pool_0>: n=171456, size=2176, socket=0
[       0.191510] testpmd: preferred mempool ops selected: ring_mp_mc


v3 - fix log init on FreeBSD

v2 
   - rebase to current DPDK
   - make linux log code common to freebsd


Stephen Hemminger (2):
  eal: unify logging code for FreeBsd and Linux
  eal: add option to put timestamp on console output

 .../freebsd_gsg/freebsd_eal_parameters.rst    | 32 ++++++
 doc/guides/linux_gsg/linux_eal_parameters.rst |  5 +
 lib/eal/common/eal_common_options.c           |  5 +
 lib/eal/common/eal_internal_cfg.h             |  1 +
 lib/eal/common/eal_options.h                  |  2 +
 lib/eal/freebsd/eal.c                         |  7 ++
 lib/eal/linux/eal_log.c                       | 61 ------------
 lib/eal/linux/meson.build                     |  1 -
 lib/eal/unix/eal_log.c                        | 97 +++++++++++++++++++
 lib/eal/unix/meson.build                      |  1 +
 10 files changed, 150 insertions(+), 62 deletions(-)
 delete mode 100644 lib/eal/linux/eal_log.c
 create mode 100644 lib/eal/unix/eal_log.c
  

Comments

Morten Brørup March 7, 2023, 7:33 a.m. UTC | #1
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Monday, 6 March 2023 20.28
> 
> This is a reprise of earlier patch to add timestamp to console
> messages.
> 
> Example:
> # dpdk-testpmd -l 1-4 -n 4 --vdev net_null0 --log-timestamp -- -i
> EAL: Detected CPU lcores: 16
> EAL: Detected NUMA nodes: 1
> EAL: Detected static linkage of DPDK
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'VA'
> Interactive-mode selected
> [       0.191407] testpmd: create a new mbuf pool <mb_pool_0>: n=171456,
> size=2176, socket=0
> [       0.191510] testpmd: preferred mempool ops selected: ring_mp_mc

This is useful.

Here's some feature creep: Since the timestamp output is configurable, there is no need to settle on one specific timestamp format. The option could allow a choice between MONOTONIC and REALTIME, with an option for REALTIME to include the date in ISO 8601 format (YYYY-MM-DD). And REALTIME could be UTC or local time. You could consider taking a format string for strftime(), with the extension that %f expands to 6 digit microseconds like in Python [1].

[1]: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes

With or without feature creep,

Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
  
Bruce Richardson March 7, 2023, 9:12 a.m. UTC | #2
On Tue, Mar 07, 2023 at 08:33:17AM +0100, Morten Brørup wrote:
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Monday, 6 March 2023 20.28
> > 
> > This is a reprise of earlier patch to add timestamp to console
> > messages.
> > 
> > Example:
> > # dpdk-testpmd -l 1-4 -n 4 --vdev net_null0 --log-timestamp -- -i
> > EAL: Detected CPU lcores: 16
> > EAL: Detected NUMA nodes: 1
> > EAL: Detected static linkage of DPDK
> > EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> > EAL: Selected IOVA mode 'VA'
> > Interactive-mode selected
> > [       0.191407] testpmd: create a new mbuf pool <mb_pool_0>: n=171456,
> > size=2176, socket=0
> > [       0.191510] testpmd: preferred mempool ops selected: ring_mp_mc
> 
> This is useful.
> 
> Here's some feature creep: Since the timestamp output is configurable, there is no need to settle on one specific timestamp format. The option could allow a choice between MONOTONIC and REALTIME, with an option for REALTIME to include the date in ISO 8601 format (YYYY-MM-DD). And REALTIME could be UTC or local time. You could consider taking a format string for strftime(), with the extension that %f expands to 6 digit microseconds like in Python [1].
> 
> [1]: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes
> 
> With or without feature creep,
> 
> Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
>

Missed the fact there was already a v3 when I acked v2, so repeating here.

Series-acked-by: Bruce Richardson <bruce.richardson@intel.com>

I'd rather not have the feature creep on it though - at least not yet!
  
Stephen Hemminger March 7, 2023, 4:04 p.m. UTC | #3
On Tue, 7 Mar 2023 08:33:17 +0100
Morten Brørup <mb@smartsharesystems.com> wrote:

> Here's some feature creep: Since the timestamp output is configurable, there is no need to settle on one specific timestamp format. The option could allow a choice between MONOTONIC and REALTIME, with an option for REALTIME to include the date in ISO 8601 format (YYYY-MM-DD). And REALTIME could be UTC or local time. You could consider taking a format string for strftime(), with the extension that %f expands to 6 digit microseconds like in Python [1].

Does that have compiler static checking issues if you allow user to set formats?