Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4690565pxv; Tue, 29 Jun 2021 13:11:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweox4vHe47Ko4xAeEWnrmT23RFYfmP/h0eOdNaGUT2QBEGrYBIsnAEmTp0bWuFv0KWkwWH X-Received: by 2002:a17:906:1d11:: with SMTP id n17mr8026106ejh.545.1624997469955; Tue, 29 Jun 2021 13:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624997469; cv=none; d=google.com; s=arc-20160816; b=lw6NwafgDBsxDxlePlKmd8h0bhpvkey0XMD/9TEFQQ4bWbTnUxcqnMfNwy5h1KgL88 Fu91vuGGwnMzq/gqScdQgE96NS5xcRBZR0pYX4ju885E1ApXIV4UST65xhocU1cUHtwE 4QBm5wlknoaQKW+lmmovPvp9dKgkY1k/dL+O5kBqN1Wu/R3CggyhLfhCBjtXmiXA15zf 6j9zLKRSo1lAxT6D7xUdEGdwlA477PFqFRjoh4+tWdU7Xux/DwtB3mb1ySbl4fkBQS0n 2f8x6ibH9WQUaqxFZO5QsvwhbxnOyoOjIW/bgfzxvquqEMwkfoFcU504MxnD1xaLRjFG JaiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=dEfLuSPH6KhZZ1U4CdzxbvJWglpkxvIUaVZ0D5a3+xQ=; b=QAfaRO/e6/s54/RgnqQd6ZSm/cpMf5ghq4xBogx4pZ/BstPsO1HwvpV4KvsWhHvM5n DU5Luo5jRQS1MA+ofD9ODI/EWS/endgK+Nqgit+vGu5YDxjzU71G3krTwZwUO0Kdl4vm zA0vBjApSlBl4ic/6rvVZ9GzZBOiXoRWt0A8e5owOs5DSFSOp1M28JvIDxMUlEFrM3wz 0LsgmKuswJdqm5uW3LSeiAzZX6LoT2/sHblotb3KgPNp31fWy1XCLkPdmYagYSiRrF3I 4OHiuEpR9I4o6HPXeALM5lwVRHM+vp0JuYkbco28NoAF+m6id+fwsASHTOtMKVI1WOGT +ZmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz13si17616430ejc.525.2021.06.29.13.10.45; Tue, 29 Jun 2021 13:11:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233487AbhF2TbG (ORCPT + 99 others); Tue, 29 Jun 2021 15:31:06 -0400 Received: from mail-lj1-f170.google.com ([209.85.208.170]:43958 "EHLO mail-lj1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232116AbhF2TbG (ORCPT ); Tue, 29 Jun 2021 15:31:06 -0400 Received: by mail-lj1-f170.google.com with SMTP id f13so32557375ljp.10; Tue, 29 Jun 2021 12:28:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dEfLuSPH6KhZZ1U4CdzxbvJWglpkxvIUaVZ0D5a3+xQ=; b=EGBvOWrK9VuJ+dX74B03ovdvGyMc/PJcAaDVy8QFCANonbV5C/rd1w3AEPj3qess8X YnDhi2ZKrFfip0a4OWD+Wy6uhbtnAcU3Ol7ZGLpOZzh9GA3MBZqN0cF6ahFgmR1WBTCi 0AJNbNszTBPn99hAa5bIQSHVRIRSW8tphulYLhZuXh8Y4LKLPy+ea1FqS7UiuExmFPqU hPpCxlTbEu5bbqvWw9bf7+WfPWx/rw+TX/5nofvDLqkCFO2XtcUVk83YdhpsHnEn8c72 bmQmrdvGrWOLd5d/bdzSL68VkBAyQLE+ys50dR9TnGH5492RFmLYU0dJLwJgYRbYcNsR /vKg== X-Gm-Message-State: AOAM532J9kO03kSXfoSbfcbn9OrW+0Bbxlmg0X/6Sl9jvYpHB0RX0aDZ jmjeWIRigwHLo/u5qtJlCgvUHSjESbifLfw/stk= X-Received: by 2002:a2e:5c03:: with SMTP id q3mr4886886ljb.233.1624994916195; Tue, 29 Jun 2021 12:28:36 -0700 (PDT) MIME-Version: 1.0 References: <20210627131818.810-1-adrian.hunter@intel.com> In-Reply-To: <20210627131818.810-1-adrian.hunter@intel.com> From: Namhyung Kim Date: Tue, 29 Jun 2021 12:28:24 -0700 Message-ID: Subject: Re: [PATCH V2 00/10] perf script: Add API for filtering via dynamically loaded shared object To: Adrian Hunter Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Andi Kleen , Peter Zijlstra , Ingo Molnar , Mark Rutland , Leo Yan , Kan Liang , linux-perf-users , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Adrian, On Sun, Jun 27, 2021 at 6:18 AM Adrian Hunter wrote: > > Hi > > In some cases, users want to filter very large amounts of data (e.g. from > AUX area tracing like Intel PT) looking for something specific. While > scripting such as Python can be used, Python is 10 to 20 times slower than > C. So define a C API so that custom filters can be written and loaded. Thanks for your work! I guess we can use this for perf report (and others) to have a custom filter too. Thanks, Namhyung > > This is V2. > > The main patch is patch 1. > > The other patches add more functionality, except for patch 5 which installs > the C API header file. > > > Changes in V2: > perf script: Move filter_cpu() earlier > perf script: Move filtering before scripting > perf script: Share addr_al between functions > Dropped because they have now been applied. > > perf script: Add API for filtering via dynamically loaded shared object > Move 2 members of struct perf_dlfilter_sample > Add 'ctx' as an argument to 'start' and 'stop' > Find dlfilter .so files in current directory or exec-path/dlfilters > > perf script: Add option to list dlfilters > New patch > > perf script: Add option to pass arguments to dlfilters > New patch > > > Adrian Hunter (10): > perf script: Add API for filtering via dynamically loaded shared object > perf script: Add dlfilter__filter_event_early() > perf script: Add option to list dlfilters > perf script: Add option to pass arguments to dlfilters > perf build: Install perf_dlfilter.h > perf dlfilter: Add resolve_address() to perf_dlfilter_fns > perf dlfilter: Add insn() to perf_dlfilter_fns > perf dlfilter: Add srcline() to perf_dlfilter_fns > perf dlfilter: Add attr() to perf_dlfilter_fns > perf dlfilter: Add object_code() to perf_dlfilter_fns > > tools/perf/Documentation/perf-dlfilter.txt | 251 ++++++++++++ > tools/perf/Documentation/perf-script.txt | 15 +- > tools/perf/Makefile.config | 3 + > tools/perf/Makefile.perf | 4 +- > tools/perf/builtin-script.c | 86 +++- > tools/perf/util/Build | 1 + > tools/perf/util/dlfilter.c | 615 +++++++++++++++++++++++++++++ > tools/perf/util/dlfilter.h | 97 +++++ > tools/perf/util/perf_dlfilter.h | 150 +++++++ > 9 files changed, 1211 insertions(+), 11 deletions(-) > create mode 100644 tools/perf/Documentation/perf-dlfilter.txt > create mode 100644 tools/perf/util/dlfilter.c > create mode 100644 tools/perf/util/dlfilter.h > create mode 100644 tools/perf/util/perf_dlfilter.h > > > Regards > Adrian