[PATCH v5 2/4] eal: allow applications to report their cpu usage
Robin Jarry
rjarry at redhat.com
Wed Jan 4 11:13:32 CET 2023
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.
More information about the dev
mailing list