-
Notifications
You must be signed in to change notification settings - Fork 0
/
introspector.ts
134 lines (115 loc) · 3.19 KB
/
introspector.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
export type CallbackInput = {
name:string;
}
export type CallbackOutput = {
name:string;
}
export interface iFrame {
id: number;
name: string;
fileName: string;
functionName: string;
lineNumber: number;
columnNumber: number;
target: string;
type: string;
category: string;
isOptimized: boolean,
isUnoptimized: boolean;
isInlinable: boolean;
isInit: boolean;
isWasm: boolean;
value: number;
onStackTop: string;
children: iFrame[];
};
export interface TreeNode {
id?: string;
children?: TreeNode[];
onStackTop: {
asViewed: number;
rootFromMean?: number;
};
value?: number;
original?: number;
category?: string;
type?: string;
data?: TreeNode;
}
export interface Tree {
merged: TreeNode;
unmerged: TreeNode;
//codeAreas: any;
appName: string;
pathSeparator: string;
}
export class DataTree {
merged!: TreeNode;
unmerged!: TreeNode;
// codeAreas: any;
appName!: string;
pathSeparator!: string;
mergedNodes!: TreeNode[];
unmergedNodes!: TreeNode[];
useMerged!: boolean;
showOptimizationStatus!: boolean;
exclude!: Set<string>;
flatByHottest!: TreeNode[] | null;
mean!: number;
highestStackTop!: number;
maxRootAboveMean!: number;
maxRootBelowMean!: number;
totalFrames!: number | null;
groupedSortValues!: Map<TreeNode, number> | null;
}
export interface Accumulated {
//(value: T): T;
//result: () => T;
renderHtml: () => string;
renderJson: () => string;
renderConsole: () => void;
}
// Define the interface for the accumulator
export interface Accumulator {
(value: Accumulated): Accumulated;
results: () => Accumulated[];
renderHtml: () => string;
renderJson: () => string;
renderConsole: () => void;
}
// // Create a singleton instance of the accumulator
// const accumulator = createAccumulator();
// // Use the accumulator
// accumulator(10);
// accumulator(20);
// accumulator(30);
// // Retrieve the results via the properties
// console.log('Results:', accumulator.results());
// // Render the results in different formats
// console.log('HTML:');
// console.log(accumulator.renderHtml());
// console.log('JSON:');
// console.log(accumulator.renderJson());
// console.log('Console:');
// accumulator.renderConsole();
export type StringCallback = (x: string) => CallbackOutput;
export type FilterFunctionCallback = (function_name: iFrame) => boolean
//export type Example1 = (event: any) => DataFrame<number, never>;
export interface Introspector {
(): Callback;// the default function
filter_current_value: FilterFunctionCallback;
// enter_test_driver:Callback
// leave_test_driver:Callback
// wrapper_rdf:Callback
debug:StringCallback
accumulator:Accumulator
}
export function isp_self(subj:string,_callback:Introspector) :void {
console.log("self"+ subj);
//return {name:"nope"}
}
export type Callback = (x: CallbackInput, y:Introspector) => CallbackOutput;
export type MaybeTree = Tree | undefined;
export type StringToTreeCallback = (x:string, y:Introspector) => MaybeTree;
export type RdfCallback = (subj: string,callback:Introspector) => void;
export type RdfPredCallback = (x: RdfCallback,subj:string,callback:Introspector) => void;