From: Stephen Hemminger <stephen@networkplumber.org>
To: Congjie Zhou <zcjie0802@qq.com>
Cc: dev@dpdk.org, anatoly.burakov@intel.com
Subject: Re: [PATCH] eal/linux: redefine the name for rte_fbarray_init()
Date: Thu, 14 Nov 2024 08:24:59 -0800 [thread overview]
Message-ID: <20241114082459.10a991aa@hermes.local> (raw)
In-Reply-To: <tencent_B09D0FCCA142E4AE5ABFE584E92DCED8CB0A@qq.com>
On Thu, 14 Nov 2024 16:37:10 +0800
Congjie Zhou <zcjie0802@qq.com> wrote:
>
> +static uint64_t
> +current_time(void)
> +{
> + struct timespec ts;
> + if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts) == -1) {
> + EAL_LOG(ERR, "Fail to get current time");
> + return -1ULL;
> + }
> + uint64_t time_ns = (uint64_t)ts.tv_sec * 1000000000ULL + ts.tv_nsec;
> + return time_ns;
> +}
> +
> static int
> secondary_msl_create_walk(const struct rte_memseg_list *msl,
> void *arg __rte_unused)
> @@ -1447,8 +1460,8 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
> local_msl = &local_memsegs[msl_idx];
>
> /* create distinct fbarrays for each secondary */
> - snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
> - primary_msl->memseg_arr.name, getpid());
> + snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i_%"PRIx64,
> + primary_msl->memseg_arr.name, getpid(), current_time());
>
In general DPDK uses tsc instead of monotonic time, since it is faster and platform
independent (ie Windows).
Why not use use a global counter instead?
next prev parent reply other threads:[~2024-11-14 16:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 8:37 Congjie Zhou
2024-11-14 16:24 ` Stephen Hemminger [this message]
2024-11-14 17:06 ` Stephen Hemminger
-- strict thread matches above, loose matches on Subject: below --
2024-11-14 8:10 Congjie Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241114082459.10a991aa@hermes.local \
--to=stephen@networkplumber.org \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=zcjie0802@qq.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).