Skip to content

Commit

Permalink
Some visual improvements and fixes for the call stack view
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Oct 11, 2024
1 parent cbbab96 commit 187ed13
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 35 deletions.
15 changes: 0 additions & 15 deletions docs/_static/preview/assets/index-CSk4DLjl.js

This file was deleted.

15 changes: 15 additions & 0 deletions docs/_static/preview/assets/index-DhaBtkCM.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/_static/preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pyinstrument Demo</title>
<script type="module" crossorigin src="./assets/index-CSk4DLjl.js"></script>
<script type="module" crossorigin src="./assets/index-DhaBtkCM.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-paBu1EOJ.css">
</head>
<body>
Expand Down
15 changes: 12 additions & 3 deletions html_renderer/src/components/Frame.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,16 @@
name = frame.function;
}
const codePosition = `${frame.filePathShort}:${frame.lineNo?.toString().padEnd(4, " ")}`;
let codePosition: string
if (frame.isSynthetic) {
codePosition = "";
} else if (frame.filePathShort == null) {
codePosition = "";
} else if (frame.lineNo == null || frame.lineNo === 0) {
codePosition = frame.filePathShort;
} else {
codePosition = `${frame.filePathShort}:${frame.lineNo}`;
}
let formattedTime: string;
$: if ($viewOptionsCallStack.timeFormat === "absolute") {
Expand Down Expand Up @@ -224,7 +233,7 @@
<div
class="time"
style:color={timeColor}
style:font-weight={frameProportionOfTotal < 0.2 ? 500 : 600}
style:font-weight={frameProportionOfTotal < 0.15 ? 500 : 600}
>
{formattedTime}
</div>
Expand Down Expand Up @@ -262,7 +271,7 @@
/></svg
>
</div>
{frame.group.frames.length} frames hidden ({groupLibrarySummary})
{frame.group.frames.length-1} frames hidden ({groupLibrarySummary})
</div>
</div>
{/if}
Expand Down
6 changes: 4 additions & 2 deletions html_renderer/src/lib/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ export function colorForFrameProportionOfTotal(proportion: number): string {
return '#FF4159'
} else if (proportion > 0.3) {
return '#F5A623'
} else if (proportion > 0.2) {
} else if (proportion > 0.15) {
return '#D8CB2A'
} else {
} else if (proportion > 0.05) {
return '#7ED321'
} else {
return '#58984f'
}
}
28 changes: 14 additions & 14 deletions pyinstrument/renderers/html_resources/app.js

Large diffs are not rendered by default.

0 comments on commit 187ed13

Please sign in to comment.