Files
2024-02-15 17:01:50 +00:00

42 lines
814 B
TypeScript

import {Frame} from './frame';
export class CallTreeNode {
readonly frame: Frame;
private locked = false;
count: number = 0;
isRoot: boolean;
parent: CallTreeNode | null = null;
recursive: CallTreeNode | null = null;
children: CallTreeNode[] = [];
totalWeight: number = 0;
selfWeight: number = 0;
aggregate_duration_ns = 0;
static readonly Root = new CallTreeNode(Frame.Root, null);
constructor(frame: Frame, parent: CallTreeNode | null) {
this.parent = parent;
this.frame = frame;
this.isRoot = Frame.Root.name === this.frame.name;
}
isDirectRecursive(): boolean {
if (!this.parent) {
return false;
}
return this.parent.frame === this.frame;
}
isLocked(): boolean {
return this.locked;
}
lock(): void {
this.locked = true;
}
}