From: Namhyung Kim <namhyung@kernel.org>
To: Steve Clevenger <scclevenger@os.amperecomputing.com>
Cc: leo.yan@arm.com, james.clark@linaro.org, mike.leach@linaro.org,
suzuki.poulose@arm.com, ilkka@os.amperecomputing.com,
coresight@lists.linaro.org, linux-perf-users@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH V10 RESEND 1/2] perf util scripting-engines cs-etm: Add map_pgoff to python dictionary
Date: Thu, 7 Nov 2024 10:51:41 -0800 [thread overview]
Message-ID: <Zy0MPdvV5ofHtyE3@google.com> (raw)
In-Reply-To: <20241106235110.5NbhrBJjBk6qY_Sg0BJUbMXfpfpi8KZK5R-y4rZfKXI@z>
On Wed, Nov 06, 2024 at 04:51:10PM -0700, Steve Clevenger wrote:
> Add map_pgoff parameter to python dictionary so it can be seen by the
> python script.
>
> Signed-off-by: Steve Clevenger <scclevenger@os.amperecomputing.com>
> Reviewed-by: Leo Yan <leo.yan@arm.com>
> ---
> tools/perf/util/scripting-engines/trace-event-python.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
> index d7183134b669..367132b3a51a 100644
> --- a/tools/perf/util/scripting-engines/trace-event-python.c
> +++ b/tools/perf/util/scripting-engines/trace-event-python.c
> @@ -793,7 +793,8 @@ static int set_regs_in_dict(PyObject *dict,
> static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
> const char *dso_field, const char *dso_bid_field,
> const char *dso_map_start, const char *dso_map_end,
> - const char *sym_field, const char *symoff_field)
> + const char *sym_field, const char *symoff_field,
> + const char *map_pgoff)
> {
> char sbuild_id[SBUILD_ID_SIZE];
>
> @@ -809,6 +810,8 @@ static void set_sym_in_dict(PyObject *dict, struct addr_location *al,
> PyLong_FromUnsignedLong(map__start(al->map)));
> pydict_set_item_string_decref(dict, dso_map_end,
> PyLong_FromUnsignedLong(map__end(al->map)));
> + pydict_set_item_string_decref(dict, map_pgoff,
> + PyLong_FromUnsignedLongLong(al->map->pgoff));
Please use map__pgoff(al->map) instead. Otherwise you'll get this in
the debug build:
util/scripting-engines/trace-event-python.c: In function 'set_sym_in_dict':
util/scripting-engines/trace-event-python.c:814:60: error: 'struct map' has no member named 'pgoff'
814 | PyLong_FromUnsignedLongLong(al->map->pgoff));
| ^~
Thanks,
Namhyung
> }
> if (al->sym) {
> pydict_set_item_string_decref(dict, sym_field,
> @@ -895,7 +898,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
> pydict_set_item_string_decref(dict, "comm",
> _PyUnicode_FromString(thread__comm_str(al->thread)));
> set_sym_in_dict(dict, al, "dso", "dso_bid", "dso_map_start", "dso_map_end",
> - "symbol", "symoff");
> + "symbol", "symoff", "map_pgoff");
>
> pydict_set_item_string_decref(dict, "callchain", callchain);
>
> @@ -920,7 +923,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
> PyBool_FromLong(1));
> set_sym_in_dict(dict_sample, addr_al, "addr_dso", "addr_dso_bid",
> "addr_dso_map_start", "addr_dso_map_end",
> - "addr_symbol", "addr_symoff");
> + "addr_symbol", "addr_symoff", "addr_map_pgoff");
> }
>
> if (sample->flags)
> --
> 2.44.0
>
next prev parent reply other threads:[~2024-11-07 18:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 17:17 [PATCH V9 0/2] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Steve Clevenger
2024-10-11 17:17 ` [PATCH V9 2/2] Adjust objdump start/end range per map pgoff parameter Steve Clevenger
2024-10-17 11:01 ` Leo Yan
2024-10-17 18:28 ` Namhyung Kim
2024-10-17 21:56 ` Leo Yan
2024-11-06 23:51 ` [PATCH V10 RESEND 2/2] perf script python: " Steve Clevenger
2024-10-11 17:17 ` [PATCH V9 1/2] Add map_pgoff to python dictionary Steve Clevenger
2024-10-17 10:43 ` Leo Yan
2024-10-17 11:03 ` Leo Yan
2024-11-06 23:51 ` [PATCH V10 RESEND 1/2] perf util scripting-engines cs-etm: " Steve Clevenger
2024-11-07 18:51 ` Namhyung Kim [this message]
2024-11-08 17:48 ` Steve Clevenger
2024-11-11 19:51 ` Ian Rogers
2024-10-16 17:51 ` [PATCH V9 0/2] arm-cs-trace-disasm.py/perf must accommodate non-zero DSO text offset Namhyung Kim
2024-10-16 18:36 ` Steve Clevenger
2024-11-06 23:51 ` [PATCH V10 RESEND " Steve Clevenger
2024-11-07 14:40 ` Leo Yan
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=Zy0MPdvV5ofHtyE3@google.com \
--to=namhyung@kernel.org \
--cc=coresight@lists.linaro.org \
--cc=ilkka@os.amperecomputing.com \
--cc=james.clark@linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=scclevenger@os.amperecomputing.com \
--cc=suzuki.poulose@arm.com \
/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).