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 F0FADA0545; Tue, 11 Oct 2022 16:22:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CECDF42DE1; Tue, 11 Oct 2022 16:22:25 +0200 (CEST) Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by mails.dpdk.org (Postfix) with ESMTP id EF9ED42B7D for ; Tue, 11 Oct 2022 16:22:23 +0200 (CEST) Received: by mail-qv1-f46.google.com with SMTP id z18so9025576qvn.6 for ; Tue, 11 Oct 2022 07:22:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EAui1bjmy4tIykle5SUoE2UkF3X6xO6MSlB1DBnm3hY=; b=eHUFFXar3ukN0U+jKs3nLtOz+kavuJ507zn6wuEiifz+tYnRaBAEOTwbeRy5Mni/Rs P7rf2zDtvb/KAx/9wbTEQDwcvXyEOq0P0gMwob48jebeEGhUxKWxxkZxAR0frBvFfey7 oquvBijgSbhMd+CkDtNQDz10CsIeCL9CwQeYi9Yjq+lysPXLh94oRqwCYADyyylqNiKu Thozw4Pg9XmHsEYtWVWtyv78+bwkmL+aq3VWzAaMoV7tZnPkkVSYwdzFZkmqJywGeRUd KanPLq/Ms/mvHI1rhDtQJTFTgKz3JQ6NfZZfwIoC0eZO/52RtLSfigjOOopaP3poL9yd YbEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EAui1bjmy4tIykle5SUoE2UkF3X6xO6MSlB1DBnm3hY=; b=f1td620+rKtAzK2mb+4rFa2dTXC6uGCeb0x5/LP5XMA0DU5XHIHyRHr4so5tHyEL6l KzSepbAFgStJjb5aWBUCqAl2TOrQT07upStbi5YOU58fMu8Yb6s7EGVfBGPz9pJEgyWT 8EikZhz+p1u8caXVSl5om3hQQRBrUI6SB70k9p1pxATtU8y/Tmm9BVfYQIGKzJsjMCad J4xdk4VtSsAwYu3MKGjvg9GDXnZFcX+W/Tc6+qEq5jxq+jP4zOCF3ZoUVtOnl9NXDkGy 0iGVQxdx71t3+N90OOazGOvHmv1M72anzSKlgGtDaNJmx7gNp6phC4DBmCxhKX/1b6F9 HzsQ== X-Gm-Message-State: ACrzQf0QwWxQxVccnX9H/ooof7WueUNO+Ekxnn3YD6QzZWom+FlVZArI s2aM2I9Jl90a1zdVnEGZBncbY7ha1pWQ6a5njCM= X-Google-Smtp-Source: AMsMyM4aoMqWib0VJ+OiQZqZE2MxyoVI2A1XveLTTtI8c359Vd5bC8kqBly4BJESVi2sSSAXgq/17wv4ayhNqLmtQ2s= X-Received: by 2002:a05:6214:e49:b0:4b3:f24e:91ac with SMTP id o9-20020a0562140e4900b004b3f24e91acmr10480515qvc.41.1665498143337; Tue, 11 Oct 2022 07:22:23 -0700 (PDT) MIME-Version: 1.0 References: <20220921120359.2201131-1-david.marchand@redhat.com> <20221004094418.196544-1-david.marchand@redhat.com> <20221004094418.196544-5-david.marchand@redhat.com> In-Reply-To: <20221004094418.196544-5-david.marchand@redhat.com> From: Jerin Jacob Date: Tue, 11 Oct 2022 19:51:57 +0530 Message-ID: Subject: Re: [PATCH v2 4/9] trace: rework loop on trace points To: David Marchand Cc: dev@dpdk.org, skori@mavell.com, jerinj@marvell.com, Sunil Kumar Kori 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 On Tue, Oct 4, 2022 at 3:15 PM David Marchand wrote: > > Directly skip the block when a trace point does not match the user > criteria. > > Signed-off-by: David Marchand Acked-by: Jerin Jacob > --- > lib/eal/common/eal_common_trace.c | 34 +++++++++++++++++-------------- > 1 file changed, 19 insertions(+), 15 deletions(-) > > diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c > index 1db11e3e14..6b8660c318 100644 > --- a/lib/eal/common/eal_common_trace.c > +++ b/lib/eal/common/eal_common_trace.c > @@ -186,15 +186,18 @@ rte_trace_pattern(const char *pattern, bool enable) > int rc = 0, found = 0; > > STAILQ_FOREACH(tp, &tp_list, next) { > - if (fnmatch(pattern, tp->name, 0) == 0) { > - if (enable) > - rc = rte_trace_point_enable(tp->handle); > - else > - rc = rte_trace_point_disable(tp->handle); > - found = 1; > + if (fnmatch(pattern, tp->name, 0) != 0) > + continue; > + > + if (enable) > + rc = rte_trace_point_enable(tp->handle); > + else > + rc = rte_trace_point_disable(tp->handle); > + if (rc < 0) { > + found = 0; > + break; > } > - if (rc < 0) > - return rc; > + found = 1; > } > > return rc | found; > @@ -211,17 +214,18 @@ rte_trace_regexp(const char *regex, bool enable) > return -EINVAL; > > STAILQ_FOREACH(tp, &tp_list, next) { > - if (regexec(&r, tp->name, 0, NULL, 0) == 0) { > - if (enable) > - rc = rte_trace_point_enable(tp->handle); > - else > - rc = rte_trace_point_disable(tp->handle); > - found = 1; > - } > + if (regexec(&r, tp->name, 0, NULL, 0) != 0) > + continue; > + > + if (enable) > + rc = rte_trace_point_enable(tp->handle); > + else > + rc = rte_trace_point_disable(tp->handle); > if (rc < 0) { > found = 0; > break; > } > + found = 1; > } > regfree(&r); > > -- > 2.37.3 >