From 6a4c33dd0bb25b51997b151e72fac6bb67d9ee83 Mon Sep 17 00:00:00 2001 From: Tommy Reilly Date: Thu, 28 May 2026 10:25:07 -0400 Subject: [PATCH 01/45] One more tweak to GPU profile types (#6366) --- .../shared/profile/src/ProfileTypeSelector/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/packages/shared/profile/src/ProfileTypeSelector/index.tsx b/ui/packages/shared/profile/src/ProfileTypeSelector/index.tsx index 3d21e0ce87e..1b5a18e3259 100644 --- a/ui/packages/shared/profile/src/ProfileTypeSelector/index.tsx +++ b/ui/packages/shared/profile/src/ProfileTypeSelector/index.tsx @@ -107,21 +107,23 @@ export const wellKnownProfiles: WellKnownProfiles = { name: 'Off-CPU', help: 'Time spent off the CPU as observed by the Parca Agent.', }, + // deprecated with PC sampling 'parca_agent:cuda:nanoseconds:cuda:nanoseconds:delta': { name: 'On-GPU', help: 'Time spent on the GPU.', }, + // use this for combined PC stall and kernel timing, not the default 'parca_agent:gpu_time:nanoseconds:gpu_time:nanoseconds:delta': { name: 'On-GPU', help: 'Time spent on the GPU. Combines kernel execution time and PC stall samples; the gpu_view label distinguishes the two views.', }, 'parca_agent:gpu_kernel_time:nanoseconds:gpu_kernel_time:nanoseconds:delta': { - name: 'On-GPU', + name: 'GPU Kernels', help: 'GPU kernel execution time measured via CUDA runtime callbacks.', }, - 'parca_agent:gpu_stall_time:nanoseconds:gpu_stall_time:nanoseconds:delta': { - name: 'GPU Stalls', - help: 'GPU stall time accumulated from PC sampling — shows where threads were waiting on the GPU.', + 'parca_agent:gpu_pcsample:count:gpu_pcsample:nanoseconds:delta': { + name: 'GPU Instructions', + help: 'PC samples from the GPU — all PC activity, not just stalls; shows the instruction/stall reason.', }, }; From 4e7c82b09126c960b99e90f179b4142c50b613c2 Mon Sep 17 00:00:00 2001 From: gnurizen Date: Thu, 28 May 2026 14:29:58 +0000 Subject: [PATCH 02/45] Publish - @parca/web@0.16.1045 - @parca/profile@0.19.154 --- ui/packages/app/web/CHANGELOG.md | 4 ++++ ui/packages/app/web/package.json | 2 +- ui/packages/shared/profile/CHANGELOG.md | 4 ++++ ui/packages/shared/profile/package.json | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/packages/app/web/CHANGELOG.md b/ui/packages/app/web/CHANGELOG.md index 76e02991778..ded7574e678 100644 --- a/ui/packages/app/web/CHANGELOG.md +++ b/ui/packages/app/web/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.16.1045](https://github.com/parca-dev/parca/compare/@parca/web@0.16.1044...@parca/web@0.16.1045) (2026-05-28) + +**Note:** Version bump only for package @parca/web + ## [0.16.1044](https://github.com/parca-dev/parca/compare/@parca/web@0.16.1043...@parca/web@0.16.1044) (2026-05-21) **Note:** Version bump only for package @parca/web diff --git a/ui/packages/app/web/package.json b/ui/packages/app/web/package.json index d85a7d6e40e..246020a76e3 100644 --- a/ui/packages/app/web/package.json +++ b/ui/packages/app/web/package.json @@ -1,7 +1,7 @@ { "name": "@parca/web", "private": true, - "version": "0.16.1044", + "version": "0.16.1045", "description": "Parca Web Interface", "type": "module", "scripts": { diff --git a/ui/packages/shared/profile/CHANGELOG.md b/ui/packages/shared/profile/CHANGELOG.md index 4cd28178302..d3f9b687c31 100644 --- a/ui/packages/shared/profile/CHANGELOG.md +++ b/ui/packages/shared/profile/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.19.154](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.153...@parca/profile@0.19.154) (2026-05-28) + +**Note:** Version bump only for package @parca/profile + ## [0.19.153](https://github.com/parca-dev/parca/compare/@parca/profile@0.19.152...@parca/profile@0.19.153) (2026-05-21) **Note:** Version bump only for package @parca/profile diff --git a/ui/packages/shared/profile/package.json b/ui/packages/shared/profile/package.json index 811f248f231..89ba072d020 100644 --- a/ui/packages/shared/profile/package.json +++ b/ui/packages/shared/profile/package.json @@ -1,6 +1,6 @@ { "name": "@parca/profile", - "version": "0.19.153", + "version": "0.19.154", "description": "Profile viewing libraries", "dependencies": { "@floating-ui/react": "^0.27.12", From cce673deb34ae93cdeeba37f5391c077e1a6e53c Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Tue, 9 Jun 2026 10:53:14 +0200 Subject: [PATCH 03/45] ci: upgrade pnpm to 11 (#6367) --- .github/workflows/build-test.yml | 8 +-- .github/workflows/chromatic.yml | 8 +-- .github/workflows/codeql-analysis-go.yml | 8 +-- .github/workflows/container.yml | 6 +-- .github/workflows/docs.yml | 8 +-- .github/workflows/go-lint.yml | 8 +-- .github/workflows/release-dry-run.yml | 6 +-- .github/workflows/release.yml | 6 +-- .github/workflows/snap.yml | 6 +-- .github/workflows/ui-publish-components.yml | 8 +-- .github/workflows/ui.yml | 8 +-- package.json | 2 +- ui/pnpm-workspace.yaml | 59 +++++++++++++++++++++ 13 files changed, 71 insertions(+), 70 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 02d5afb31ac..d15f4b10b94 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -17,10 +17,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: true -env: - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' - jobs: build-and-test: name: Test on ${{ matrix.arch }} @@ -60,9 +56,7 @@ jobs: with: go-version-file: .go-version - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js if: ${{ steps.skip-check.outputs.should_skip != 'true' }} diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 4c3a9314801..a6fa8320f31 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -21,10 +21,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: true -env: - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' - # List of jobs jobs: skip-check: @@ -61,9 +57,7 @@ jobs: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 with: fetch-depth: 0 # Required to retrieve git history - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: diff --git a/.github/workflows/codeql-analysis-go.yml b/.github/workflows/codeql-analysis-go.yml index 9a4b0a0ceaf..34ceb3106e0 100644 --- a/.github/workflows/codeql-analysis-go.yml +++ b/.github/workflows/codeql-analysis-go.yml @@ -19,10 +19,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: true -env: - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' - jobs: skip-check: name: Skip check @@ -73,9 +69,7 @@ jobs: with: go-version-file: .go-version - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml index 409eb1ed57e..5819b9acbc9 100644 --- a/.github/workflows/container.yml +++ b/.github/workflows/container.yml @@ -20,8 +20,6 @@ concurrency: env: # renovate: datasource=go depName=github.com/goreleaser/goreleaser GORELEASER_VERSION: v1.26.2 - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' jobs: skip-check: @@ -76,9 +74,7 @@ jobs: with: go-version-file: .go-version - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 98913f815a1..0f6e1a4154b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,10 +17,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: true -env: - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' - jobs: skip-check: name: Skip check @@ -62,9 +58,7 @@ jobs: with: go-version-file: .go-version - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml index a00a485b62f..47bba7d0c7b 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -18,10 +18,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: true -env: - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' - jobs: skip-check: name: Skip check @@ -67,9 +63,7 @@ jobs: run: | ./env.sh - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml index ba8dd5e4aef..4841ec040fc 100644 --- a/.github/workflows/release-dry-run.yml +++ b/.github/workflows/release-dry-run.yml @@ -20,8 +20,6 @@ concurrency: env: # renovate: datasource=go depName=github.com/goreleaser/goreleaser GORELEASER_VERSION: v1.26.2 - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' permissions: contents: write @@ -83,9 +81,7 @@ jobs: with: go-version-file: .go-version - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96f9eaeea98..141c402165e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,8 +12,6 @@ concurrency: env: # renovate: datasource=go depName=github.com/goreleaser/goreleaser GORELEASER_VERSION: v1.26.2 - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' permissions: contents: write @@ -39,9 +37,7 @@ jobs: with: go-version-file: .go-version - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml index 2ade77ce6c4..f01110f9619 100644 --- a/.github/workflows/snap.yml +++ b/.github/workflows/snap.yml @@ -20,8 +20,6 @@ concurrency: env: # renovate: datasource=go depName=github.com/goreleaser/goreleaser GORELEASER_VERSION: v1.26.2 - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' permissions: contents: write @@ -86,9 +84,7 @@ jobs: check-latest: true cache: true - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/.github/workflows/ui-publish-components.yml b/.github/workflows/ui-publish-components.yml index 486d2bd4d76..93bd055f111 100644 --- a/.github/workflows/ui-publish-components.yml +++ b/.github/workflows/ui-publish-components.yml @@ -9,10 +9,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: false -env: - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' - jobs: skip-check: name: Skip check @@ -59,9 +55,7 @@ jobs: git fetch origin +refs/heads/main:refs/remotes/origin/main && \ git checkout main - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml index 88fd45b3e29..3f47fd600fc 100644 --- a/.github/workflows/ui.yml +++ b/.github/workflows/ui.yml @@ -17,10 +17,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: true -env: - # renovate: datasource=npm depName=pnpm versioning=npm - PNPM_VERSION: '10.33.0' - jobs: skip-check: name: Skip check @@ -54,9 +50,7 @@ jobs: steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - - uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0 - with: - version: ${{ env.PNPM_VERSION }} + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - name: Set up Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 diff --git a/package.json b/package.json index b6b2803c962..1095ee5b919 100644 --- a/package.json +++ b/package.json @@ -5,5 +5,5 @@ "all-contributors-cli": "6.26.1", "ts-protoc-gen": "0.15.0" }, - "packageManager": "pnpm@10.33.0+sha512.10568bb4a6afb58c9eb3630da90cc9516417abebd3fabbe6739f0ae795728da1491e9db5a544c76ad8eb7570f5c4bb3d6c637b2cb41bfdcdb47fa823c8649319" + "packageManager": "pnpm@11.5.2+sha512.71c631e382066efc25625d5cf029075de07b61b37f6e27350fbd84b1bda5864c8c1967adc280776b45c30a715c0359a3be08fef42d5bb09e2b99029979692916" } diff --git a/ui/pnpm-workspace.yaml b/ui/pnpm-workspace.yaml index f26b956798c..e45b138e3ba 100644 --- a/ui/pnpm-workspace.yaml +++ b/ui/pnpm-workspace.yaml @@ -1,3 +1,62 @@ packages: - "packages/app/*" - "packages/shared/*" + +# Control which dependencies may run install/build lifecycle scripts. +# pnpm blocks dependency build scripts by default since v10; allow only the +# ones that need native builds, deny the rest to keep installs lean & safe. +allowBuilds: + "@parcel/watcher": true + "@swc/core": true + esbuild: true + nx: true + core-js: false + core-js-pure: false + glob-promise: false + puppeteer: false + +# Keep pnpm's 24h supply-chain protection (minimumReleaseAge) but allow +# our own freshly-published packages to be installed without delay. +minimumReleaseAgeExclude: + - "@parca/*" + +# pnpm 10+ reads overrides from here ("pnpm.overrides" in package.json is +# ignored by pnpm 11). These are duplicated in package.json's pnpm.overrides +# so Vercel's pnpm 9 (the default for a lockfileVersion 9.0 lockfile when +# Corepack is off) still applies them. Keep both copies in sync. +overrides: + fork-ts-checker-webpack-plugin: "^8.0.0" + "axios@>=1.14.0 <1.14.2": "1.15.2" + "axios@>=0.30.0 <0.30.5": "0.30.3" + "axios@>=1.0.0 <1.13.5": "1.15.2" + "rollup@>=4.0.0 <4.59.0": "4.60.1" + "rollup@<2.80.0": "2.80.0" + "handlebars@>=4.0.0 <4.7.9": "4.7.9" + "nth-check@<2.0.1": "2.1.1" + "minimatch@>=5.0.0 <5.1.8": "5.1.9" + "minimatch@>=9.0.0 <9.0.7": "9.0.9" + "basic-ftp@<5.2.0": "5.3.0" + "serialize-javascript@<7.0.5": "7.0.5" + "underscore@<=1.13.7": "1.13.8" + "svgo@>=2.1.0 <2.8.1": "2.8.2" + "immutable@>=5.0.0 <5.1.5": "5.1.5" + "flatted@<3.4.2": "3.4.2" + "koa@<2.16.4": "2.16.4" + "node-forge@<1.4.0": "1.4.0" + "picomatch@<2.3.2": "2.3.2" + "picomatch@>=4.0.0 <4.0.4": "4.0.4" + "jsonpath@<=1.2.1": "1.3.0" + "path-to-regexp@<0.1.13": "0.2.5" + "prismjs@<1.30.0": "1.30.0" + "postcss@<8.4.31": "8.5.10" + "ajv@<6.14.0": "6.14.0" + "ajv@>=7.0.0-alpha.0 <8.18.0": "8.18.0" + "yauzl@>=3.2.0 <3.2.1": "3.2.1" + "brace-expansion@<1.1.13": "1.1.13" + "brace-expansion@>=2.0.0 <2.0.3": "2.0.3" + "brace-expansion@>=4.0.0 <5.0.5": "5.0.5" + "yaml@>=1.0.0 <1.10.3": "1.10.3" + "yaml@>=2.0.0 <2.8.3": "2.8.3" + "diff@>=4.0.0 <4.0.4": "4.0.4" + "diff@>=5.0.0 <5.2.2": "5.2.2" + "qs@>=6.7.0 <=6.14.1": "6.15.0" From 9683ee1fa0c1c9c01417284294f225df61c8a3bf Mon Sep 17 00:00:00 2001 From: Manoj Vivek Date: Tue, 9 Jun 2026 19:55:47 +0530 Subject: [PATCH 04/45] ui: GPU tooltip improvement (#6368) * GPU tooltip improvement * [pre-commit.ci lite] apply automatic fixes --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> --- .../profile/src/GraphTooltipArrow/Content.tsx | 39 +++++++++-- .../gpuFrameDescriptions.test.ts | 43 +++++++++++- .../GraphTooltipArrow/gpuFrameDescriptions.ts | 65 ++++++++++++++----- .../useGraphTooltipMetaInfo/index.ts | 11 +--- .../FlameGraphArrow/utils.ts | 8 ++- 5 files changed, 129 insertions(+), 37 deletions(-) diff --git a/ui/packages/shared/profile/src/GraphTooltipArrow/Content.tsx b/ui/packages/shared/profile/src/GraphTooltipArrow/Content.tsx index 9d200f40781..65f22f74f9b 100644 --- a/ui/packages/shared/profile/src/GraphTooltipArrow/Content.tsx +++ b/ui/packages/shared/profile/src/GraphTooltipArrow/Content.tsx @@ -20,9 +20,10 @@ import {useParcaContext} from '@parca/components'; import {ProfileType} from '@parca/parser'; import {formatDateTimeDownToMS, getLastItem} from '@parca/utilities'; +import {getLabelPairs} from '../ProfileFlameGraph/FlameGraphArrow/utils'; import {hexifyAddress, truncateString, truncateStringReverse} from '../utils'; import {ExpandOnHover} from './ExpandOnHoverValue'; -import {gpuFrameInfo, type GpuFrameInfo} from './gpuFrameDescriptions'; +import {gpuFrameInfosFromLabels, type GpuFrameInfo} from './gpuFrameDescriptions'; import {openInNewTab} from './openInNewTab'; import {useGraphTooltip} from './useGraphTooltip'; import {useGraphTooltipMetaInfo} from './useGraphTooltipMetaInfo'; @@ -78,7 +79,7 @@ const GraphTooltipArrowContent = ({ row: rowNumber, } = graphTooltipData; - const info = gpuFrameInfo(name); + const gpuInfos = gpuFrameInfosFromLabels(getLabelPairs(table, rowNumber)); // Outer card gains a subtle ring when frozen, matching the design's // `.is-frozen` treatment. @@ -135,7 +136,15 @@ const GraphTooltipArrowContent = ({ - {info !== undefined && } + {gpuInfos.map((info, i) => ( + 1 && info.kind === 'stall' ? 2 : undefined} + /> + ))} @@ -143,8 +152,26 @@ const GraphTooltipArrowContent = ({ ); }; -const GpuDescriptionBlock = ({info}: {info: GpuFrameInfo}): React.JSX.Element => { +// Trims a description to at most `max` sentences, appending an ellipsis when +// anything was dropped. +const truncateToSentences = (text: string, max: number): string => { + const sentences = text.match(/[^.!?]+[.!?]+(\s|$)|[^.!?]+$/g); + if (sentences === null || sentences.length <= max) return text; + return `${sentences.slice(0, max).join('').trimEnd()} …`; +}; + +const GpuDescriptionBlock = ({ + info, + maxSentences, +}: { + info: GpuFrameInfo; + maxSentences?: number; +}): React.JSX.Element => { const chipPrefix = info.kind === 'stall' ? 'Stall reason' : 'SASS instruction'; + const description = + maxSentences === undefined + ? info.entry.description + : truncateToSentences(info.entry.description, maxSentences); return (
@@ -154,9 +181,7 @@ const GpuDescriptionBlock = ({info}: {info: GpuFrameInfo}): React.JSX.Element =>
Description
-

- {info.entry.description} -

+

{description}