callTreeNode.tsx 814 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {Frame} from './frame';
  2. export class CallTreeNode {
  3. readonly frame: Frame;
  4. private locked = false;
  5. count: number = 0;
  6. isRoot: boolean;
  7. parent: CallTreeNode | null = null;
  8. recursive: CallTreeNode | null = null;
  9. children: CallTreeNode[] = [];
  10. totalWeight: number = 0;
  11. selfWeight: number = 0;
  12. aggregate_duration_ns = 0;
  13. static readonly Root = new CallTreeNode(Frame.Root, null);
  14. constructor(frame: Frame, parent: CallTreeNode | null) {
  15. this.parent = parent;
  16. this.frame = frame;
  17. this.isRoot = Frame.Root.name === this.frame.name;
  18. }
  19. isDirectRecursive(): boolean {
  20. if (!this.parent) {
  21. return false;
  22. }
  23. return this.parent.frame === this.frame;
  24. }
  25. isLocked(): boolean {
  26. return this.locked;
  27. }
  28. lock(): void {
  29. this.locked = true;
  30. }
  31. }