Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2703306pxv; Sun, 27 Jun 2021 06:18:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHWtMfZQpClidgvr+E73IFhkTFm8zeId3fS60UajxaT7vY5IRMEEr8dH52pTCMXCtgTjTG X-Received: by 2002:a02:cb82:: with SMTP id u2mr18571868jap.8.1624799931367; Sun, 27 Jun 2021 06:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624799931; cv=none; d=google.com; s=arc-20160816; b=L+U2zqDaXrVvPMro+AdodD8BuWNsgO34JCPhphh+fK1vJWFJ8tLoNIKdMKS7Cnmwym S/0sfN1MpIhuFtjS7gwOcontx4iiAFuCtrWXGLyx8yo9hyU9T+RTlPp1T7gXbfsPwA1E OfESArYn514tJZWZ6lWNwuhPmA74sLtKOEwdZ+qbB/FdJLIOgDTeSaJ2wE+e2/pP2Bcw sBGizQZamo13T6dqqlr0Z+i4erMKvzmdGLj5og8OUStdOujCF5uoHnzAWURm9G25Mr3O FktcTyLeAAGDgJKi4IcYgmhp8dFCCRAZY7QCHaCxr1eyhVuCpsSQJJ+le48GAVLwmNDY jgRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:message-id:date:subject:cc:to:from; bh=64vktpGWoZWTBK2qP0XcjwrlG+0YeexhxnkA+cLpqWc=; b=ewk5evUJEikR52EOAcNl9QOSHtxDXBx7BvGfs9sITv3sUq77q7/nMUY0Yc5fBWx+XT b2SYF9EGbYPtZM2mrFp77ndi0GBJ2iM+8wcZOHHo9lMo3bvQpFMuVAmZJiMqsnWAFZdM r3Rr4UF9/tHAnecdWo3Y071Q8V6SkWPH+XwBmnZZJIcG7emdr6QBqGvKZm/cRDIDGuak GiRulJTyQP+iJi9WNZlpYshvUoqdSlqyCE5wCN8eElj5W9RS1eUH/zporGVZQDAQF6ot kAT48yY6zxbxpGWs89ve6tc1aZMl/sO5bjmUCRe8l4mW/SH9MV5NfagJKEeSpSxQY2ku baKw== 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si5694349ilq.110.2021.06.27.06.18.39; Sun, 27 Jun 2021 06:18:51 -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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230236AbhF0NU0 (ORCPT + 99 others); Sun, 27 Jun 2021 09:20:26 -0400 Received: from mga18.intel.com ([134.134.136.126]:60751 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbhF0NU0 (ORCPT ); Sun, 27 Jun 2021 09:20:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10027"; a="195137035" X-IronPort-AV: E=Sophos;i="5.83,302,1616482800"; d="scan'208";a="195137035" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2021 06:18:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,302,1616482800"; d="scan'208";a="640588983" Received: from ahunter-desktop.fi.intel.com ([10.237.72.79]) by fmsmga006.fm.intel.com with ESMTP; 27 Jun 2021 06:17:58 -0700 From: Adrian Hunter To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Andi Kleen , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Leo Yan , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 00/10] perf script: Add API for filtering via dynamically loaded shared object Date: Sun, 27 Jun 2021 16:18:08 +0300 Message-Id: <20210627131818.810-1-adrian.hunter@intel.com> X-Mailer: git-send-email 2.17.1 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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