From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0A22441E04; Tue, 7 Mar 2023 17:05:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EDA72410EF; Tue, 7 Mar 2023 17:05:40 +0100 (CET) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id 6F11B40ED6 for ; Tue, 7 Mar 2023 17:05:40 +0100 (CET) Received: by mail-pj1-f54.google.com with SMTP id 6-20020a17090a190600b00237c5b6ecd7so16977508pjg.4 for ; Tue, 07 Mar 2023 08:05:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1678205139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=B8uE2w5sdpvxSq5FGfaPuXebLtv+bSyHLJqE6qSfdD4=; b=ndd6UgeQvCOXQ4AZljx6942kqo0VCNAdQ3xBT/FT/BmafkVvG+KuXC3QMCOd+MouAk 7xW2AqMW6TEjrNq6N/XgUOTVk4gOY14vsXrAmCe6QVSEFo2Aj3jiQu7oV0xS7HbLdwJN JPk3tmNhIqHTfJaC90cfy1+W96Y/zoDJTjCBgZ/aHbjX1fSlLIpqpwRqkg4qJp7XaTl+ 352yOVZVIfs+UXjvE3b0IY1oACFVyJxtjh5CReeDFOiWT8v8D01nZlUyAzeQbBNo1bkD Llx3S2DfyKfAwPQSbwiT3zxJyBSGYvj28pZU6csJJUrucM8aASRLjSNoyLqFqI+NK3ae Zv0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678205139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B8uE2w5sdpvxSq5FGfaPuXebLtv+bSyHLJqE6qSfdD4=; b=aFPKTgiey71T4mEEKT2jf3PvSxxVGdDrIkywNrecuxPJZAoRjLdurc5LZtoxxTyzLJ BxmgpAeVcVQwp/P1u/qAs/JpV6H+Bbi1gTSqcHn5xCQpM/g/edmAXDRzn7n46VH2JMsX 69OZuXIdYq0wXcZtyh9X8XIWaKSBpFqFRDbHId1TR7wz6+g03wEeKPoAFhAnrgZY+BHx WwrN4oOA1Z85jHGdMrW4ccXoivCj06YyFj9W7lPKyfD/0SQfNUHqowqlF8PotdT5/5Ld N4aMS39eEX6P4qU0VlVeOj151KVP4d6BXCFjHxHOVsIIQinttQX2F2OaS8xo0XatE0Uw s0IA== X-Gm-Message-State: AO0yUKWuGUuBxfrMrytOx8AqvKhttgjgZz8CXhlb4HcpV0yYJU/nJYWU gb86oSDRgovb0m00eSX/BRv8hA== X-Google-Smtp-Source: AK7set+hcJcvNw4puGq8lqr385qwLOtnGwKaV+COQcNSI0/o4Ds0riFJB4nl/SoGaosWnSoulRv/+g== X-Received: by 2002:a05:6a20:1a12:b0:cc:8e18:420f with SMTP id cj18-20020a056a201a1200b000cc8e18420fmr13103880pzb.35.1678205139453; Tue, 07 Mar 2023 08:05:39 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id b4-20020aa78704000000b005a8c60ce93bsm8348220pfo.149.2023.03.07.08.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 08:05:39 -0800 (PST) Date: Tue, 7 Mar 2023 08:05:37 -0800 From: Stephen Hemminger To: fengchengwen Cc: , Bruce Richardson Subject: Re: [PATCH v3 2/2] eal: add option to put timestamp on console output Message-ID: <20230307080537.0712c76d@hermes.local> In-Reply-To: <216dfffb-2a50-3288-27a5-5078ea9eb22d@huawei.com> References: <20200814173441.23086-1-stephen@networkplumber.org> <20230306192810.106154-1-stephen@networkplumber.org> <20230306192810.106154-3-stephen@networkplumber.org> <216dfffb-2a50-3288-27a5-5078ea9eb22d@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 7 Mar 2023 17:35:32 +0800 fengchengwen wrote: > On 2023/3/7 3:28, 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 > > --- > > .../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/unix/eal_log.c | 42 +++++++++++++++++-- > > 6 files changed, 84 insertions(+), 3 deletions(-) > > > > diff --git a/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst b/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst > > index fba467a2ce92..99cff10e963c 100644 > > --- a/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst > > +++ b/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst > > @@ -18,3 +18,35 @@ FreeBSD-specific EAL parameters > > ------------------------------- > > > > There are currently no FreeBSD-specific EAL command-line parameters available. > > + > > +Other options > > +~~~~~~~~~~~~~ > > + > > +* ``--syslog `` > > + > > + Set syslog facility. Valid syslog facilities are:: > > + > > + auth > > + cron > > + daemon > > + ftp > > + kern > > + lpr > > + mail > > + news > > + syslog > > + user > > + uucp > > + local0 > > + local1 > > + local2 > > + local3 > > + local4 > > + local5 > > + local6 > > + local7 > > This should add to commit 1/2 [PATCH v3 1/2] eal: unify logging code for FreeBsd and Linux > > > + > > +* ``--log-timestamp`` > > + > > + Add a timestamp of seconds and microseconds to each log message > > + written to standard output. > > diff --git a/doc/guides/linux_gsg/linux_eal_parameters.rst b/doc/guides/linux_gsg/linux_eal_parameters.rst > > index ea8f38139119..719ca6851625 100644 > > --- a/doc/guides/linux_gsg/linux_eal_parameters.rst > > +++ b/doc/guides/linux_gsg/linux_eal_parameters.rst > > @@ -135,3 +135,8 @@ Other options > > local5 > > local6 > > local7 > > + > > +* ``--log-timestamp`` > > + > > + Add a timestamp of seconds and microseconds to each log message > > + written to standard output. > > diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c > > index 03059336987d..2d3d8e82f7f3 100644 > > --- a/lib/eal/common/eal_common_options.c > > +++ b/lib/eal/common/eal_common_options.c > > @@ -76,6 +76,7 @@ eal_long_options[] = { > > {OPT_IOVA_MODE, 1, NULL, OPT_IOVA_MODE_NUM }, > > {OPT_LCORES, 1, NULL, OPT_LCORES_NUM }, > > {OPT_LOG_LEVEL, 1, NULL, OPT_LOG_LEVEL_NUM }, > > + {OPT_LOG_TIMESTAMP, 0, NULL, OPT_LOG_TIMESTAMP_NUM }, > > {OPT_TRACE, 1, NULL, OPT_TRACE_NUM }, > > {OPT_TRACE_DIR, 1, NULL, OPT_TRACE_DIR_NUM }, > > {OPT_TRACE_BUF_SIZE, 1, NULL, OPT_TRACE_BUF_SIZE_NUM }, > > @@ -1833,6 +1834,9 @@ eal_parse_common_option(int opt, const char *optarg, > > } > > break; > > } > > + case OPT_LOG_TIMESTAMP_NUM: > > + conf->log_timestamp = 1; > > + break; > > > > #ifndef RTE_EXEC_ENV_WINDOWS > > case OPT_TRACE_NUM: { > > @@ -2194,6 +2198,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 > > " --"OPT_LOG_LEVEL"= Set global log level\n" > > " --"OPT_LOG_LEVEL"=:\n" > > diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h > > index 167ec501fa79..33144c3619dd 100644 > > --- a/lib/eal/common/eal_internal_cfg.h > > +++ b/lib/eal/common/eal_internal_cfg.h > > @@ -85,6 +85,7 @@ struct internal_config { > > * per-node) non-legacy mode only. > > */ > > volatile int syslog_facility; /**< facility passed to openlog() */ > > + volatile uint8_t log_timestamp; /**< add timestamp to console output */ > > /** default interrupt mode for VFIO */ > > volatile enum rte_intr_mode vfio_intr_mode; > > /** the shared VF token for VFIO-PCI bound PF and VFs devices */ > > diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h > > index 3cc9cb641284..cc9723868e3c 100644 > > --- a/lib/eal/common/eal_options.h > > +++ b/lib/eal/common/eal_options.h > > @@ -35,6 +35,8 @@ enum { > > OPT_LCORES_NUM, > > #define OPT_LOG_LEVEL "log-level" > > OPT_LOG_LEVEL_NUM, > > +#define OPT_LOG_TIMESTAMP "log-timestamp" > > + OPT_LOG_TIMESTAMP_NUM, > > #define OPT_TRACE "trace" > > OPT_TRACE_NUM, > > #define OPT_TRACE_DIR "trace-dir" > > diff --git a/lib/eal/unix/eal_log.c b/lib/eal/unix/eal_log.c > > index d44416fd6570..d8a900efedea 100644 > > --- a/lib/eal/unix/eal_log.c > > +++ b/lib/eal/unix/eal_log.c > > @@ -4,11 +4,17 @@ > > > > #include > > #include > > +#include > > #include > > +#include > > +#include > > > > #include > > > > #include "eal_log.h" > > +#include "eal_private.h" > > + > > +static struct timespec log_start_time; > > This is process's private, how about support multi-process ? so that all process has the same base? If using primary/secondary, then the secondary's output would have time zero of when secondary started. Not sure if that is good or bad?