@abaplint/runtime 2.5.56 → 2.5.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -86,24 +86,25 @@ class Statements {
|
|
|
86
86
|
this.sort = sort_1.sort;
|
|
87
87
|
this.split = split_1.split;
|
|
88
88
|
this.translate = translate_1.translate;
|
|
89
|
-
this.traceTotals = {};
|
|
90
89
|
this.context = context;
|
|
90
|
+
this.traceTotals = {};
|
|
91
91
|
}
|
|
92
92
|
_trace(func, name, min, totals) {
|
|
93
|
+
const tt = this.traceTotals;
|
|
93
94
|
const exec = (...options) => {
|
|
94
95
|
const start = Date.now();
|
|
95
96
|
const result = func.bind(this)(...options);
|
|
96
97
|
const runtime = Date.now() - start;
|
|
97
98
|
if (totals === true) {
|
|
98
|
-
if (
|
|
99
|
-
|
|
99
|
+
if (tt[name] === undefined) {
|
|
100
|
+
tt[name] = 0;
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
+
tt[name] += runtime;
|
|
102
103
|
}
|
|
103
104
|
if (runtime >= min) {
|
|
104
105
|
console.log(`STATEMENT: ${name}, ${runtime} ms`);
|
|
105
106
|
if (totals === true) {
|
|
106
|
-
console.log(JSON.stringify(
|
|
107
|
+
console.log(JSON.stringify(tt));
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
110
|
return result;
|
|
@@ -111,20 +112,21 @@ class Statements {
|
|
|
111
112
|
return exec;
|
|
112
113
|
}
|
|
113
114
|
_traceAsync(func, name, min, totals) {
|
|
115
|
+
const tt = this.traceTotals;
|
|
114
116
|
const exec = async (...options) => {
|
|
115
117
|
const start = Date.now();
|
|
116
118
|
const result = await func.bind(this)(...options);
|
|
117
119
|
const runtime = Date.now() - start;
|
|
118
120
|
if (totals === true) {
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
+
if (tt[name] === undefined) {
|
|
122
|
+
tt[name] = 0;
|
|
121
123
|
}
|
|
122
|
-
|
|
124
|
+
tt[name] += runtime;
|
|
123
125
|
}
|
|
124
126
|
if (runtime >= min) {
|
|
125
127
|
console.log(`STATEMENT: ${name}, ${runtime} ms`);
|
|
126
128
|
if (totals === true) {
|
|
127
|
-
console.log(JSON.stringify(
|
|
129
|
+
console.log(JSON.stringify(tt));
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
return result;
|