linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Howard Chu <howardchu95@gmail.com>
To: acme@kernel.org
Cc: namhyung@kernel.org, irogers@google.com, jolsa@kernel.org,
	adrian.hunter@intel.com, kan.liang@linux.intel.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Howard Chu <howardchu95@gmail.com>
Subject: [PATCH v1 0/2] perf trace: Better -p support
Date: Tue, 27 Aug 2024 17:20:11 +0800	[thread overview]
Message-ID: <20240827092013.1596-1-howardchu95@gmail.com> (raw)

Currently we don't support only collecting data for certain pids in perf
trace. We either collect nothing or everything.

Another thing is when using -p, becausing it's a per-pid mmap,
bpf_perf_event_output will fail under current per-cpu only
configuration. But since I fixed the -p problem already in the perf
trace augmentation v3 patch series, this method will be an optimization
instead of an actually bug fix.

!! Note that this patch series should be applied on top of the perf
trace v3 patch series.

Before:
perf $ perf trace -e open -p 79768
         ? (         ):  ... [continued]: open())                                             = -1 ENOENT (No such file or directory)
         ? (         ):  ... [continued]: open())                                             = -1 ENOENT (No such file or directory)
         ? (         ):  ... [continued]: open())                                             = -1 ENOENT (No such file or directory)

After:
perf $ ./perf trace -e open -p 79768
     0.000 ( 0.019 ms): open(filename: "DINGZHEN", flags: WRONLY)                             = -1 ENOENT (No such file or directory)
  1000.187 ( 0.031 ms): open(filename: "DINGZHEN", flags: WRONLY)                             = -1 ENOENT (No such file or directory)
  2000.377 ( 0.019 ms): open(filename: "DINGZHEN", flags: WRONLY)                             = -1 ENOENT (No such file or directory)

Howard Chu (2):
  perf trace: Collect data only for certain pids
  perf trace: Use pid to index perf_event in BPF

 tools/perf/builtin-trace.c                    | 100 ++++++++++++++++--
 .../bpf_skel/augmented_raw_syscalls.bpf.c     |  54 ++++++++--
 tools/perf/util/evlist.c                      |   2 +-
 3 files changed, 135 insertions(+), 21 deletions(-)

-- 
2.46.0


             reply	other threads:[~2024-08-27  9:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  9:20 Howard Chu [this message]
2024-08-27  9:20 ` [PATCH v1 1/2] perf trace: Collect data only for certain pids Howard Chu
2024-08-27  9:20 ` [PATCH v1 2/2] perf trace: Use pid to index perf_event in BPF Howard Chu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240827092013.1596-1-howardchu95@gmail.com \
    --to=howardchu95@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).