From: Namhyung Kim <namhyung@kernel.org>
To: Howard Chu <howardchu95@gmail.com>
Cc: irogers@google.com, acme@kernel.org, adrian.hunter@intel.com,
jolsa@kernel.org, kan.liang@linux.intel.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 8/9] perf header: Add field 'embed'
Date: Wed, 7 Aug 2024 16:52:55 -0700 [thread overview]
Message-ID: <ZrQI1w1B3hnWbd6j@google.com> (raw)
In-Reply-To: <20240807153843.3231451-9-howardchu95@gmail.com>
On Wed, Aug 07, 2024 at 11:38:42PM +0800, Howard Chu wrote:
> We have to save the embedded data's sample type for it to be consumed
> correctly by perf script or perf report.
>
> This will approach most definitely break some perf.data convertor.
>
> Signed-off-by: Howard Chu <howardchu95@gmail.com>
> ---
> tools/perf/util/header.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 55e9553861d0..d60e77d5c25c 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -80,6 +80,7 @@ const char perf_version_string[] = PERF_VERSION;
>
> struct perf_file_attr {
> struct perf_event_attr attr;
> + __u64 embed;
Can we just set bpf_output.attr correctly and get rid of this?
Thanks,
Namhyung
> struct perf_file_section ids;
> };
>
> @@ -3713,6 +3714,7 @@ static int perf_session__do_write_header(struct perf_session *session,
> }
> f_attr = (struct perf_file_attr){
> .attr = evsel->core.attr,
> + .embed = evsel->sample_type_embed,
> .ids = {
> .offset = evsel->id_offset,
> .size = evsel->core.ids * sizeof(u64),
> @@ -4147,6 +4149,14 @@ static int read_attr(int fd, struct perf_header *ph,
>
> ret = readn(fd, ptr, left);
> }
> +
> + ret = readn(fd, &f_attr->embed, sizeof(f_attr->embed));
> + if (ret <= 0) {
> + pr_debug("failed to read %d bytes of embedded sample type\n",
> + (int)sizeof(f_attr->embed));
> + return -1;
> + }
> +
> /* read perf_file_section, ids are read in caller */
> ret = readn(fd, &f_attr->ids, sizeof(f_attr->ids));
>
> @@ -4272,6 +4282,8 @@ int perf_session__read_header(struct perf_session *session, int repipe_fd)
> tmp = lseek(fd, 0, SEEK_CUR);
> evsel = evsel__new(&f_attr.attr);
>
> + evsel->sample_type_embed = f_attr.embed;
> +
> if (evsel == NULL)
> goto out_delete_evlist;
>
> --
> 2.45.2
>
next prev parent reply other threads:[~2024-08-07 23:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 15:38 [PATCH v4 0/9] perf record --off-cpu: Dump off-cpu samples directly Howard Chu
2024-08-07 15:38 ` [PATCH v4 1/9] perf evsel: Set BPF output to system-wide Howard Chu
2024-08-07 23:21 ` Namhyung Kim
2024-08-08 3:58 ` Howard Chu
2024-09-25 2:53 ` Ian Rogers
2024-09-25 7:07 ` Howard Chu
2024-08-07 15:38 ` [PATCH v4 2/9] perf record --off-cpu: Add --off-cpu-thresh Howard Chu
2024-08-07 23:22 ` Namhyung Kim
2024-08-08 4:01 ` Howard Chu
2024-08-07 15:38 ` [PATCH v4 3/9] perf record --off-cpu: Parse offcpu-time event Howard Chu
2024-08-07 23:25 ` Namhyung Kim
2024-08-08 8:52 ` Howard Chu
2024-08-07 15:38 ` [PATCH v4 4/9] perf record off-cpu: Dump direct off-cpu samples in BPF Howard Chu
2024-08-07 23:49 ` Namhyung Kim
2024-08-08 11:57 ` Howard Chu
2024-08-07 15:38 ` [PATCH v4 5/9] perf record --off-cpu: Dump total off-cpu time at the end Howard Chu
2024-08-07 15:38 ` [PATCH v4 6/9] perf evsel: Delete unnecessary = 0 Howard Chu
2024-08-07 15:38 ` [PATCH v4 7/9] perf record --off-cpu: Parse BPF output embedded data Howard Chu
2024-08-07 15:38 ` [PATCH v4 8/9] perf header: Add field 'embed' Howard Chu
2024-08-07 23:52 ` Namhyung Kim [this message]
2024-08-08 13:57 ` Howard Chu
2024-08-07 15:38 ` [PATCH v4 9/9] perf test: Add direct off-cpu dumping test Howard Chu
2024-09-25 3:04 ` [PATCH v4 0/9] perf record --off-cpu: Dump off-cpu samples directly Ian Rogers
2024-09-25 6:59 ` 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=ZrQI1w1B3hnWbd6j@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=howardchu95@gmail.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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.