[build] cmd/resultdbpprof: add tool to get a test execution profile

1 view
Skip to first unread message

Michael Knyszek (Gerrit)

unread,
Dec 15, 2025, 4:06:47 PM (22 hours ago) Dec 15
to goph...@pubsubhelper.golang.org, Dmitri Shuralyov, golang-co...@googlegroups.com
Attention needed from Dmitri Shuralyov

Michael Knyszek voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Dmitri Shuralyov
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: build
Gerrit-Branch: master
Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
Gerrit-Change-Number: 730168
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Comment-Date: Mon, 15 Dec 2025 21:06:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Michael Knyszek (Gerrit)

unread,
Dec 15, 2025, 4:07:07 PM (22 hours ago) Dec 15
to goph...@pubsubhelper.golang.org, Go LUCI, Dmitri Shuralyov, golang-co...@googlegroups.com
Attention needed from Dmitri Shuralyov

Michael Knyszek added 1 comment

File go.mod
Line 3, Patchset 1 (Latest):go 1.24.9
Michael Knyszek . unresolved

I'm not sure if this is OK. if it isn't, I can find an older version of pprof to depend on.

Open in Gerrit

Related details

Attention is currently required from:
  • Dmitri Shuralyov
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: build
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
    Gerrit-Change-Number: 730168
    Gerrit-PatchSet: 1
    Gerrit-Owner: Michael Knyszek <mkny...@google.com>
    Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
    Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Comment-Date: Mon, 15 Dec 2025 21:07:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Michael Knyszek (Gerrit)

    unread,
    Dec 15, 2025, 5:00:08 PM (22 hours ago) Dec 15
    to goph...@pubsubhelper.golang.org, Go LUCI, Dmitri Shuralyov, golang-co...@googlegroups.com
    Attention needed from Dmitri Shuralyov

    Michael Knyszek voted Commit-Queue+1

    Commit-Queue+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dmitri Shuralyov
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: build
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
    Gerrit-Change-Number: 730168
    Gerrit-PatchSet: 2
    Gerrit-Owner: Michael Knyszek <mkny...@google.com>
    Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
    Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Comment-Date: Mon, 15 Dec 2025 22:00:04 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    open
    diffy

    Dmitri Shuralyov (Gerrit)

    unread,
    Dec 15, 2025, 5:08:13 PM (21 hours ago) Dec 15
    to Michael Knyszek, goph...@pubsubhelper.golang.org, Dmitri Shuralyov, Go LUCI, golang-co...@googlegroups.com
    Attention needed from Michael Knyszek

    Dmitri Shuralyov voted and added 6 comments

    Votes added by Dmitri Shuralyov

    Code-Review+2

    6 comments

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Dmitri Shuralyov . resolved

    Thanks.

    File cmd/resultdbpprof/main.go
    Line 5, Patchset 1:package main
    Dmitri Shuralyov . resolved

    Consider adding a package comment for the command. Brief is fine. (Compare with https://golang.org/x/build/cmd.)

    Edit: You've already resolved this in PS 2. :)

    Line 23, Patchset 1:
    Dmitri Shuralyov . resolved

    (nit) In x/build it's generally fine to have only 2 sections of imports: std lib and everything else. It is also fine to have it if this extra separation helps (or if it's simply not worth the extra iteration to drop).

    Line 43, Patchset 1: flag.Usage()
    Dmitri Shuralyov . unresolved

    It's generally a nicer experience for users if we put usage information in flag.Usage too, so someone running the command with -help first would see it. See [an example](https://cs.opensource.google/go/x/build/+/master:cmd/genbootstrap/genbootstrap.go;l=52-63;drc=f142e550d08c506a75fdf65bb032731f0234675e) of what I mean.

    Line 46, Patchset 1: buildID, err := strconv.ParseInt(flag.Arg(0), 10, 64)
    Dmitri Shuralyov . unresolved

    Looks like a missed err != nil check here.

    File go.mod
    Line 3, Patchset 1:go 1.24.9
    Michael Knyszek . resolved

    I'm not sure if this is OK. if it isn't, I can find an older version of pprof to depend on.

    Dmitri Shuralyov

    We should keep it at 1.24 major version and not something higher (like 1.25) until 1.26.0 is out and 1.24 stops being supported by our policy. From that perspective, 1.24.9 is okay (i.e., it doesn't make it impossible to still use 1.24 for anyone still on it). Also, it seems the pprof dependency needed to require at least 1.24.9 because of a valid problem in 1.24.8 and older (https://github.com/google/pprof/pull/975), so this isn't a case of it being accidentally bumped without much of a reason.

    So this should be okay. (It will propagate to x/website during a future auto-updating+tagging, which is expected and also okay.)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Knyszek
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: build
    Gerrit-Branch: master
    Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
    Gerrit-Change-Number: 730168
    Gerrit-PatchSet: 2
    Gerrit-Owner: Michael Knyszek <mkny...@google.com>
    Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
    Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
    Gerrit-Attention: Michael Knyszek <mkny...@google.com>
    Gerrit-Comment-Date: Mon, 15 Dec 2025 22:08:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Michael Knyszek <mkny...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dmitri Shuralyov (Gerrit)

    unread,
    Dec 15, 2025, 5:09:27 PM (21 hours ago) Dec 15
    to Michael Knyszek, goph...@pubsubhelper.golang.org, Dmitri Shuralyov, Go LUCI, golang-co...@googlegroups.com
    Attention needed from Michael Knyszek

    Dmitri Shuralyov voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Knyszek
    Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: build
      Gerrit-Branch: master
      Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
      Gerrit-Change-Number: 730168
      Gerrit-PatchSet: 2
      Gerrit-Owner: Michael Knyszek <mkny...@google.com>
      Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
      Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
      Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
      Gerrit-Attention: Michael Knyszek <mkny...@google.com>
      Gerrit-Comment-Date: Mon, 15 Dec 2025 22:09:22 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Michael Knyszek (Gerrit)

      unread,
      Dec 15, 2025, 5:31:50 PM (21 hours ago) Dec 15
      to goph...@pubsubhelper.golang.org, Go LUCI, Dmitri Shuralyov, Dmitri Shuralyov, golang-co...@googlegroups.com
      Attention needed from Dmitri Shuralyov

      Michael Knyszek added 1 comment

      File cmd/resultdbpprof/main.go
      Dmitri Shuralyov . unresolved

      It's generally a nicer experience for users if we put usage information in flag.Usage too, so someone running the command with -help first would see it. See [an example](https://cs.opensource.google/go/x/build/+/master:cmd/genbootstrap/genbootstrap.go;l=52-63;drc=f142e550d08c506a75fdf65bb032731f0234675e) of what I mean.

      Michael Knyszek

      oops, yes, totally agree. I knew I forgot something...

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dmitri Shuralyov
      Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: build
        Gerrit-Branch: master
        Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
        Gerrit-Change-Number: 730168
        Gerrit-PatchSet: 2
        Gerrit-Owner: Michael Knyszek <mkny...@google.com>
        Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
        Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
        Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
        Gerrit-Attention: Dmitri Shuralyov <dmit...@golang.org>
        Gerrit-Comment-Date: Mon, 15 Dec 2025 22:31:47 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Dmitri Shuralyov <dmit...@golang.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Michael Knyszek (Gerrit)

        unread,
        Dec 15, 2025, 10:51:09 PM (16 hours ago) Dec 15
        to goph...@pubsubhelper.golang.org, Go LUCI, Dmitri Shuralyov, Dmitri Shuralyov, golang-co...@googlegroups.com

        Michael Knyszek voted and added 3 comments

        Votes added by Michael Knyszek

        Auto-Submit+1
        Commit-Queue+1

        3 comments

        File cmd/resultdbpprof/main.go
        Dmitri Shuralyov . resolved

        (nit) In x/build it's generally fine to have only 2 sections of imports: std lib and everything else. It is also fine to have it if this extra separation helps (or if it's simply not worth the extra iteration to drop).

        Michael Knyszek

        Done

        Dmitri Shuralyov . resolved

        It's generally a nicer experience for users if we put usage information in flag.Usage too, so someone running the command with -help first would see it. See [an example](https://cs.opensource.google/go/x/build/+/master:cmd/genbootstrap/genbootstrap.go;l=52-63;drc=f142e550d08c506a75fdf65bb032731f0234675e) of what I mean.

        Michael Knyszek

        oops, yes, totally agree. I knew I forgot something...

        Michael Knyszek

        Done

        Line 46, Patchset 1: buildID, err := strconv.ParseInt(flag.Arg(0), 10, 64)
        Dmitri Shuralyov . resolved

        Looks like a missed err != nil check here.

        Michael Knyszek

        Done

        Open in Gerrit

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: build
        Gerrit-Branch: master
        Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
        Gerrit-Change-Number: 730168
        Gerrit-PatchSet: 3
        Gerrit-Owner: Michael Knyszek <mkny...@google.com>
        Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
        Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
        Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
        Gerrit-Comment-Date: Tue, 16 Dec 2025 03:51:07 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Dmitri Shuralyov <dmit...@golang.org>
        Comment-In-Reply-To: Michael Knyszek <mkny...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Gopher Robot (Gerrit)

        unread,
        Dec 15, 2025, 11:31:51 PM (15 hours ago) Dec 15
        to Michael Knyszek, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Dmitri Shuralyov, Dmitri Shuralyov, golang-co...@googlegroups.com

        Gopher Robot submitted the change with unreviewed changes

        Unreviewed changes

        2 is the latest approved patch-set.
        The change was submitted with unreviewed changes in the following files:

        ```
        The name of the file: cmd/resultdbpprof/main.go
        Insertions: 26, Deletions: 4.

        @@ -42,14 +42,13 @@
        "time"

        "github.com/google/pprof/profile"
        - "golang.org/x/sync/errgroup"
        - "google.golang.org/protobuf/types/known/fieldmaskpb"
        -
        "go.chromium.org/luci/auth"
        bbpb "go.chromium.org/luci/buildbucket/proto"
        "go.chromium.org/luci/grpc/prpc"
        "go.chromium.org/luci/hardcoded/chromeinfra"
        rdbpb "go.chromium.org/luci/resultdb/proto/v1"
        + "golang.org/x/sync/errgroup"
        + "google.golang.org/protobuf/types/known/fieldmaskpb"
        )

        var (
        @@ -57,6 +56,24 @@
        public = flag.Bool("public", true, "whether the build is public or not")
        )

        +func init() {
        + flag.Usage = func() {
        + fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [flags] <build ID>\n", os.Args[0])
        + fmt.Fprintf(flag.CommandLine.Output(), "\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "Downloads test results for a LUCI build and generates a pprof\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "profile of their execution times. Useful for understanding test\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "execution times and identifying low hanging fruit to speed up CI.\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "Results are written to '<build ID>.prof' in the current working\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "directory.\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "This tool expects Go test names of the form 'pkg.TestX/Y/Z'.\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "Test names not matching this pattern may appear in the output in\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "an unexpected form.\n")
        + fmt.Fprintf(flag.CommandLine.Output(), "\n")
        + flag.PrintDefaults()
        + }
        +}
        +
        func main() {
        // Validate flags.
        flag.Parse()
        @@ -67,7 +84,12 @@
        flag.Usage()
        os.Exit(1)
        }
        - buildID, err := strconv.ParseInt(flag.Arg(0), 10, 64)
        + idArg := flag.Arg(0)
        + idArg, _ = strings.CutPrefix(idArg, "b") // Allow optional 'b' prefix for easier copy-pasting.
        + buildID, err := strconv.ParseInt(idArg, 10, 64)
        + if err != nil {
        + log.Fatalf("parsing build ID %s: %v", flag.Arg(0), err)
        + }

        // Create client.
        ctx := context.Background()
        ```

        Change information

        Commit message:
        cmd/resultdbpprof: add tool to get a test execution profile
        Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
        Reviewed-by: Dmitri Shuralyov <dmit...@golang.org>
        Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
        Auto-Submit: Michael Knyszek <mkny...@google.com>
        Files:
        • A cmd/resultdbpprof/main.go
        • M go.mod
        • M go.sum
        Change size: L
        Delta: 3 files changed, 310 insertions(+), 1 deletion(-)
        Branch: refs/heads/master
        Submit Requirements:
        • requirement satisfiedCode-Review: +1 by Dmitri Shuralyov, +2 by Dmitri Shuralyov
        • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
        Open in Gerrit
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: merged
        Gerrit-Project: build
        Gerrit-Branch: master
        Gerrit-Change-Id: Ia5e0a9265fab5b0f8ee3c5aca00c43df18cac6fe
        Gerrit-Change-Number: 730168
        Gerrit-PatchSet: 4
        Gerrit-Owner: Michael Knyszek <mkny...@google.com>
        Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
        Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
        open
        diffy
        satisfied_requirement
        Reply all
        Reply to author
        Forward
        0 new messages