@eagleoutice/flowr 1.4.1 → 1.5.0
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.
- package/README.md +3 -3
- package/abstract-interpretation/processor.js +9 -3
- package/config.d.ts +16 -0
- package/config.js +75 -0
- package/core/input.d.ts +1 -1
- package/core/output.d.ts +1 -2
- package/core/print/parse-printer.d.ts +1 -2
- package/core/print/parse-printer.js +6 -4
- package/core/print/slice-diff-ansi.js +7 -7
- package/core/slicer.js +4 -8
- package/core/steps.d.ts +355 -31
- package/core/steps.js +7 -14
- package/dataflow/environments/environment.js +8 -0
- package/dataflow/environments/register.js +1 -0
- package/dataflow/extractor.d.ts +2 -2
- package/dataflow/extractor.js +10 -2
- package/dataflow/internal/process/functions/function-call.js +7 -1
- package/dataflow/internal/process/functions/source.d.ts +8 -0
- package/dataflow/internal/process/functions/source.js +81 -0
- package/dataflow/processor.d.ts +10 -1
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/package.json +75 -202
- package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/index.js +3 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
- package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +6 -11
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
- package/r-bridge/lang-4.x/values.d.ts +0 -1
- package/r-bridge/lang-4.x/values.js +14 -6
- package/r-bridge/retriever.d.ts +25 -21
- package/r-bridge/retriever.js +73 -23
- package/r-bridge/shell-executor.d.ts +3 -17
- package/r-bridge/shell-executor.js +9 -78
- package/r-bridge/shell.d.ts +5 -27
- package/r-bridge/shell.js +31 -92
- package/{statistics/output → util}/ansi.js +1 -1
- package/util/args.d.ts +8 -4
- package/util/args.js +11 -4
- package/util/cfg/visitor.js +1 -1
- package/util/files.d.ts +6 -0
- package/util/files.js +11 -1
- package/util/log.js +3 -0
- package/util/{summarizer/summarizer.d.ts → summarizer.d.ts} +15 -1
- package/util/summarizer.js +37 -0
- package/util/version.d.ts +2 -0
- package/util/version.js +10 -0
- package/benchmark/index.d.ts +0 -3
- package/benchmark/index.js +0 -20
- package/benchmark/slicer.d.ts +0 -101
- package/benchmark/slicer.js +0 -225
- package/benchmark/stats/index.d.ts +0 -10
- package/benchmark/stats/index.js +0 -27
- package/benchmark/stats/print.d.ts +0 -7
- package/benchmark/stats/print.js +0 -157
- package/benchmark/stats/stats.d.ts +0 -41
- package/benchmark/stats/stats.js +0 -6
- package/benchmark/stopwatch.d.ts +0 -35
- package/benchmark/stopwatch.js +0 -79
- package/cli/benchmark-app.d.ts +0 -9
- package/cli/benchmark-app.js +0 -52
- package/cli/benchmark-helper-app.d.ts +0 -7
- package/cli/benchmark-helper-app.js +0 -60
- package/cli/common/features.d.ts +0 -3
- package/cli/common/features.js +0 -30
- package/cli/common/index.d.ts +0 -2
- package/cli/common/index.js +0 -19
- package/cli/common/options.d.ts +0 -20
- package/cli/common/options.js +0 -82
- package/cli/common/script.d.ts +0 -21
- package/cli/common/script.js +0 -61
- package/cli/common/scripts-info.d.ts +0 -24
- package/cli/common/scripts-info.js +0 -69
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -46
- package/cli/repl/commands/cfg.d.ts +0 -3
- package/cli/repl/commands/cfg.js +0 -37
- package/cli/repl/commands/commands.d.ts +0 -11
- package/cli/repl/commands/commands.js +0 -103
- package/cli/repl/commands/dataflow.d.ts +0 -3
- package/cli/repl/commands/dataflow.js +0 -34
- package/cli/repl/commands/execute.d.ts +0 -4
- package/cli/repl/commands/execute.js +0 -27
- package/cli/repl/commands/index.d.ts +0 -2
- package/cli/repl/commands/index.js +0 -19
- package/cli/repl/commands/main.d.ts +0 -39
- package/cli/repl/commands/main.js +0 -14
- package/cli/repl/commands/normalize.d.ts +0 -3
- package/cli/repl/commands/normalize.js +0 -34
- package/cli/repl/commands/parse.d.ts +0 -2
- package/cli/repl/commands/parse.js +0 -109
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/commands/quit.js +0 -12
- package/cli/repl/commands/version.d.ts +0 -16
- package/cli/repl/commands/version.js +0 -33
- package/cli/repl/core.d.ts +0 -39
- package/cli/repl/core.js +0 -116
- package/cli/repl/execute.d.ts +0 -28
- package/cli/repl/execute.js +0 -79
- package/cli/repl/index.d.ts +0 -5
- package/cli/repl/index.js +0 -22
- package/cli/repl/prompt.d.ts +0 -2
- package/cli/repl/prompt.js +0 -9
- package/cli/repl/server/connection.d.ts +0 -21
- package/cli/repl/server/connection.js +0 -218
- package/cli/repl/server/messages/analysis.d.ts +0 -71
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/error.d.ts +0 -11
- package/cli/repl/server/messages/error.js +0 -3
- package/cli/repl/server/messages/hello.d.ts +0 -20
- package/cli/repl/server/messages/hello.js +0 -3
- package/cli/repl/server/messages/index.d.ts +0 -1
- package/cli/repl/server/messages/index.js +0 -3
- package/cli/repl/server/messages/messages.d.ts +0 -35
- package/cli/repl/server/messages/messages.js +0 -40
- package/cli/repl/server/messages/repl.d.ts +0 -33
- package/cli/repl/server/messages/repl.js +0 -37
- package/cli/repl/server/messages/slice.d.ts +0 -25
- package/cli/repl/server/messages/slice.js +0 -37
- package/cli/repl/server/net.d.ts +0 -49
- package/cli/repl/server/net.js +0 -63
- package/cli/repl/server/send.d.ts +0 -4
- package/cli/repl/server/send.js +0 -18
- package/cli/repl/server/server.d.ts +0 -20
- package/cli/repl/server/server.js +0 -66
- package/cli/repl/server/validate.d.ts +0 -15
- package/cli/repl/server/validate.js +0 -34
- package/cli/slicer-app.d.ts +0 -11
- package/cli/slicer-app.js +0 -81
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -98
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -83
- package/cli/summarizer-app.d.ts +0 -18
- package/cli/summarizer-app.js +0 -67
- package/flowr.d.ts +0 -27
- package/flowr.js +0 -137
- package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
- package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
- package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
- package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
- package/statistics/features/common-syntax-probability.d.ts +0 -31
- package/statistics/features/common-syntax-probability.js +0 -156
- package/statistics/features/feature.d.ts +0 -175
- package/statistics/features/feature.js +0 -30
- package/statistics/features/index.d.ts +0 -1
- package/statistics/features/index.js +0 -18
- package/statistics/features/post-processing.d.ts +0 -12
- package/statistics/features/post-processing.js +0 -21
- package/statistics/features/supported/assignments/assignments.d.ts +0 -11
- package/statistics/features/supported/assignments/assignments.js +0 -53
- package/statistics/features/supported/assignments/index.d.ts +0 -1
- package/statistics/features/supported/assignments/index.js +0 -6
- package/statistics/features/supported/assignments/post-process.d.ts +0 -3
- package/statistics/features/supported/assignments/post-process.js +0 -125
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -133
- package/statistics/features/supported/comments/index.d.ts +0 -1
- package/statistics/features/supported/comments/index.js +0 -6
- package/statistics/features/supported/comments/post-process.d.ts +0 -3
- package/statistics/features/supported/comments/post-process.js +0 -50
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -67
- package/statistics/features/supported/control-flow/index.d.ts +0 -1
- package/statistics/features/supported/control-flow/index.js +0 -6
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -3
- package/statistics/features/supported/control-flow/post-process.js +0 -65
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -118
- package/statistics/features/supported/data-access/index.d.ts +0 -1
- package/statistics/features/supported/data-access/index.js +0 -6
- package/statistics/features/supported/data-access/post-process.d.ts +0 -3
- package/statistics/features/supported/data-access/post-process.js +0 -107
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -35
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -139
- package/statistics/features/supported/defined-functions/index.d.ts +0 -1
- package/statistics/features/supported/defined-functions/index.js +0 -6
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -177
- package/statistics/features/supported/expression-list/expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/expression-list.js +0 -36
- package/statistics/features/supported/expression-list/index.d.ts +0 -1
- package/statistics/features/supported/expression-list/index.js +0 -6
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -3
- package/statistics/features/supported/expression-list/post-process.js +0 -44
- package/statistics/features/supported/index.d.ts +0 -10
- package/statistics/features/supported/index.js +0 -27
- package/statistics/features/supported/loops/index.d.ts +0 -1
- package/statistics/features/supported/loops/index.js +0 -6
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -79
- package/statistics/features/supported/loops/post-process.d.ts +0 -3
- package/statistics/features/supported/loops/post-process.js +0 -72
- package/statistics/features/supported/used-functions/index.d.ts +0 -1
- package/statistics/features/supported/used-functions/index.js +0 -6
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -179
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -95
- package/statistics/features/supported/used-packages/index.d.ts +0 -1
- package/statistics/features/supported/used-packages/index.js +0 -6
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -3
- package/statistics/features/supported/used-packages/post-process.js +0 -121
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -130
- package/statistics/features/supported/values/index.d.ts +0 -1
- package/statistics/features/supported/values/index.js +0 -6
- package/statistics/features/supported/values/post-process.d.ts +0 -3
- package/statistics/features/supported/values/post-process.js +0 -72
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -101
- package/statistics/features/supported/variables/index.d.ts +0 -1
- package/statistics/features/supported/variables/index.js +0 -6
- package/statistics/features/supported/variables/post-process.d.ts +0 -9
- package/statistics/features/supported/variables/post-process.js +0 -122
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -70
- package/statistics/index.d.ts +0 -6
- package/statistics/index.js +0 -24
- package/statistics/meta-statistics.d.ts +0 -33
- package/statistics/meta-statistics.js +0 -17
- package/statistics/output/file-provider.d.ts +0 -37
- package/statistics/output/file-provider.js +0 -97
- package/statistics/output/index.d.ts +0 -4
- package/statistics/output/index.js +0 -21
- package/statistics/output/print-stats.d.ts +0 -17
- package/statistics/output/print-stats.js +0 -69
- package/statistics/output/statistics-file.d.ts +0 -37
- package/statistics/output/statistics-file.js +0 -69
- package/statistics/statistics.d.ts +0 -24
- package/statistics/statistics.js +0 -109
- package/util/summarizer/auto-detect.d.ts +0 -2
- package/util/summarizer/auto-detect.js +0 -32
- package/util/summarizer/benchmark/data.d.ts +0 -66
- package/util/summarizer/benchmark/data.js +0 -13
- package/util/summarizer/benchmark/first-phase/input.d.ts +0 -2
- package/util/summarizer/benchmark/first-phase/input.js +0 -59
- package/util/summarizer/benchmark/first-phase/process.d.ts +0 -10
- package/util/summarizer/benchmark/first-phase/process.js +0 -208
- package/util/summarizer/benchmark/second-phase/graph.d.ts +0 -2
- package/util/summarizer/benchmark/second-phase/graph.js +0 -54
- package/util/summarizer/benchmark/second-phase/process.d.ts +0 -4
- package/util/summarizer/benchmark/second-phase/process.js +0 -89
- package/util/summarizer/benchmark/summarizer.d.ts +0 -35
- package/util/summarizer/benchmark/summarizer.js +0 -49
- package/util/summarizer/statistics/first-phase/process.d.ts +0 -6
- package/util/summarizer/statistics/first-phase/process.js +0 -81
- package/util/summarizer/statistics/post-process/clusterer.d.ts +0 -26
- package/util/summarizer/statistics/post-process/clusterer.js +0 -43
- package/util/summarizer/statistics/post-process/file-based-count.d.ts +0 -17
- package/util/summarizer/statistics/post-process/file-based-count.js +0 -49
- package/util/summarizer/statistics/post-process/histogram.d.ts +0 -59
- package/util/summarizer/statistics/post-process/histogram.js +0 -128
- package/util/summarizer/statistics/post-process/index.d.ts +0 -4
- package/util/summarizer/statistics/post-process/index.js +0 -21
- package/util/summarizer/statistics/post-process/post-process-output.d.ts +0 -16
- package/util/summarizer/statistics/post-process/post-process-output.js +0 -104
- package/util/summarizer/statistics/second-phase/process.d.ts +0 -11
- package/util/summarizer/statistics/second-phase/process.js +0 -117
- package/util/summarizer/statistics/summarizer.d.ts +0 -35
- package/util/summarizer/statistics/summarizer.js +0 -135
- package/util/summarizer/summarizer.js +0 -13
- /package/{statistics/output → util}/ansi.d.ts +0 -0
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type AppendFnType = string | number | symbol;
|
|
2
|
-
export interface StatisticAppendProvider {
|
|
3
|
-
append(name: string, fn: AppendFnType, content: string): void;
|
|
4
|
-
}
|
|
5
|
-
export type DummyAppendMemoryMap = Map<string, Map<AppendFnType, string[]>>;
|
|
6
|
-
export declare class DummyAppendProvider implements StatisticAppendProvider {
|
|
7
|
-
private readonly map;
|
|
8
|
-
/**
|
|
9
|
-
* If you pass a map the dummy will log all append calls to the map, using the feature name and the appendage type as keys
|
|
10
|
-
*
|
|
11
|
-
* @param map - The map to log to
|
|
12
|
-
*/
|
|
13
|
-
constructor(map?: DummyAppendMemoryMap | undefined);
|
|
14
|
-
append(name: string, fn: AppendFnType, content: string): void;
|
|
15
|
-
}
|
|
16
|
-
export declare const defaultStatisticsFileSuffix = ".txt";
|
|
17
|
-
/**
|
|
18
|
-
* Provides cached open connections for all files to connect.
|
|
19
|
-
* allowing to append to the same file often.
|
|
20
|
-
* <p>
|
|
21
|
-
* While we could simply reopen these files, it is safer/more performant to keep the connection open.
|
|
22
|
-
*/
|
|
23
|
-
export declare class StatisticFileProvider implements StatisticAppendProvider {
|
|
24
|
-
readonly statisticsDirectory: string;
|
|
25
|
-
private readonly connections;
|
|
26
|
-
constructor(statisticsDirectory: string | undefined);
|
|
27
|
-
/**
|
|
28
|
-
* @param name - the name of the feature {@link Feature#name}
|
|
29
|
-
* @param fn - the name of the feature-aspect to record
|
|
30
|
-
*/
|
|
31
|
-
private statisticsFile;
|
|
32
|
-
/**
|
|
33
|
-
* Append the given content to the information for a feature of the given name and function.
|
|
34
|
-
*/
|
|
35
|
-
append(name: string, fn: AppendFnType, content: string): void;
|
|
36
|
-
private getHandle;
|
|
37
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StatisticFileProvider = exports.defaultStatisticsFileSuffix = exports.DummyAppendProvider = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const assert_1 = require("../../util/assert");
|
|
10
|
-
const log_1 = require("../../util/log");
|
|
11
|
-
class DummyAppendProvider {
|
|
12
|
-
map;
|
|
13
|
-
/**
|
|
14
|
-
* If you pass a map the dummy will log all append calls to the map, using the feature name and the appendage type as keys
|
|
15
|
-
*
|
|
16
|
-
* @param map - The map to log to
|
|
17
|
-
*/
|
|
18
|
-
constructor(map = undefined) {
|
|
19
|
-
this.map = map;
|
|
20
|
-
}
|
|
21
|
-
append(name, fn, content) {
|
|
22
|
-
if (log_1.log.settings.minLevel >= 1 /* LogLevel.Trace */) {
|
|
23
|
-
log_1.log.trace(`DummyAppendProvider: ${name} ${String(fn)} ${content}`);
|
|
24
|
-
}
|
|
25
|
-
if (this.map) {
|
|
26
|
-
const fnMap = this.map.get(name);
|
|
27
|
-
const contentArr = content.split('\n');
|
|
28
|
-
if (fnMap) {
|
|
29
|
-
const contentList = fnMap.get(fn);
|
|
30
|
-
if (contentList) {
|
|
31
|
-
contentList.push(...contentArr);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
// just in case the map already had some entries
|
|
35
|
-
fnMap.set(fn, contentArr);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.map.set(name, new Map([[fn, contentArr]]));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.DummyAppendProvider = DummyAppendProvider;
|
|
45
|
-
exports.defaultStatisticsFileSuffix = '.txt';
|
|
46
|
-
/**
|
|
47
|
-
* Provides cached open connections for all files to connect.
|
|
48
|
-
* allowing to append to the same file often.
|
|
49
|
-
* <p>
|
|
50
|
-
* While we could simply reopen these files, it is safer/more performant to keep the connection open.
|
|
51
|
-
*/
|
|
52
|
-
class StatisticFileProvider {
|
|
53
|
-
statisticsDirectory;
|
|
54
|
-
connections = new Map();
|
|
55
|
-
constructor(statisticsDirectory) {
|
|
56
|
-
(0, assert_1.guard)(statisticsDirectory !== undefined, 'Please supply an output directory!');
|
|
57
|
-
this.statisticsDirectory = statisticsDirectory;
|
|
58
|
-
// just to make sure, that they are closed
|
|
59
|
-
process.on('beforeExit', () => {
|
|
60
|
-
this.connections.forEach(fd => {
|
|
61
|
-
fs_1.default.closeSync(fd);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* @param name - the name of the feature {@link Feature#name}
|
|
67
|
-
* @param fn - the name of the feature-aspect to record
|
|
68
|
-
*/
|
|
69
|
-
statisticsFile(name, fn) {
|
|
70
|
-
return path_1.default.join(this.statisticsDirectory, name, `${fn}${exports.defaultStatisticsFileSuffix}`);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Append the given content to the information for a feature of the given name and function.
|
|
74
|
-
*/
|
|
75
|
-
append(name, fn, content) {
|
|
76
|
-
const descriptor = this.getHandle(name, String(fn));
|
|
77
|
-
fs_1.default.appendFileSync(descriptor, content + '\n', 'utf8');
|
|
78
|
-
}
|
|
79
|
-
getHandle(name, fn) {
|
|
80
|
-
const key = `${name}-${fn}`;
|
|
81
|
-
const fileHandle = this.connections.get(key);
|
|
82
|
-
if (fileHandle) {
|
|
83
|
-
return fileHandle;
|
|
84
|
-
}
|
|
85
|
-
// open the connection and ensure the location
|
|
86
|
-
const filepath = this.statisticsFile(name, String(fn));
|
|
87
|
-
const dirpath = path_1.default.dirname(filepath);
|
|
88
|
-
if (!fs_1.default.existsSync(dirpath)) {
|
|
89
|
-
fs_1.default.mkdirSync(dirpath, { recursive: true });
|
|
90
|
-
}
|
|
91
|
-
const fileDescriptor = fs_1.default.openSync(filepath, 'a');
|
|
92
|
-
this.connections.set(key, fileDescriptor);
|
|
93
|
-
return fileDescriptor;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.StatisticFileProvider = StatisticFileProvider;
|
|
97
|
-
//# sourceMappingURL=file-provider.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./print-stats"), exports);
|
|
18
|
-
__exportStar(require("./file-provider"), exports);
|
|
19
|
-
__exportStar(require("./statistics-file"), exports);
|
|
20
|
-
__exportStar(require("./ansi"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FeatureKey, FeatureStatistics } from '../features';
|
|
2
|
-
import type { MetaStatistics } from '../meta-statistics';
|
|
3
|
-
interface MinMaxAvgMedian {
|
|
4
|
-
sum: number;
|
|
5
|
-
min: number;
|
|
6
|
-
max: number;
|
|
7
|
-
avg: number;
|
|
8
|
-
median: number;
|
|
9
|
-
}
|
|
10
|
-
export declare function minMaxAvgAndMedian(data: number[]): MinMaxAvgMedian;
|
|
11
|
-
export declare function statsString(data: MinMaxAvgMedian, suffix?: string): string;
|
|
12
|
-
export declare function printFeatureStatistics(statistics: {
|
|
13
|
-
features: FeatureStatistics;
|
|
14
|
-
meta: MetaStatistics;
|
|
15
|
-
}, features?: 'all' | Set<FeatureKey>): void;
|
|
16
|
-
export declare function printFeatureStatisticsEntry(info: Record<string, unknown>): void;
|
|
17
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printFeatureStatisticsEntry = exports.printFeatureStatistics = exports.statsString = exports.minMaxAvgAndMedian = void 0;
|
|
4
|
-
const features_1 = require("../features");
|
|
5
|
-
const ansi_1 = require("./ansi");
|
|
6
|
-
const json_1 = require("../../util/json");
|
|
7
|
-
function minMaxAvgAndMedian(data) {
|
|
8
|
-
data = data.sort((a, b) => a - b);
|
|
9
|
-
const sum = data.reduce((a, b) => a + b, 0);
|
|
10
|
-
return {
|
|
11
|
-
sum,
|
|
12
|
-
min: data[0],
|
|
13
|
-
max: data[data.length - 1],
|
|
14
|
-
avg: sum / data.length,
|
|
15
|
-
median: data[Math.floor(data.length / 2)]
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
exports.minMaxAvgAndMedian = minMaxAvgAndMedian;
|
|
19
|
-
function formatStatNumber(num) {
|
|
20
|
-
return num === undefined ? '<?>' : Number(num.toFixed(3)).toLocaleString();
|
|
21
|
-
}
|
|
22
|
-
function statsString(data, suffix = '') {
|
|
23
|
-
return `[${formatStatNumber(data.min)}${suffix} .. ${formatStatNumber(data.max)}${suffix}] (avg: ${formatStatNumber(data.avg)}${suffix}, median: ${formatStatNumber(data.median)}${suffix})`;
|
|
24
|
-
}
|
|
25
|
-
exports.statsString = statsString;
|
|
26
|
-
function printFeatureStatistics(statistics, features = 'all') {
|
|
27
|
-
for (const feature of Object.keys(statistics.features)) {
|
|
28
|
-
if (features !== 'all' && !features.has(feature)) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const meta = features_1.ALL_FEATURES[feature];
|
|
32
|
-
console.log(`\n\n-----${meta.name}-------------`);
|
|
33
|
-
console.log(ansi_1.formatter.format(meta.description, { color: 7 /* Colors.White */, effect: ansi_1.ColorEffect.Foreground }));
|
|
34
|
-
printFeatureStatisticsEntry(statistics.features[feature]);
|
|
35
|
-
console.log('\n\n');
|
|
36
|
-
}
|
|
37
|
-
const linesPerFile = minMaxAvgAndMedian(statistics.meta.lines.map(l => l.length));
|
|
38
|
-
const lineLengths = minMaxAvgAndMedian(statistics.meta.lines.flat());
|
|
39
|
-
const processingTimesPerFile = minMaxAvgAndMedian(statistics.meta.processingTimeMs);
|
|
40
|
-
console.log(`processed ${statistics.meta.successfulParsed} files (skipped ${statistics.meta.failedRequests.length} due to errors):
|
|
41
|
-
\ttotal processing time: ${processingTimesPerFile.sum} ms
|
|
42
|
-
\t\tprocessing time range: ${statsString(processingTimesPerFile, ' ms')}
|
|
43
|
-
\ttotal number of lines: ${lineLengths.sum}
|
|
44
|
-
\t\tline range: ${statsString(linesPerFile)}
|
|
45
|
-
\t\tline length range: ${statsString(lineLengths, ' chars')}
|
|
46
|
-
`);
|
|
47
|
-
}
|
|
48
|
-
exports.printFeatureStatistics = printFeatureStatistics;
|
|
49
|
-
const pad = 3;
|
|
50
|
-
function printFeatureStatisticsEntry(info) {
|
|
51
|
-
let longestKey = 0;
|
|
52
|
-
let longestValue = 0;
|
|
53
|
-
const out = new Map();
|
|
54
|
-
for (const [key, value] of Object.entries(info)) {
|
|
55
|
-
if (key.length > longestKey) {
|
|
56
|
-
longestKey = key.length;
|
|
57
|
-
}
|
|
58
|
-
const valueString = JSON.stringify(value, json_1.jsonReplacer);
|
|
59
|
-
out.set(key, valueString);
|
|
60
|
-
if (valueString.length > longestValue) {
|
|
61
|
-
longestValue = valueString.length;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
for (const [key, value] of out.entries()) {
|
|
65
|
-
console.log(`${key.padEnd(longestKey + pad)} ${value.padStart(longestValue)}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.printFeatureStatisticsEntry = printFeatureStatisticsEntry;
|
|
69
|
-
//# sourceMappingURL=print-stats.js.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { DummyAppendMemoryMap, StatisticAppendProvider } from './file-provider';
|
|
2
|
-
/**
|
|
3
|
-
* Requires source information to be attached on parsing!
|
|
4
|
-
* <p>
|
|
5
|
-
* Returns the content of the node (i.e., the text content excluding the children)
|
|
6
|
-
*/
|
|
7
|
-
export declare function extractNodeContent(node: Node): string;
|
|
8
|
-
/** by default, we do not write to anything */
|
|
9
|
-
export declare let statisticsFileProvider: StatisticAppendProvider;
|
|
10
|
-
/**
|
|
11
|
-
* Make the statistics write to a given output directory.
|
|
12
|
-
*/
|
|
13
|
-
export declare function initFileProvider(outputDirectory: string): void;
|
|
14
|
-
/**
|
|
15
|
-
* Either ignore the statistics or write them to a given map (e.g., for testing).
|
|
16
|
-
*
|
|
17
|
-
* @param map - The map to write to, will not persist calls if no map is given
|
|
18
|
-
*/
|
|
19
|
-
export declare function initDummyFileProvider(map?: DummyAppendMemoryMap): void;
|
|
20
|
-
/**
|
|
21
|
-
* Format used to dump each entry of a feature during collection.
|
|
22
|
-
*/
|
|
23
|
-
export type StatisticsOutputFormat<T = string> = [
|
|
24
|
-
/** the collected value (like the assignment operator lexeme, ...) */
|
|
25
|
-
value: T,
|
|
26
|
-
/** the context of the information retrieval (e.g. the name of the file that contained the R source code) */
|
|
27
|
-
context: string | undefined
|
|
28
|
-
];
|
|
29
|
-
/**
|
|
30
|
-
* Append the content of all nodes to the storage file for the given feature
|
|
31
|
-
* @param name - The name of the feature {@link Feature#name}
|
|
32
|
-
* @param fn - The name of the feature-aspect to record
|
|
33
|
-
* @param nodes - The nodes to append, you may pass already transformed string contents
|
|
34
|
-
* @param context - The context of the information retrieval (e.g. the name of the file that contained the R source code)
|
|
35
|
-
* @param unique - Should duplicate entries be removed on addition
|
|
36
|
-
*/
|
|
37
|
-
export declare function appendStatisticsFile<T>(name: string, fn: keyof T, nodes: string[] | Node[] | object[], context: string | undefined, unique?: boolean): void;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.appendStatisticsFile = exports.initDummyFileProvider = exports.initFileProvider = exports.statisticsFileProvider = exports.extractNodeContent = void 0;
|
|
4
|
-
const file_provider_1 = require("./file-provider");
|
|
5
|
-
const log_1 = require("../../util/log");
|
|
6
|
-
/**
|
|
7
|
-
* Requires source information to be attached on parsing!
|
|
8
|
-
* <p>
|
|
9
|
-
* Returns the content of the node (i.e., the text content excluding the children)
|
|
10
|
-
*/
|
|
11
|
-
function extractNodeContent(node) {
|
|
12
|
-
let result = node.textContent;
|
|
13
|
-
if (node.hasChildNodes()) {
|
|
14
|
-
const firstChild = node.childNodes.item(0);
|
|
15
|
-
if (firstChild.nodeType === 3 /* text node */) {
|
|
16
|
-
result = firstChild.textContent;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return result?.trim()?.replaceAll('\n', '\\n') ?? '<unknown>';
|
|
20
|
-
}
|
|
21
|
-
exports.extractNodeContent = extractNodeContent;
|
|
22
|
-
initDummyFileProvider();
|
|
23
|
-
/**
|
|
24
|
-
* Make the statistics write to a given output directory.
|
|
25
|
-
*/
|
|
26
|
-
function initFileProvider(outputDirectory) {
|
|
27
|
-
log_1.log.debug(`Initializing file provider for output directory ${outputDirectory}`);
|
|
28
|
-
exports.statisticsFileProvider = new file_provider_1.StatisticFileProvider(outputDirectory);
|
|
29
|
-
}
|
|
30
|
-
exports.initFileProvider = initFileProvider;
|
|
31
|
-
/**
|
|
32
|
-
* Either ignore the statistics or write them to a given map (e.g., for testing).
|
|
33
|
-
*
|
|
34
|
-
* @param map - The map to write to, will not persist calls if no map is given
|
|
35
|
-
*/
|
|
36
|
-
function initDummyFileProvider(map) {
|
|
37
|
-
exports.statisticsFileProvider = new file_provider_1.DummyAppendProvider(map);
|
|
38
|
-
}
|
|
39
|
-
exports.initDummyFileProvider = initDummyFileProvider;
|
|
40
|
-
/**
|
|
41
|
-
* Append the content of all nodes to the storage file for the given feature
|
|
42
|
-
* @param name - The name of the feature {@link Feature#name}
|
|
43
|
-
* @param fn - The name of the feature-aspect to record
|
|
44
|
-
* @param nodes - The nodes to append, you may pass already transformed string contents
|
|
45
|
-
* @param context - The context of the information retrieval (e.g. the name of the file that contained the R source code)
|
|
46
|
-
* @param unique - Should duplicate entries be removed on addition
|
|
47
|
-
*/
|
|
48
|
-
function appendStatisticsFile(name, fn, nodes, context, unique = false) {
|
|
49
|
-
if (nodes.length === 0) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
let values;
|
|
53
|
-
if (typeof nodes[0] === 'string') {
|
|
54
|
-
values = nodes;
|
|
55
|
-
}
|
|
56
|
-
else if ('nodeType' in nodes[0]) {
|
|
57
|
-
values = nodes.map(extractNodeContent);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
values = nodes;
|
|
61
|
-
}
|
|
62
|
-
if (unique) {
|
|
63
|
-
values = [...new Set(values)];
|
|
64
|
-
}
|
|
65
|
-
values = values.map(value => JSON.stringify(context === undefined ? [value] : [value, context]));
|
|
66
|
-
exports.statisticsFileProvider.append(name, fn, values.join('\n'));
|
|
67
|
-
}
|
|
68
|
-
exports.appendStatisticsFile = appendStatisticsFile;
|
|
69
|
-
//# sourceMappingURL=statistics-file.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { RParseRequestFromFile, RParseRequestFromText, RShell } from '../r-bridge';
|
|
2
|
-
import type { FeatureSelection, FeatureStatistics } from './features';
|
|
3
|
-
import type { MetaStatistics } from './meta-statistics';
|
|
4
|
-
import type { StepResults } from '../core';
|
|
5
|
-
/**
|
|
6
|
-
* By default, {@link extractUsageStatistics} requires a generator, but sometimes you already know all the files
|
|
7
|
-
* that you want to process. This function simply reps your requests as a generator.
|
|
8
|
-
*/
|
|
9
|
-
export declare function staticRequests(...requests: (RParseRequestFromText | RParseRequestFromFile)[]): AsyncGenerator<RParseRequestFromText | RParseRequestFromFile>;
|
|
10
|
-
/**
|
|
11
|
-
* Extract all wanted statistic information from a set of requests using the presented R session.
|
|
12
|
-
*
|
|
13
|
-
* @param shell - The R session to use
|
|
14
|
-
* @param onRequest - A callback that is called at the beginning of each request, this may be used to debug the requests.
|
|
15
|
-
* @param features - The features to extract (see {@link allFeatureNames}).
|
|
16
|
-
* @param requests - The requests to extract the features from. May generate them on demand (e.g., by traversing a folder).
|
|
17
|
-
* If your request is statically known, you can use {@link staticRequests} to create this generator.
|
|
18
|
-
* @param rootPath - The root path to the project, this is used to relativize the file paths in the statistics.
|
|
19
|
-
*/
|
|
20
|
-
export declare function extractUsageStatistics<T extends RParseRequestFromText | RParseRequestFromFile>(shell: RShell, onRequest: (request: T) => void, features: FeatureSelection, requests: AsyncGenerator<T>, rootPath?: string): Promise<{
|
|
21
|
-
features: FeatureStatistics;
|
|
22
|
-
meta: MetaStatistics;
|
|
23
|
-
outputs: Map<T, StepResults<'dataflow'>>;
|
|
24
|
-
}>;
|
package/statistics/statistics.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractUsageStatistics = exports.staticRequests = void 0;
|
|
7
|
-
const features_1 = require("./features");
|
|
8
|
-
const xmldom_1 = require("@xmldom/xmldom");
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const log_1 = require("../util/log");
|
|
11
|
-
const meta_statistics_1 = require("./meta-statistics");
|
|
12
|
-
const core_1 = require("../core");
|
|
13
|
-
const json_1 = require("../util/json");
|
|
14
|
-
/**
|
|
15
|
-
* By default, {@link extractUsageStatistics} requires a generator, but sometimes you already know all the files
|
|
16
|
-
* that you want to process. This function simply reps your requests as a generator.
|
|
17
|
-
*/
|
|
18
|
-
function staticRequests(...requests) {
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
20
|
-
return async function* () {
|
|
21
|
-
for (const request of requests) {
|
|
22
|
-
yield request;
|
|
23
|
-
}
|
|
24
|
-
}();
|
|
25
|
-
}
|
|
26
|
-
exports.staticRequests = staticRequests;
|
|
27
|
-
/**
|
|
28
|
-
* Extract all wanted statistic information from a set of requests using the presented R session.
|
|
29
|
-
*
|
|
30
|
-
* @param shell - The R session to use
|
|
31
|
-
* @param onRequest - A callback that is called at the beginning of each request, this may be used to debug the requests.
|
|
32
|
-
* @param features - The features to extract (see {@link allFeatureNames}).
|
|
33
|
-
* @param requests - The requests to extract the features from. May generate them on demand (e.g., by traversing a folder).
|
|
34
|
-
* If your request is statically known, you can use {@link staticRequests} to create this generator.
|
|
35
|
-
* @param rootPath - The root path to the project, this is used to relativize the file paths in the statistics.
|
|
36
|
-
*/
|
|
37
|
-
async function extractUsageStatistics(shell, onRequest, features, requests, rootPath) {
|
|
38
|
-
let result = initializeFeatureStatistics();
|
|
39
|
-
const meta = (0, meta_statistics_1.initialMetaStatistics)();
|
|
40
|
-
let first = true;
|
|
41
|
-
const outputs = new Map();
|
|
42
|
-
for await (const request of requests) {
|
|
43
|
-
onRequest(request);
|
|
44
|
-
const start = performance.now();
|
|
45
|
-
const suffix = request.request === 'file' ? request.content.replace(new RegExp('^' + (rootPath ?? '')), '') : undefined;
|
|
46
|
-
try {
|
|
47
|
-
let output;
|
|
48
|
-
({ stats: result, output } = await extractSingle(result, shell, {
|
|
49
|
-
...request,
|
|
50
|
-
ensurePackageInstalled: first
|
|
51
|
-
}, features, suffix));
|
|
52
|
-
outputs.set(request, output);
|
|
53
|
-
processMetaOnSuccessful(meta, request);
|
|
54
|
-
meta.numberOfNormalizedNodes.push(output.normalize.idMap.size);
|
|
55
|
-
first = false;
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
log_1.log.error('for request: ', request, e);
|
|
59
|
-
processMetaOnUnsuccessful(meta, request);
|
|
60
|
-
}
|
|
61
|
-
meta.processingTimeMs.push(performance.now() - start);
|
|
62
|
-
}
|
|
63
|
-
return { features: result, meta, outputs };
|
|
64
|
-
}
|
|
65
|
-
exports.extractUsageStatistics = extractUsageStatistics;
|
|
66
|
-
function initializeFeatureStatistics() {
|
|
67
|
-
const result = {};
|
|
68
|
-
for (const key of features_1.allFeatureNames) {
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
70
|
-
result[key] = JSON.parse(JSON.stringify(features_1.ALL_FEATURES[key].initialValue, json_1.jsonReplacer), json_1.jsonRetriever);
|
|
71
|
-
}
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
function processMetaOnUnsuccessful(meta, request) {
|
|
75
|
-
meta.failedRequests.push(request);
|
|
76
|
-
}
|
|
77
|
-
function processMetaOnSuccessful(meta, request) {
|
|
78
|
-
meta.successfulParsed++;
|
|
79
|
-
if (request.request === 'text') {
|
|
80
|
-
meta.lines.push(request.content.split('\n').map(l => l.length));
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
meta.lines.push(fs_1.default.readFileSync(request.content, 'utf-8').split('\n').map(l => l.length));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const parser = new xmldom_1.DOMParser();
|
|
87
|
-
async function extractSingle(result, shell, request, features, suffixFilePath) {
|
|
88
|
-
const slicerOutput = await new core_1.SteppingSlicer({
|
|
89
|
-
stepOfInterest: 'dataflow',
|
|
90
|
-
request, shell
|
|
91
|
-
}).allRemainingSteps();
|
|
92
|
-
// await retrieveXmlFromRCode(from, shell)
|
|
93
|
-
const doc = parser.parseFromString(slicerOutput.parse, 'text/xml');
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
-
for (const [key, feature] of Object.entries(features_1.ALL_FEATURES)) {
|
|
96
|
-
if (features !== 'all' && !features.has(key)) {
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
100
|
-
result[key] = feature.process(result[key], {
|
|
101
|
-
parsedRAst: doc,
|
|
102
|
-
dataflow: slicerOutput.dataflow,
|
|
103
|
-
normalizedRAst: slicerOutput.normalize,
|
|
104
|
-
filepath: suffixFilePath
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return { stats: result, output: slicerOutput };
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=statistics.js.map
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.detectSummarizationType = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const log_1 = require("../log");
|
|
9
|
-
const summarizer_1 = require("./statistics/summarizer");
|
|
10
|
-
async function detectSummarizationType(inputPath) {
|
|
11
|
-
if (fs_1.default.statSync(inputPath).isFile()) {
|
|
12
|
-
log_1.log.info(`Detected benchmark summarization with single file ${inputPath}`);
|
|
13
|
-
return "benchmark" /* SummarizerType.Benchmark */;
|
|
14
|
-
}
|
|
15
|
-
// current heuristic: search for a tar.gz with two minus signs :D
|
|
16
|
-
const dir = await fs_1.default.promises.opendir(inputPath);
|
|
17
|
-
const thresholdInit = 60;
|
|
18
|
-
let threshold = thresholdInit;
|
|
19
|
-
for await (const dirent of dir) {
|
|
20
|
-
if (summarizer_1.statisticsFileNameRegex.test(dirent.name)) {
|
|
21
|
-
log_1.log.info(`Detected statistics summarization by file ${dirent.name} matching ${summarizer_1.statisticsFileNameRegex.source}`);
|
|
22
|
-
return "statistics" /* SummarizerType.Statistics */;
|
|
23
|
-
}
|
|
24
|
-
else if (threshold-- < 0) {
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
log_1.log.info(`Detected benchmark summarization with no file (first ${thresholdInit}) matching ${summarizer_1.statisticsFileNameRegex.source}`);
|
|
29
|
-
return "benchmark" /* SummarizerType.Benchmark */;
|
|
30
|
-
}
|
|
31
|
-
exports.detectSummarizationType = detectSummarizationType;
|
|
32
|
-
//# sourceMappingURL=auto-detect.js.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { CommonSlicerMeasurements, PerSliceMeasurements, SlicerStats, SlicerStatsDataflow, SlicerStatsInput } from '../../../benchmark';
|
|
2
|
-
export interface SummarizedMeasurement<T = number> {
|
|
3
|
-
min: T;
|
|
4
|
-
max: T;
|
|
5
|
-
median: T;
|
|
6
|
-
/** total may be useless for some measurements, especially if they are weighted before (it is just the sum...)*/
|
|
7
|
-
total: T;
|
|
8
|
-
/** average */
|
|
9
|
-
mean: number;
|
|
10
|
-
/** standard deviation */
|
|
11
|
-
std: number;
|
|
12
|
-
}
|
|
13
|
-
export declare function summarizedMeasurement2Csv(a: SummarizedMeasurement): string;
|
|
14
|
-
export declare function summarizedMeasurement2CsvHeader(prefix?: string): string;
|
|
15
|
-
export interface SliceSizeCollection {
|
|
16
|
-
lines: number[];
|
|
17
|
-
characters: number[];
|
|
18
|
-
nonWhitespaceCharacters: number[];
|
|
19
|
-
/** like library statements during reconstruction */
|
|
20
|
-
autoSelected: number[];
|
|
21
|
-
dataflowNodes: number[];
|
|
22
|
-
tokens: number[];
|
|
23
|
-
normalizedTokens: number[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @see SlicerStats
|
|
27
|
-
* @see summarizeSlicerStats
|
|
28
|
-
*/
|
|
29
|
-
export type SummarizedSlicerStats = {
|
|
30
|
-
perSliceMeasurements: SummarizedPerSliceStats;
|
|
31
|
-
} & Omit<SlicerStats, 'perSliceMeasurements'>;
|
|
32
|
-
export interface Reduction<T = number> {
|
|
33
|
-
numberOfLines: T;
|
|
34
|
-
numberOfLinesNoAutoSelection: T;
|
|
35
|
-
numberOfCharacters: T;
|
|
36
|
-
numberOfNonWhitespaceCharacters: T;
|
|
37
|
-
numberOfRTokens: T;
|
|
38
|
-
numberOfNormalizedTokens: T;
|
|
39
|
-
numberOfDataflowNodes: T;
|
|
40
|
-
}
|
|
41
|
-
export interface SummarizedPerSliceStats {
|
|
42
|
-
/** number of total slicing calls */
|
|
43
|
-
numberOfSlices: number;
|
|
44
|
-
/** statistics on the used slicing criteria (number of ids within criteria etc.) */
|
|
45
|
-
sliceCriteriaSizes: SummarizedMeasurement;
|
|
46
|
-
measurements: Map<PerSliceMeasurements, SummarizedMeasurement>;
|
|
47
|
-
reduction: Reduction<SummarizedMeasurement>;
|
|
48
|
-
failedToRepParse: number;
|
|
49
|
-
timesHitThreshold: number;
|
|
50
|
-
sliceSize: {
|
|
51
|
-
[K in keyof SliceSizeCollection]: SummarizedMeasurement;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
export interface UltimateSlicerStats {
|
|
55
|
-
totalRequests: number;
|
|
56
|
-
totalSlices: number;
|
|
57
|
-
commonMeasurements: Map<CommonSlicerMeasurements, SummarizedMeasurement>;
|
|
58
|
-
perSliceMeasurements: Map<PerSliceMeasurements, SummarizedMeasurement>;
|
|
59
|
-
/** sum */
|
|
60
|
-
failedToRepParse: number;
|
|
61
|
-
/** sum */
|
|
62
|
-
timesHitThreshold: number;
|
|
63
|
-
reduction: Reduction<SummarizedMeasurement>;
|
|
64
|
-
input: SlicerStatsInput<SummarizedMeasurement>;
|
|
65
|
-
dataflow: SlicerStatsDataflow<SummarizedMeasurement>;
|
|
66
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.summarizedMeasurement2CsvHeader = exports.summarizedMeasurement2Csv = void 0;
|
|
4
|
-
function summarizedMeasurement2Csv(a) {
|
|
5
|
-
return `${a.min},${a.max},${a.median},${a.mean},${a.std},${a.total}`;
|
|
6
|
-
}
|
|
7
|
-
exports.summarizedMeasurement2Csv = summarizedMeasurement2Csv;
|
|
8
|
-
const summarizedKeys = ['min', 'max', 'median', 'mean', 'std', 'total'];
|
|
9
|
-
function summarizedMeasurement2CsvHeader(prefix) {
|
|
10
|
-
return summarizedKeys.map(k => prefix ? `${prefix}-${k}` : k).join(',');
|
|
11
|
-
}
|
|
12
|
-
exports.summarizedMeasurement2CsvHeader = summarizedMeasurement2CsvHeader;
|
|
13
|
-
//# sourceMappingURL=data.js.map
|