[PATCH v5 2/4] eal: allow applications to report their cpu usage
Morten Brørup
mb at smartsharesystems.com
Wed Jan 4 11:28:22 CET 2023
> From: Robin Jarry [mailto:rjarry at redhat.com]
> Sent: Wednesday, 4 January 2023 11.14
>
> Morten Brørup, Dec 16, 2022 at 11:47:
> > > + usage_str[0] = '\0';
> > > + usage_cb = lcore_usage_cb;
> > > + if (usage_cb != NULL && usage_cb(lcore_id, &usage) == 0) {
> >
> > Move memset() inside here, and add comment:
> >
> > + /* The application's callback may not set all the fields in the
> structure, so clear it here. */
> > + memset(&usage, 0, sizeof(usage));
>
> This may make the code more complex than it needs to be (two nested
> ifs)
> for very little performance benefit. I'm not sure it is worth it. I can
> add the comment, though.
You are right - I missed that. Just adding the comment is fine.
Please also note my comment regarding the rte_lcore_usage_cb() function description:
"should be left to their default value." -> "must not be modified."
More information about the dev
mailing list