mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2026-10-25 00:02:16 +00:00
ui: reset clears call graph, shortened info line
This commit is contained in:
1 parent
8fc6bf174a
commit
5011fc15f2
5 files changed
+23
-10
No files matched your search
@@ -7,14 +7,14 @@ platforms that implement `startProbing`.
|
||||
Each node represents a routine, and its children are the routines it
|
||||
called. Beside each name is a summary:
|
||||
|
||||
12x 3400 clk (45.2%) self 800 line 20-31
|
||||
12x 45.2% 3400/800 @20-31
|
||||
|
||||
- `12x` is how many times the routine was called.
|
||||
- `3400 clk` is the clocks spent in the routine *and* its callees, and the
|
||||
percentage is its share of all clocks the graph has seen.
|
||||
- `self` is the clocks in the routine alone, not counting callees. It is
|
||||
left out when the routine calls nothing.
|
||||
- `line` is the scanline range where it last ran (raster platforms).
|
||||
- `45.2%` is its share of all clocks the graph has seen.
|
||||
- `3400/800` is the clocks spent in the routine *and* its callees,
|
||||
then the clocks in the routine alone (`self`), not counting callees. The
|
||||
`/self` part is left out when the routine calls nothing.
|
||||
- `@20-31` is the scanline range where it last ran (raster platforms).
|
||||
|
||||
Interrupt handlers appear as calls from whatever was running when the
|
||||
interrupt fired. A call or return instruction's own clocks are counted in
|
||||
|
||||
@@ -1574,6 +1574,7 @@ export function clearBreakpoint() {
|
||||
function resetPlatform() {
|
||||
platform.reset();
|
||||
_resetRecording();
|
||||
projectWindows.resetViews();
|
||||
}
|
||||
|
||||
function resetAndRun() {
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface ProjectView {
|
||||
setVisible?(showing: boolean): void;
|
||||
refresh(moveCursor: boolean): void;
|
||||
tick?(): void;
|
||||
reset?(): void; // machine was reset: drop accumulated run data
|
||||
getPath?(): string;
|
||||
getValue?(): string;
|
||||
getSelectionText?(): string;
|
||||
|
||||
@@ -209,7 +209,6 @@ export class DebugBrowserView extends TreeViewBase implements ProjectView {
|
||||
getRootObject() { return platform.getDebugTree(); }
|
||||
}
|
||||
|
||||
// TODO: clear stack data when reset?
|
||||
export class CallGraphView extends ProbeViewBaseBase implements ProjectView {
|
||||
treeroot : TreeNode;
|
||||
builder = new CallGraphBuilder(pc => this.classify(pc), pc => this.addr2str(pc));
|
||||
@@ -236,6 +235,12 @@ export class CallGraphView extends ProbeViewBaseBase implements ProjectView {
|
||||
this.kinds.clear();
|
||||
}
|
||||
|
||||
/** Machine reset: the old call stack and profile no longer apply. */
|
||||
reset() {
|
||||
this.builder.clear();
|
||||
if (this.probe) this.probe.clear();
|
||||
}
|
||||
|
||||
/** Call, return or neither, from the disassembly (cached: code rarely changes). */
|
||||
classify(pc : number) : InsnKind {
|
||||
let kind = this.kinds.get(pc);
|
||||
@@ -271,9 +276,9 @@ export class CallGraphView extends ProbeViewBaseBase implements ProjectView {
|
||||
callees(node : CallGraphNode, base : number) : Object {
|
||||
const out = {};
|
||||
for (const [name, c] of Object.entries(node.calls)) {
|
||||
let text = c.count + "x " + c.total + " clk (" + (100 * c.total / base).toFixed(1) + "%)";
|
||||
if (c.self != c.total) text += " self " + c.self;
|
||||
if (c.startLine != null) text += " line " + c.startLine + (c.endLine != null ? "-" + c.endLine : "");
|
||||
// count, share of total, clocks (total/self), scanlines
|
||||
let text = c.count + "x " + (100 * c.total / base).toFixed(1) + "% " + c.total + (c.self != c.total ? "/" + c.self : "");
|
||||
if (c.startLine != null) text += " @" + c.startLine + (c.endLine != null && c.endLine != c.startLine ? "-" + c.endLine : "");
|
||||
out[name] = Object.assign({ $$text: text }, this.callees(c, base));
|
||||
}
|
||||
return out;
|
||||
|
||||
@@ -126,6 +126,12 @@ export class ProjectWindows {
|
||||
this.activewnd.refresh(moveCursor);
|
||||
}
|
||||
|
||||
/** Tells every window (not just the visible one) that the machine was reset. */
|
||||
resetViews(): void {
|
||||
for (const wnd of Object.values(this.id2window)) wnd.reset && wnd.reset();
|
||||
this.refresh(false);
|
||||
}
|
||||
|
||||
tick(): void {
|
||||
if (this.activewnd && this.activewnd.tick)
|
||||
this.activewnd.tick();
|
||||
|
||||
Reference in new issue
Block a user