| 1 |
<script lang="ts"> |
| 2 |
import { viewOptionsCallStack } from "../lib/settings"; |
| 3 |
import { randomId } from "../lib/utils"; |
| 4 |
const cid = randomId(); |
| 5 |
|
| 6 |
function removeIrrelevantThresholdPercent() { |
| 7 |
const num = $viewOptionsCallStack.removeIrrelevantThreshold * 100 |
| 8 |
return num.toLocaleString(undefined, { maximumFractionDigits: 4 }); |
| 9 |
} |
| 10 |
function removeIrrelevantThresholdPercentSet(event: Event & { currentTarget: EventTarget & HTMLInputElement; }) { |
| 11 |
$viewOptionsCallStack.removeIrrelevantThreshold = event.currentTarget.valueAsNumber / 100; |
| 12 |
} |
| 13 |
</script> |
| 14 |
|
| 15 |
<div class="view-options-call-stack"> |
| 16 |
<div class="option-group"> |
| 17 |
<div class="name">Collapse frames</div> |
| 18 |
<div class="body"> |
| 19 |
<div class="option"> |
| 20 |
<input |
| 21 |
id={cid + "collapseModeAll"} |
| 22 |
type="radio" |
| 23 |
bind:group={$viewOptionsCallStack.collapseMode} |
| 24 |
value="non-application" |
| 25 |
/> |
| 26 |
<label for={cid + "collapseModeAll"}>Library code</label> |
| 27 |
<div class="description"> |
| 28 |
Code run from the Python stdlib, a virtualenv, or a conda env will be collapsed. |
| 29 |
</div> |
| 30 |
</div> |
| 31 |
<div class="option"> |
| 32 |
<input |
| 33 |
id={cid + "collapseModeCustom"} |
| 34 |
type="radio" |
| 35 |
bind:group={$viewOptionsCallStack.collapseMode} |
| 36 |
value="custom" |
| 37 |
/> |
| 38 |
<label for={cid + "collapseModeCustom"}>Custom</label> |
| 39 |
<div class="description"> |
| 40 |
Regex on the source file path. |
| 41 |
<div class="mini-input-grid"> |
| 42 |
<label for="collapseCustomShow">Show</label> |
| 43 |
<input |
| 44 |
id="collapseCustomShow" |
| 45 |
type="text" |
| 46 |
bind:value={$viewOptionsCallStack.collapseCustomShow} |
| 47 |
placeholder="myproject" |
| 48 |
spellcheck="false" |
| 49 |
autocapitalize="off" |
| 50 |
autocomplete="off" |
| 51 |
autocorrect="off" |
| 52 |
/> |
| 53 |
<label for="collapseCustomHide">Hide</label> |
| 54 |
<input |
| 55 |
id="collapseCustomHide" |
| 56 |
type="text" |
| 57 |
bind:value={$viewOptionsCallStack.collapseCustomHide} |
| 58 |
placeholder=".*/lib/.*" |
| 59 |
spellcheck="false" |
| 60 |
autocapitalize="off" |
| 61 |
autocomplete="off" |
| 62 |
autocorrect="off" |
| 63 |
/> |
| 64 |
</div> |
| 65 |
If neither match, the library code rule is used. |
| 66 |
</div> |
| 67 |
</div> |
| 68 |
<div class="option"> |
| 69 |
<input |
| 70 |
id={cid + "collapseModeDisabled"} |
| 71 |
type="radio" |
| 72 |
bind:group={$viewOptionsCallStack.collapseMode} |
| 73 |
value="disabled" |
| 74 |
/> |
| 75 |
<label for={cid + "collapseModeDisabled"}>Disabled</label> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
|
| 80 |
<div class="option-group"> |
| 81 |
<div class="name">Remove frames</div> |
| 82 |
<div class="body"> |
| 83 |
|
| 84 |
<div class="option"> |
| 85 |
<input |
| 86 |
id={cid + "removeImportlib"} |
| 87 |
type="checkbox" |
| 88 |
bind:checked={$viewOptionsCallStack.removeImportlib} |
| 89 |
/> |
| 90 |
<label for={cid + "removeImportlib"}> importlib machinery </label> |
| 91 |
</div> |
| 92 |
|
| 93 |
<div class="option"> |
| 94 |
<input |
| 95 |
id={cid + "removeTracebackHide"} |
| 96 |
type="checkbox" |
| 97 |
bind:checked={$viewOptionsCallStack.removeTracebackHide} |
| 98 |
/> |
| 99 |
<label for={cid + "removeTracebackHide"}> |
| 100 |
Frames declaring __traceback_hide__ |
| 101 |
</label> |
| 102 |
</div> |
| 103 |
|
| 104 |
<div class="option"> |
| 105 |
<input |
| 106 |
id={cid + "removePyinstrument"} |
| 107 |
type="checkbox" |
| 108 |
bind:checked={$viewOptionsCallStack.removePyinstrument} |
| 109 |
/> |
| 110 |
<label for={cid + "removePyinstrument"}> pyinstrument frames </label> |
| 111 |
</div> |
| 112 |
|
| 113 |
<div class="option"> |
| 114 |
<input |
| 115 |
id={cid + "removeIrrelevant"} |
| 116 |
type="checkbox" |
| 117 |
bind:checked={$viewOptionsCallStack.removeIrrelevant} |
| 118 |
/> |
| 119 |
<span> |
| 120 |
<label for={cid + "removeIrrelevant"}> Frames with durations less than </label> |
| 121 |
<input |
| 122 |
type="number" |
| 123 |
value={removeIrrelevantThresholdPercent()} |
| 124 |
min="0" |
| 125 |
max="99" |
| 126 |
step="0.01" |
| 127 |
on:input={removeIrrelevantThresholdPercentSet} |
| 128 |
style="width: 4em;" |
| 129 |
/> |
| 130 |
% of the total time |
| 131 |
</span> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
|
| 136 |
<div class="option-group"> |
| 137 |
<div class="name">Time format</div> |
| 138 |
<div class="body"> |
| 139 |
<div class="option"> |
| 140 |
<label> |
| 141 |
<input |
| 142 |
type="radio" |
| 143 |
bind:group={$viewOptionsCallStack.timeFormat} |
| 144 |
value="absolute" |
| 145 |
/> |
| 146 |
Absolute time in seconds |
| 147 |
</label> |
| 148 |
</div> |
| 149 |
|
| 150 |
<div class="option"> |
| 151 |
<label> |
| 152 |
<input |
| 153 |
type="radio" |
| 154 |
bind:group={$viewOptionsCallStack.timeFormat} |
| 155 |
value="proportion" |
| 156 |
/> |
| 157 |
Percentage of the total run time |
| 158 |
</label> |
| 159 |
</div> |
| 160 |
</div> |
| 161 |
</div> |
| 162 |
</div> |
| 163 |
|
| 164 |
<style lang="scss"> |
| 165 |
.view-options-call-stack { |
| 166 |
padding: 6px 9px; |
| 167 |
} |
| 168 |
.option { |
| 169 |
display: grid; |
| 170 |
grid-template-columns: auto 1fr; |
| 171 |
align-items: start; |
| 172 |
padding-left: 1px; |
| 173 |
margin-bottom: 3px; |
| 174 |
.description { |
| 175 |
font-size: 12px; |
| 176 |
color: #999; |
| 177 |
grid-column: 2/3; |
| 178 |
} |
| 179 |
} |
| 180 |
.option-group { |
| 181 |
margin-bottom: 10px; |
| 182 |
.name { |
| 183 |
margin-bottom: 4px; |
| 184 |
} |
| 185 |
} |
| 186 |
.mini-input-grid { |
| 187 |
display: grid; |
| 188 |
grid-template-columns: auto 1fr; |
| 189 |
gap: 5px; |
| 190 |
align-items: baseline; |
| 191 |
margin-top: 3px; |
| 192 |
margin-bottom: 2px; |
| 193 |
label { |
| 194 |
font-weight: 600; |
| 195 |
} |
| 196 |
} |
| 197 |
input { |
| 198 |
font-family: "Source Code Pro", "Roboto Mono", Consolas, Monaco, monospace; |
| 199 |
font-size-adjust: 0.486094; |
| 200 |
|
| 201 |
border-radius: 3px; |
| 202 |
background: #4e5255; |
| 203 |
padding: 1px 5px; |
| 204 |
font-size: 12px; |
| 205 |
border: 1px solid #4e5255; |
| 206 |
color: #ccc; |
| 207 |
&:focus-visible { |
| 208 |
outline: 1px solid #abb2b7; |
| 209 |
// outline-offset: 1px;; |
| 210 |
} |
| 211 |
} |
| 212 |
input[type=number]::-webkit-inner-spin-button { |
| 213 |
-webkit-appearance: none; |
| 214 |
} |
| 215 |
</style> |