Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 1/2] perf python: New treport script
Date: Sun, 09 Aug 2026 04:29:57 +0000	[thread overview]
Message-ID: <20260809042958.0651E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260809041638.2402705-2-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The script relies on missing `perf` Python C extension APIs, causing immediate crashes on import or execution.
- [Low] The argparse description inaccurately claims the script creates flame graphs.
- [Low] Typo in the source code comments ('profle' instead of 'profile').
--

--- Patch [1]: [PATCH v3 1/2] perf python: New treport script ---
commit d9d175087e8fce3c5649b6249af90e23002fff56
Author: Alice Rogers <alice.mei.rogers@gmail.com>

perf python: New treport script

This commit adds a new treport.py script that uses the textual framework to
display an interactive tree report of processed perf samples.

> diff --git a/tools/perf/python/treport.py b/tools/perf/python/treport.py
> new file mode 100755
> index 0000000000000..528a640e4d356
> --- /dev/null
> +++ b/tools/perf/python/treport.py
[ ... ]
> +from textual.widgets import Footer, Header, TabbedContent, TabPane, Tree
> +from textual.widgets.tree import TreeNode
> +
> +# Global session.
> +session :Optional[perf.session] = None
> +

[Severity: High]
Are there prerequisite patches missing from this series? The perf Python C
extension does not currently expose perf.session. Because this type annotation
is evaluated at module load time, running the script results in an immediate
AttributeError.

[ ... ]
> +        node.value += period
> +
> +        if sample.callchain:
> +            for entry in reversed(sample.callchain):
> +                name = entry.symbol
> +                if not name or name == "[unknown]":

[Severity: High]
Does the Python sample_event object expose callchain and symbol? It appears
these attributes are also missing from the current Python C extension, which
would cause this to crash when processing samples.

[ ... ]
> +class ProfileBuilder:
> +    """Constructs a profile tree from a stream of events."""
> +    def __init__(self):
> +        self.root = ProfileNode("root", parent=None)
> +
> +    def process_event(self, sample) -> None:
> +        """Called by session.process_events to update the profile tree."""
> +        ev_name = str(sample.evsel)[6:-1]

[Severity: High]
Does the sample object expose evsel? Similar to the other missing attributes,
this seems to rely on Python C extension features that are not yet present in
the tree.

[ ... ]
> +if __name__ == "__main__":
> +    parser = argparse.ArgumentParser(description="Create flame graphs using perf python module.")
> +    parser.add_argument("-i", "--input", help="input perf.data file")

[Severity: Low]
This isn't a bug, but the description says "Create flame graphs" instead
of describing the interactive tree report this script actually generates.
Is this a copy-paste error from another script?

[ ... ]
> +    except Exception as e:
> +        print(f"Error opening session: {e}", file=sys.stderr)
> +        sys.exit(1)
> +
> +    # profle.process_event is called for each perf event to build the profile.
> +    session.process_events()

[Severity: Low]
This isn't a bug, but there is a typo (profle) in this comment.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260809041638.2402705-1-irogers@google.com?part=1

  reply	other threads:[~2026-08-09  4:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25  8:24 [PATCH v1 1/2] perf script: New treport script Ian Rogers
2025-07-25  8:24 ` [PATCH v1 2/2] perf script: treport add flamegraph support Ian Rogers
2025-07-25  8:38   ` Ian Rogers
2026-08-08  6:57     ` [PATCH v2 0/2] perf python TUI report and flamegraph Ian Rogers
2026-08-08  6:57       ` [PATCH v2 1/2] perf python: New treport script Ian Rogers
2026-08-08  7:13         ` sashiko-bot
2026-08-08  6:57       ` [PATCH v2 2/2] perf python: treport add flamegraph support Ian Rogers
2026-08-09  4:16       ` [PATCH v3 0/2] perf python TUI report and flamegraph Ian Rogers
2026-08-09  4:16         ` [PATCH v3 1/2] perf python: New treport script Ian Rogers
2026-08-09  4:29           ` sashiko-bot [this message]
2026-08-09  4:16         ` [PATCH v3] perf test: Fixes for check branch stack sampling Ian Rogers
2026-08-09  5:21           ` Ian Rogers
2026-08-09  4:16         ` [PATCH v3 2/2] perf python: treport add flamegraph support Ian Rogers
2026-08-09  4:36           ` sashiko-bot
2026-08-09  5:18         ` [PATCH v4 0/2] perf python TUI report and flamegraph Ian Rogers
2026-08-09  5:18           ` [PATCH v4 1/2] perf python: New treport script Ian Rogers
2026-08-09  5:18           ` [PATCH v4 2/2] perf python: treport add flamegraph support Ian Rogers
2025-07-26  6:43   ` [PATCH v1 2/2] perf script: " Namhyung Kim
2025-07-26  6:39 ` [PATCH v1 1/2] perf script: New treport script Namhyung Kim

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=20260809042958.0651E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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