From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id A15DEC4332F for ; Wed, 4 Jan 2023 10:13:38 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF77640A82; Wed, 4 Jan 2023 11:13:37 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 525EF40697 for ; Wed, 4 Jan 2023 11:13:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672827215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d7df2L5gzTo2bslRvNM2Mmwoh190wxeFwQwz3IcIdto=; b=dOy6sNzNmF8CynVUYFDX6O8OzP95n5Aulxo8+0Y+OW474BjQ8B+A9baIpSsDesxTeL4Fiu 8psXppiJ57q+4ANr0aZ9TPfTTf9Cs3q1VGnSHjgIZEwZS4xseXxHWNM/PjNUY0IvDw86Z7 +uMAFX5dKjjT4SWqzAnL2nLTylSc2M8= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-640-dWh3T3puNRucTDDPNf_SQw-1; Wed, 04 Jan 2023 05:13:34 -0500 X-MC-Unique: dWh3T3puNRucTDDPNf_SQw-1 Received: by mail-wr1-f72.google.com with SMTP id n13-20020adfc60d000000b0029bdfcf52eeso1165072wrg.8 for ; Wed, 04 Jan 2023 02:13:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Vp4JpLsbmp47+YZXZvqUx+zpQbd/d09EEe3S92AfAK4=; b=7Lbq6eljWdhTJCxvGmjPNbejcJFuCnF3mt7MLqp6lAGgVXx8hSuqNSjgmgXujcaV2j E9efnwINoL58rTWCoXWn+q2AcKbdCTrwCtGSwNvl4KREOlM2fjfXXCdmJ1M19uLb2lu9 S2ssxfZOFwgBKdZ5rjJK4EHjSblIZOiZRa7YToYVPA0SHuIhPzPxSJkf08mybyNU8pV5 OC4TE3GrmAcl1njIOrywxbIA+S9WL4H2SugSjTeXT8gf1M5VHvq+IBPeS9rOSjKhCxq3 bH64DypNoYz17/hkAzcZWqtWeltbnrJme4JzuTYTLY5dzemoAxhvE8nvEeWp2FkmmzK2 wcEA== X-Gm-Message-State: AFqh2kqbmxSj/PHTKS0wWJuhUGd0b+NiDKUZySYM9N97YXeVYFiQe8+P UlfV8JywkqRAEuPrwZlSO3fE4qQx1OggTsw+cwiLouWfm+5ysEGH0Eo03C7w5yZY+YR40l8Fj3m LCCc= X-Received: by 2002:a05:600c:35c7:b0:3d3:5d0f:6dfc with SMTP id r7-20020a05600c35c700b003d35d0f6dfcmr32835445wmq.30.1672827213507; Wed, 04 Jan 2023 02:13:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXsij1XwhhXWlixIHSMnTeH45YupstCVP7v58YxikC8PVvCu/0XLTHXak+sfNEaSROLvD1/Pxw== X-Received: by 2002:a05:600c:35c7:b0:3d3:5d0f:6dfc with SMTP id r7-20020a05600c35c700b003d35d0f6dfcmr32835442wmq.30.1672827213375; Wed, 04 Jan 2023 02:13:33 -0800 (PST) Received: from localhost (2a01cb000f483e0055ae3800781b5cbc.ipv6.abo.wanadoo.fr. [2a01:cb00:f48:3e00:55ae:3800:781b:5cbc]) by smtp.gmail.com with ESMTPSA id m22-20020a05600c4f5600b003d995a704fdsm29242445wmq.33.2023.01.04.02.13.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Jan 2023 02:13:33 -0800 (PST) Mime-Version: 1.0 Date: Wed, 04 Jan 2023 11:13:32 +0100 Message-Id: Cc: "Tyler Retzlaff" , "Kevin Laatz" Subject: Re: [PATCH v5 2/4] eal: allow applications to report their cpu usage From: "Robin Jarry" To: =?utf-8?q?Morten_Br=C3=B8rup?= , X-Mailer: aerc/0.13.0-167-g0f28e7e1ad84 References: <20221123102612.1688865-1-rjarry@redhat.com> <20221216102109.64142-1-rjarry@redhat.com> <20221216102109.64142-3-rjarry@redhat.com> <98CBD80474FA8B44BF855DF32C47DC35D875B7@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D875B7@smartserver.smartshare.dk> X-Mimecast-Spam-Score: 1 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 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 Morten Br=C3=B8rup, Dec 16, 2022 at 11:47: > > +=09usage_str[0] =3D '\0'; > > +=09usage_cb =3D lcore_usage_cb; > > +=09if (usage_cb !=3D NULL && usage_cb(lcore_id, &usage) =3D=3D 0) { > > Move memset() inside here, and add comment: > > + /* The application's callback may not set all the fields in the structu= re, 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.