Skip to content

Commit 5cdb55a

Browse files
committed
show class names in profiling location info
1 parent 7803ad2 commit 5cdb55a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/plots/profiler.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ import { prewalk, prefor } from './tree.js'
99
import { open } from '../util/opener'
1010
import { remote } from 'electron'
1111

12-
function namestring (func, file, line) {
12+
function namestring (func, file, line, classes) {
1313
if (!func && !file) { return "Program" }
14-
return (func ? func + " at " : "") + file + (line == -1 ? "" : ":"+line)
14+
return (
15+
(func ? func + " at " : "") +
16+
file +
17+
(line === -1 ? "" : ":" + line) +
18+
(classes.length === 0 ? "" : " (" + classes.join(", ") + ")")
19+
)
1520
}
1621

1722
function process (view, tree) {
@@ -21,7 +26,7 @@ function process (view, tree) {
2126
count,
2227
classes,
2328
children,
24-
onmouseover: () => view.current = {func, location, line, count},
29+
onmouseover: () => view.current = {func, location, line, count, classes},
2530
onmouseout: () => view.current = null,
2631
onclick: () => open(path, line-1, {pending: true})
2732
}))
@@ -68,11 +73,11 @@ export class ProfileViewer {
6873
<Button icon='file' alt='Save' disabled={!this.save} onclick={() => this.saveData()}/>
6974
</span>
7075
if (!current) return <span>{always}</span>
71-
const {func, location, line, count} = current
76+
const {func, location, line, count, classes} = current
7277
return <span>
7378
{always}
7479
<span className='inline-block'><Badge>{count}</Badge></span>
75-
<span style='vertical-align:middle'>{namestring(func, location, line)}</span>
80+
<span style='vertical-align:middle'>{namestring(func, location, line, classes)}</span>
7681
</span>
7782
}
7883

0 commit comments

Comments
 (0)