@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
package/benchmark/slicer.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides a top-level slicer that can be used to slice code *and* retrieve stats.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import type { NormalizedAst, RParseRequestFromFile, RParseRequestFromText } from '../r-bridge';
|
|
6
|
-
import type { DataflowInformation } from '../dataflow/internal/info';
|
|
7
|
-
import type { SlicingCriteria, SlicingCriteriaFilter, SliceResult, ReconstructionResult } from '../slicing';
|
|
8
|
-
import type { PerSliceStats, SlicerStats } from './stats';
|
|
9
|
-
import type { MergeableRecord } from '../util/objects';
|
|
10
|
-
export declare const benchmarkLogger: import("tslog").Logger<import("tslog").ILogObj>;
|
|
11
|
-
/**
|
|
12
|
-
* Returns the stats but also the result of all setup steps (parsing, normalization, and the dataflow analysis) during the slicing.
|
|
13
|
-
* This is useful for debugging and visualizing the slicing process.
|
|
14
|
-
*/
|
|
15
|
-
export interface BenchmarkSlicerStats extends MergeableRecord {
|
|
16
|
-
/** the measurements obtained during the benchmark */
|
|
17
|
-
stats: SlicerStats;
|
|
18
|
-
/** the used token map when translating what was parsed from R */
|
|
19
|
-
tokenMap: Record<string, string>;
|
|
20
|
-
/** the initial and unmodified AST produced by the R side/the 'parse' step */
|
|
21
|
-
parse: string;
|
|
22
|
-
/** the normalized AST produced by the 'normalization' step, including its parent decoration */
|
|
23
|
-
normalize: NormalizedAst;
|
|
24
|
-
/** the dataflow graph produced by the 'dataflow' step */
|
|
25
|
-
dataflow: DataflowInformation;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Additionally to {@link BenchmarkSlicerStats}, this contains the results of a *single* slice.
|
|
29
|
-
* In other words, it holds the results of the slice and reconstruct steps.
|
|
30
|
-
*/
|
|
31
|
-
export interface BenchmarkSingleSliceStats extends MergeableRecord {
|
|
32
|
-
/** the measurements obtained during the single slice */
|
|
33
|
-
stats: PerSliceStats;
|
|
34
|
-
/** the result of the 'slice' step */
|
|
35
|
-
slice: SliceResult;
|
|
36
|
-
/** the final code, as the result of the 'reconstruct' step */
|
|
37
|
-
code: ReconstructionResult;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A slicer that can be used to slice exactly one file (multiple times).
|
|
41
|
-
* It holds its own {@link RShell} instance, maintains a cached dataflow and keeps measurements.
|
|
42
|
-
*
|
|
43
|
-
* Make sure to call {@link init} to initialize the slicer, before calling {@link slice}.
|
|
44
|
-
* After slicing, call {@link finish} to close the R session and retrieve the stats.
|
|
45
|
-
*
|
|
46
|
-
* @note Under the hood, the benchmark slicer maintains a {@link SteppingSlicer}.
|
|
47
|
-
*/
|
|
48
|
-
export declare class BenchmarkSlicer {
|
|
49
|
-
/** Measures all data that is recorded *once* per slicer (complete setup up to the dataflow graph creation) */
|
|
50
|
-
private readonly commonMeasurements;
|
|
51
|
-
private readonly perSliceMeasurements;
|
|
52
|
-
private readonly shell;
|
|
53
|
-
private stats;
|
|
54
|
-
private loadedXml;
|
|
55
|
-
private tokenMap;
|
|
56
|
-
private dataflow;
|
|
57
|
-
private ai;
|
|
58
|
-
private normalizedAst;
|
|
59
|
-
private totalStopwatch;
|
|
60
|
-
private finished;
|
|
61
|
-
private stepper;
|
|
62
|
-
constructor();
|
|
63
|
-
/**
|
|
64
|
-
* Initialize the slicer on the given request.
|
|
65
|
-
* Can only be called once for each instance.
|
|
66
|
-
*/
|
|
67
|
-
init(request: RParseRequestFromFile | RParseRequestFromText): Promise<void>;
|
|
68
|
-
private calculateStatsAfterInit;
|
|
69
|
-
/**
|
|
70
|
-
* Slice for the given {@link SlicingCriteria}.
|
|
71
|
-
* @see SingleSlicingCriterion
|
|
72
|
-
*
|
|
73
|
-
* @returns The per slice stats retrieved for this slicing criteria
|
|
74
|
-
*/
|
|
75
|
-
slice(...slicingCriteria: SlicingCriteria): Promise<BenchmarkSingleSliceStats>;
|
|
76
|
-
/** Bridging the gap between the new internal and the old names for the benchmarking */
|
|
77
|
-
private measureCommonStep;
|
|
78
|
-
private measureSliceStep;
|
|
79
|
-
private guardActive;
|
|
80
|
-
/**
|
|
81
|
-
* Call {@link slice} for all slicing criteria that match the given filter.
|
|
82
|
-
* See {@link collectAllSlicingCriteria} for details.
|
|
83
|
-
* <p>
|
|
84
|
-
* the `report` function will be called *before* each individual slice is performed.
|
|
85
|
-
*
|
|
86
|
-
* @returns The number of slices that were produced
|
|
87
|
-
*
|
|
88
|
-
* @see collectAllSlicingCriteria
|
|
89
|
-
* @see SlicingCriteriaFilter
|
|
90
|
-
*/
|
|
91
|
-
sliceForAll(filter: SlicingCriteriaFilter, report?: (current: number, total: number, allCriteria: SlicingCriteria[]) => void): Promise<number>;
|
|
92
|
-
/**
|
|
93
|
-
* Retrieves the final stats and closes the shell session.
|
|
94
|
-
* Can be called multiple times to retrieve the stored stats, but will only close the session once (the first time).
|
|
95
|
-
*/
|
|
96
|
-
finish(): BenchmarkSlicerStats;
|
|
97
|
-
/**
|
|
98
|
-
* Only call in case of an error - if the session must be closed and the benchmark itself is to be considered failed/dead.
|
|
99
|
-
*/
|
|
100
|
-
ensureSessionClosed(): void;
|
|
101
|
-
}
|
package/benchmark/slicer.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Provides a top-level slicer that can be used to slice code *and* retrieve stats.
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.BenchmarkSlicer = exports.benchmarkLogger = void 0;
|
|
11
|
-
const r_bridge_1 = require("../r-bridge");
|
|
12
|
-
const stopwatch_1 = require("./stopwatch");
|
|
13
|
-
const assert_1 = require("../util/assert");
|
|
14
|
-
const slicing_1 = require("../slicing");
|
|
15
|
-
const fs_1 = __importDefault(require("fs"));
|
|
16
|
-
const log_1 = require("../util/log");
|
|
17
|
-
const core_1 = require("../core");
|
|
18
|
-
const strings_1 = require("../util/strings");
|
|
19
|
-
exports.benchmarkLogger = log_1.log.getSubLogger({ name: 'benchmark' });
|
|
20
|
-
/**
|
|
21
|
-
* A slicer that can be used to slice exactly one file (multiple times).
|
|
22
|
-
* It holds its own {@link RShell} instance, maintains a cached dataflow and keeps measurements.
|
|
23
|
-
*
|
|
24
|
-
* Make sure to call {@link init} to initialize the slicer, before calling {@link slice}.
|
|
25
|
-
* After slicing, call {@link finish} to close the R session and retrieve the stats.
|
|
26
|
-
*
|
|
27
|
-
* @note Under the hood, the benchmark slicer maintains a {@link SteppingSlicer}.
|
|
28
|
-
*/
|
|
29
|
-
class BenchmarkSlicer {
|
|
30
|
-
/** Measures all data that is recorded *once* per slicer (complete setup up to the dataflow graph creation) */
|
|
31
|
-
commonMeasurements = new stopwatch_1.Measurements();
|
|
32
|
-
perSliceMeasurements = new Map;
|
|
33
|
-
shell;
|
|
34
|
-
stats;
|
|
35
|
-
loadedXml;
|
|
36
|
-
tokenMap;
|
|
37
|
-
dataflow;
|
|
38
|
-
ai;
|
|
39
|
-
normalizedAst;
|
|
40
|
-
totalStopwatch;
|
|
41
|
-
finished = false;
|
|
42
|
-
// Yes this is dirty, but we know that we assign the stepper during the initialization and this saves us from having to check for nullability every time
|
|
43
|
-
stepper = null;
|
|
44
|
-
constructor() {
|
|
45
|
-
this.totalStopwatch = this.commonMeasurements.start('total');
|
|
46
|
-
this.shell = this.commonMeasurements.measure('initialize R session', () => new r_bridge_1.RShell());
|
|
47
|
-
this.commonMeasurements.measure('inject home path', () => this.shell.tryToInjectHomeLibPath());
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Initialize the slicer on the given request.
|
|
51
|
-
* Can only be called once for each instance.
|
|
52
|
-
*/
|
|
53
|
-
async init(request) {
|
|
54
|
-
(0, assert_1.guard)(this.stats === undefined, 'cannot initialize the slicer twice');
|
|
55
|
-
await this.commonMeasurements.measureAsync('ensure installation of xmlparsedata', () => this.shell.ensurePackageInstalled('xmlparsedata', true));
|
|
56
|
-
this.tokenMap = await this.commonMeasurements.measureAsync('retrieve token map',
|
|
57
|
-
// with this being the first time, there is no preexisting caching!
|
|
58
|
-
() => this.shell.tokenMap());
|
|
59
|
-
this.stepper = new core_1.SteppingSlicer({
|
|
60
|
-
shell: this.shell,
|
|
61
|
-
request: {
|
|
62
|
-
...request,
|
|
63
|
-
ensurePackageInstalled: true
|
|
64
|
-
},
|
|
65
|
-
stepOfInterest: core_1.LAST_STEP,
|
|
66
|
-
criterion: [],
|
|
67
|
-
tokenMap: this.tokenMap
|
|
68
|
-
});
|
|
69
|
-
this.loadedXml = await this.measureCommonStep('parse', 'retrieve AST from R code');
|
|
70
|
-
this.normalizedAst = await this.measureCommonStep('normalize', 'normalize R AST');
|
|
71
|
-
this.dataflow = await this.measureCommonStep('dataflow', 'produce dataflow information');
|
|
72
|
-
this.ai = await this.measureCommonStep('ai', 'run abstract interpretation');
|
|
73
|
-
this.stepper.switchToSliceStage();
|
|
74
|
-
await this.calculateStatsAfterInit(request);
|
|
75
|
-
}
|
|
76
|
-
async calculateStatsAfterInit(request) {
|
|
77
|
-
const loadedContent = request.request === 'text' ? request.content : fs_1.default.readFileSync(request.content, 'utf-8');
|
|
78
|
-
// retrieve number of R tokens - flowr_parsed should still contain the last parsed code
|
|
79
|
-
const numberOfRTokens = await (0, r_bridge_1.retrieveNumberOfRTokensOfLastParse)(this.shell);
|
|
80
|
-
(0, assert_1.guard)(this.normalizedAst !== undefined, 'normalizedAst should be defined after initialization');
|
|
81
|
-
(0, assert_1.guard)(this.dataflow !== undefined, 'dataflow should be defined after initialization');
|
|
82
|
-
// collect dataflow graph size
|
|
83
|
-
const vertices = [...this.dataflow.graph.vertices(true)];
|
|
84
|
-
let numberOfEdges = 0;
|
|
85
|
-
let numberOfCalls = 0;
|
|
86
|
-
let numberOfDefinitions = 0;
|
|
87
|
-
for (const [n, info] of vertices) {
|
|
88
|
-
const outgoingEdges = this.dataflow.graph.outgoingEdges(n);
|
|
89
|
-
numberOfEdges += outgoingEdges?.size ?? 0;
|
|
90
|
-
if (info.tag === 'function-call') {
|
|
91
|
-
numberOfCalls++;
|
|
92
|
-
}
|
|
93
|
-
else if (info.tag === 'function-definition') {
|
|
94
|
-
numberOfDefinitions++;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
this.stats = {
|
|
98
|
-
commonMeasurements: new Map(),
|
|
99
|
-
perSliceMeasurements: this.perSliceMeasurements,
|
|
100
|
-
request,
|
|
101
|
-
input: {
|
|
102
|
-
numberOfLines: loadedContent.split('\n').length,
|
|
103
|
-
numberOfCharacters: loadedContent.length,
|
|
104
|
-
numberOfNonWhitespaceCharacters: (0, strings_1.withoutWhitespace)(loadedContent).length,
|
|
105
|
-
numberOfRTokens: numberOfRTokens,
|
|
106
|
-
numberOfNormalizedTokens: [...(0, r_bridge_1.collectAllIds)(this.normalizedAst.ast)].length
|
|
107
|
-
},
|
|
108
|
-
dataflow: {
|
|
109
|
-
numberOfNodes: [...this.dataflow.graph.vertices(true)].length,
|
|
110
|
-
numberOfEdges: numberOfEdges,
|
|
111
|
-
numberOfCalls: numberOfCalls,
|
|
112
|
-
numberOfFunctionDefinitions: numberOfDefinitions
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Slice for the given {@link SlicingCriteria}.
|
|
118
|
-
* @see SingleSlicingCriterion
|
|
119
|
-
*
|
|
120
|
-
* @returns The per slice stats retrieved for this slicing criteria
|
|
121
|
-
*/
|
|
122
|
-
async slice(...slicingCriteria) {
|
|
123
|
-
exports.benchmarkLogger.trace(`try to slice for criteria ${JSON.stringify(slicingCriteria)}`);
|
|
124
|
-
this.guardActive();
|
|
125
|
-
(0, assert_1.guard)(!this.perSliceMeasurements.has(slicingCriteria), 'do not slice the same criteria combination twice');
|
|
126
|
-
const measurements = new stopwatch_1.Measurements();
|
|
127
|
-
const stats = {
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
129
|
-
measurements: undefined,
|
|
130
|
-
slicingCriteria: [],
|
|
131
|
-
numberOfDataflowNodesSliced: 0,
|
|
132
|
-
timesHitThreshold: 0,
|
|
133
|
-
reconstructedCode: {
|
|
134
|
-
code: '',
|
|
135
|
-
autoSelected: 0
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
this.perSliceMeasurements.set(slicingCriteria, stats);
|
|
139
|
-
this.stepper.updateCriterion(slicingCriteria);
|
|
140
|
-
const totalStopwatch = measurements.start('total');
|
|
141
|
-
const slicedOutput = await this.measureSliceStep('slice', measurements, 'static slicing');
|
|
142
|
-
stats.slicingCriteria = slicedOutput.decodedCriteria;
|
|
143
|
-
stats.reconstructedCode = await this.measureSliceStep('reconstruct', measurements, 'reconstruct code');
|
|
144
|
-
totalStopwatch.stop();
|
|
145
|
-
exports.benchmarkLogger.debug(`Produced code for ${JSON.stringify(slicingCriteria)}: ${stats.reconstructedCode.code}`);
|
|
146
|
-
const results = this.stepper.getResults(false);
|
|
147
|
-
if (exports.benchmarkLogger.settings.minLevel >= 3 /* LogLevel.Info */) {
|
|
148
|
-
exports.benchmarkLogger.info(`mapped slicing criteria: ${slicedOutput.decodedCriteria.map(c => {
|
|
149
|
-
const node = results.normalize.idMap.get(c.id);
|
|
150
|
-
return `\n- id: ${c.id}, location: ${JSON.stringify(node?.location)}, lexeme: ${JSON.stringify(node?.lexeme)}`;
|
|
151
|
-
}).join('')}`);
|
|
152
|
-
}
|
|
153
|
-
// if it is not in the dataflow graph it was kept to be safe and should not count to the included nodes
|
|
154
|
-
stats.numberOfDataflowNodesSliced = [...slicedOutput.result].filter(id => results.dataflow.graph.hasNode(id, false)).length;
|
|
155
|
-
stats.timesHitThreshold = slicedOutput.timesHitThreshold;
|
|
156
|
-
stats.measurements = measurements.get();
|
|
157
|
-
return {
|
|
158
|
-
stats,
|
|
159
|
-
slice: slicedOutput,
|
|
160
|
-
code: stats.reconstructedCode
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
/** Bridging the gap between the new internal and the old names for the benchmarking */
|
|
164
|
-
async measureCommonStep(expectedStep, keyToMeasure) {
|
|
165
|
-
const { result } = await this.commonMeasurements.measureAsync(keyToMeasure, () => this.stepper.nextStep(expectedStep));
|
|
166
|
-
return result;
|
|
167
|
-
}
|
|
168
|
-
async measureSliceStep(expectedStep, measure, keyToMeasure) {
|
|
169
|
-
const { result } = await measure.measureAsync(keyToMeasure, () => this.stepper.nextStep(expectedStep));
|
|
170
|
-
return result;
|
|
171
|
-
}
|
|
172
|
-
guardActive() {
|
|
173
|
-
(0, assert_1.guard)(this.stats !== undefined && !this.finished, 'need to call init before, and can not do after finish!');
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Call {@link slice} for all slicing criteria that match the given filter.
|
|
177
|
-
* See {@link collectAllSlicingCriteria} for details.
|
|
178
|
-
* <p>
|
|
179
|
-
* the `report` function will be called *before* each individual slice is performed.
|
|
180
|
-
*
|
|
181
|
-
* @returns The number of slices that were produced
|
|
182
|
-
*
|
|
183
|
-
* @see collectAllSlicingCriteria
|
|
184
|
-
* @see SlicingCriteriaFilter
|
|
185
|
-
*/
|
|
186
|
-
async sliceForAll(filter, report = () => { }) {
|
|
187
|
-
this.guardActive();
|
|
188
|
-
let count = 0;
|
|
189
|
-
const allCriteria = [...(0, slicing_1.collectAllSlicingCriteria)(this.normalizedAst.ast, filter)];
|
|
190
|
-
for (const slicingCriteria of allCriteria) {
|
|
191
|
-
report(count, allCriteria.length, allCriteria);
|
|
192
|
-
await this.slice(...slicingCriteria);
|
|
193
|
-
count++;
|
|
194
|
-
}
|
|
195
|
-
return count;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Retrieves the final stats and closes the shell session.
|
|
199
|
-
* Can be called multiple times to retrieve the stored stats, but will only close the session once (the first time).
|
|
200
|
-
*/
|
|
201
|
-
finish() {
|
|
202
|
-
(0, assert_1.guard)(this.stats !== undefined, 'need to call init before finish');
|
|
203
|
-
if (!this.finished) {
|
|
204
|
-
this.commonMeasurements.measure('close R session', () => this.shell.close());
|
|
205
|
-
this.totalStopwatch.stop();
|
|
206
|
-
this.finished = true;
|
|
207
|
-
}
|
|
208
|
-
this.stats.commonMeasurements = this.commonMeasurements.get();
|
|
209
|
-
return {
|
|
210
|
-
stats: this.stats,
|
|
211
|
-
parse: this.loadedXml,
|
|
212
|
-
dataflow: this.dataflow,
|
|
213
|
-
normalize: this.normalizedAst,
|
|
214
|
-
tokenMap: this.tokenMap,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Only call in case of an error - if the session must be closed and the benchmark itself is to be considered failed/dead.
|
|
219
|
-
*/
|
|
220
|
-
ensureSessionClosed() {
|
|
221
|
-
this.shell.close();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
exports.BenchmarkSlicer = BenchmarkSlicer;
|
|
225
|
-
//# sourceMappingURL=slicer.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './print';
|
|
2
|
-
export * from './stats';
|
|
3
|
-
export * from '../../util/summarizer/benchmark/summarizer';
|
|
4
|
-
export { UltimateSlicerStats } from '../../util/summarizer/benchmark/data';
|
|
5
|
-
export { SummarizedPerSliceStats } from '../../util/summarizer/benchmark/data';
|
|
6
|
-
export { Reduction } from '../../util/summarizer/benchmark/data';
|
|
7
|
-
export { SummarizedSlicerStats } from '../../util/summarizer/benchmark/data';
|
|
8
|
-
export { summarizeSummarizedMeasurement } from '../../util/summarizer/benchmark/first-phase/process';
|
|
9
|
-
export { summarizeMeasurement } from '../../util/summarizer/benchmark/first-phase/process';
|
|
10
|
-
export { summarizeSlicerStats } from '../../util/summarizer/benchmark/first-phase/process';
|
package/benchmark/stats/index.js
DELETED
|
@@ -1,27 +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
|
-
exports.summarizeSlicerStats = exports.summarizeMeasurement = exports.summarizeSummarizedMeasurement = void 0;
|
|
18
|
-
__exportStar(require("./print"), exports);
|
|
19
|
-
__exportStar(require("./stats"), exports);
|
|
20
|
-
__exportStar(require("../../util/summarizer/benchmark/summarizer"), exports);
|
|
21
|
-
var process_1 = require("../../util/summarizer/benchmark/first-phase/process");
|
|
22
|
-
Object.defineProperty(exports, "summarizeSummarizedMeasurement", { enumerable: true, get: function () { return process_1.summarizeSummarizedMeasurement; } });
|
|
23
|
-
var process_2 = require("../../util/summarizer/benchmark/first-phase/process");
|
|
24
|
-
Object.defineProperty(exports, "summarizeMeasurement", { enumerable: true, get: function () { return process_2.summarizeMeasurement; } });
|
|
25
|
-
var process_3 = require("../../util/summarizer/benchmark/first-phase/process");
|
|
26
|
-
Object.defineProperty(exports, "summarizeSlicerStats", { enumerable: true, get: function () { return process_3.summarizeSlicerStats; } });
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SummarizedSlicerStats, UltimateSlicerStats } from '../../util/summarizer/benchmark/data';
|
|
2
|
-
/**
|
|
3
|
-
* Converts the given stats to a human-readable string.
|
|
4
|
-
* You may have to {@link summarizeSlicerStats | summarize} the stats first.
|
|
5
|
-
*/
|
|
6
|
-
export declare function stats2string(stats: SummarizedSlicerStats): string;
|
|
7
|
-
export declare function ultimateStats2String(stats: UltimateSlicerStats): string;
|
package/benchmark/stats/print.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ultimateStats2String = exports.stats2string = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* This module is tasked with processing the results of the benchmarking (see {@link SummarizedSlicerStats}).
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
const assert_1 = require("../../util/assert");
|
|
9
|
-
const padSize = 15;
|
|
10
|
-
function pad(string) {
|
|
11
|
-
return String(string).padStart(padSize, ' ');
|
|
12
|
-
}
|
|
13
|
-
function divWithRest(dividend, divisor) {
|
|
14
|
-
return [dividend / divisor, dividend % divisor];
|
|
15
|
-
}
|
|
16
|
-
function formatNanoseconds(nanoseconds) {
|
|
17
|
-
if (nanoseconds < 0) {
|
|
18
|
-
return '??';
|
|
19
|
-
}
|
|
20
|
-
const [seconds, rest] = divWithRest(typeof nanoseconds === 'number' ? BigInt(Math.round(nanoseconds)) : nanoseconds, BigInt(1e9));
|
|
21
|
-
const [milliseconds, remainingNanoseconds] = divWithRest(rest, BigInt(1e6));
|
|
22
|
-
const secondsStr = seconds > 0 ? `${String(seconds).padStart(2, '0')}.` : '';
|
|
23
|
-
const millisecondsStr = seconds > 0 ? `${String(milliseconds).padStart(3, '0')}:` : `${String(milliseconds)}:`;
|
|
24
|
-
const nanoStr = String(remainingNanoseconds).padEnd(3, '0').substring(0, 3);
|
|
25
|
-
const unit = seconds === 0n ? 'ms' : ' s'; /* space for padding */
|
|
26
|
-
return pad(`${secondsStr}${millisecondsStr}${nanoStr}${unit}`);
|
|
27
|
-
}
|
|
28
|
-
function print(measurements, key) {
|
|
29
|
-
const time = measurements.get(key);
|
|
30
|
-
(0, assert_1.guard)(time !== undefined, `Measurement for ${JSON.stringify(key)} not found`);
|
|
31
|
-
return formatNanoseconds(time);
|
|
32
|
-
}
|
|
33
|
-
function formatSummarizedTimeMeasure(measure) {
|
|
34
|
-
if (measure === undefined) {
|
|
35
|
-
return '??';
|
|
36
|
-
}
|
|
37
|
-
return `${formatNanoseconds(measure.min)} - ${formatNanoseconds(measure.max)} (median: ${formatNanoseconds(measure.median)}, mean: ${formatNanoseconds(measure.mean)}, std: ${formatNanoseconds(measure.std)})`;
|
|
38
|
-
}
|
|
39
|
-
function roundTo(num, digits = 4) {
|
|
40
|
-
const factor = Math.pow(10, digits);
|
|
41
|
-
return Math.round(num * factor) / factor;
|
|
42
|
-
}
|
|
43
|
-
function asPercentage(num) {
|
|
44
|
-
if (isNaN(num)) {
|
|
45
|
-
return '??%';
|
|
46
|
-
}
|
|
47
|
-
return pad(`${roundTo(num * 100, 3)}%`);
|
|
48
|
-
}
|
|
49
|
-
function asFloat(num) {
|
|
50
|
-
return pad(roundTo(num));
|
|
51
|
-
}
|
|
52
|
-
function formatSummarizedMeasure(measure, fmt = asFloat) {
|
|
53
|
-
if (measure === undefined) {
|
|
54
|
-
return '??';
|
|
55
|
-
}
|
|
56
|
-
return `${fmt(measure.min)} - ${fmt(measure.max)} (median: ${fmt(measure.median)}, mean: ${fmt(measure.mean)}, std: ${fmt(measure.std)})`;
|
|
57
|
-
}
|
|
58
|
-
function printSummarizedMeasurements(stats, key) {
|
|
59
|
-
const measure = stats.measurements.get(key);
|
|
60
|
-
(0, assert_1.guard)(measure !== undefined, `Measurement for ${JSON.stringify(key)} not found`);
|
|
61
|
-
return formatSummarizedTimeMeasure(measure);
|
|
62
|
-
}
|
|
63
|
-
function printCountSummarizedMeasurements(stats) {
|
|
64
|
-
const range = `${stats.min} - ${stats.max}`.padStart(padSize, ' ');
|
|
65
|
-
return `${range} (median: ${stats.median}, mean: ${stats.mean}, std: ${stats.std})`;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Converts the given stats to a human-readable string.
|
|
69
|
-
* You may have to {@link summarizeSlicerStats | summarize} the stats first.
|
|
70
|
-
*/
|
|
71
|
-
function stats2string(stats) {
|
|
72
|
-
let result = `
|
|
73
|
-
Request: ${JSON.stringify(stats.request)}
|
|
74
|
-
Shell init time: ${print(stats.commonMeasurements, 'initialize R session')}
|
|
75
|
-
Retrieval of token map: ${print(stats.commonMeasurements, 'retrieve token map')}
|
|
76
|
-
AST retrieval: ${print(stats.commonMeasurements, 'retrieve AST from R code')}
|
|
77
|
-
AST normalization: ${print(stats.commonMeasurements, 'normalize R AST')}
|
|
78
|
-
Dataflow creation: ${print(stats.commonMeasurements, 'produce dataflow information')}
|
|
79
|
-
|
|
80
|
-
Slicing summary for ${stats.perSliceMeasurements.numberOfSlices} slice${stats.perSliceMeasurements.numberOfSlices !== 1 ? 's' : ''}:`;
|
|
81
|
-
if (stats.perSliceMeasurements.numberOfSlices > 0) {
|
|
82
|
-
result += `
|
|
83
|
-
Total: ${printSummarizedMeasurements(stats.perSliceMeasurements, 'total')}
|
|
84
|
-
Slice creation: ${printSummarizedMeasurements(stats.perSliceMeasurements, 'static slicing')}
|
|
85
|
-
Reconstruction: ${printSummarizedMeasurements(stats.perSliceMeasurements, 'reconstruct code')}
|
|
86
|
-
Used Slice Criteria Sizes: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceCriteriaSizes)}
|
|
87
|
-
Result Slice Sizes:
|
|
88
|
-
Number of lines: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceSize.lines)}
|
|
89
|
-
Number of characters: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceSize.characters)}
|
|
90
|
-
Number of non whitespace characters: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceSize.nonWhitespaceCharacters)}
|
|
91
|
-
Number of auto selected: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceSize.autoSelected)}
|
|
92
|
-
Number of R tokens: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceSize.tokens)}
|
|
93
|
-
Normalized R tokens: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceSize.normalizedTokens)}
|
|
94
|
-
Number of dataflow nodes: ${printCountSummarizedMeasurements(stats.perSliceMeasurements.sliceSize.dataflowNodes)}
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
return `${result}
|
|
98
|
-
Shell close: ${print(stats.commonMeasurements, 'close R session')}
|
|
99
|
-
Total: ${print(stats.commonMeasurements, 'total')}
|
|
100
|
-
|
|
101
|
-
Input:
|
|
102
|
-
Number of lines: ${pad(stats.input.numberOfLines)}
|
|
103
|
-
Number of characters: ${pad(stats.input.numberOfCharacters)}
|
|
104
|
-
Number of non whitespace characters: ${pad(stats.input.numberOfNonWhitespaceCharacters)}
|
|
105
|
-
Number of tokens: ${pad(stats.input.numberOfRTokens)}
|
|
106
|
-
Normalized R tokens: ${pad(stats.input.numberOfNormalizedTokens)}
|
|
107
|
-
|
|
108
|
-
Dataflow:
|
|
109
|
-
Number of nodes: ${pad(stats.dataflow.numberOfNodes)}
|
|
110
|
-
Number of edges: ${pad(stats.dataflow.numberOfEdges)}
|
|
111
|
-
Number of calls: ${pad(stats.dataflow.numberOfCalls)}
|
|
112
|
-
Number of function defs: ${pad(stats.dataflow.numberOfFunctionDefinitions)}`;
|
|
113
|
-
}
|
|
114
|
-
exports.stats2string = stats2string;
|
|
115
|
-
function ultimateStats2String(stats) {
|
|
116
|
-
// Used Slice Criteria Sizes: ${formatSummarizedMeasure(stats.perSliceMeasurements.sliceCriteriaSizes)}
|
|
117
|
-
return `
|
|
118
|
-
Summarized: ${stats.totalRequests} requests and ${stats.totalSlices} slices
|
|
119
|
-
Shell init time: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('initialize R session'))}
|
|
120
|
-
Retrieval of token map: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('retrieve token map'))}
|
|
121
|
-
AST retrieval: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('retrieve AST from R code'))}
|
|
122
|
-
AST normalization: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('normalize R AST'))}
|
|
123
|
-
Dataflow creation: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('produce dataflow information'))}
|
|
124
|
-
|
|
125
|
-
Slice summary for:
|
|
126
|
-
Total: ${formatSummarizedTimeMeasure(stats.perSliceMeasurements.get('total'))}
|
|
127
|
-
Slice creation: ${formatSummarizedTimeMeasure(stats.perSliceMeasurements.get('static slicing'))}
|
|
128
|
-
Reconstruction: ${formatSummarizedTimeMeasure(stats.perSliceMeasurements.get('reconstruct code'))}
|
|
129
|
-
Failed to Re-Parse: ${pad(stats.failedToRepParse)}/${stats.totalSlices}
|
|
130
|
-
Times hit Threshold: ${pad(stats.timesHitThreshold)}/${stats.totalSlices}
|
|
131
|
-
Reductions (reduced by x%):
|
|
132
|
-
Number of lines: ${formatSummarizedMeasure(stats.reduction.numberOfLines, asPercentage)}
|
|
133
|
-
Number of lines no auto: ${formatSummarizedMeasure(stats.reduction.numberOfLinesNoAutoSelection, asPercentage)}
|
|
134
|
-
Number of characters: ${formatSummarizedMeasure(stats.reduction.numberOfCharacters, asPercentage)}
|
|
135
|
-
Number of non whitespace characters: ${formatSummarizedMeasure(stats.reduction.numberOfNonWhitespaceCharacters, asPercentage)}
|
|
136
|
-
Number of R tokens: ${formatSummarizedMeasure(stats.reduction.numberOfRTokens, asPercentage)}
|
|
137
|
-
Normalized R tokens: ${formatSummarizedMeasure(stats.reduction.numberOfNormalizedTokens, asPercentage)}
|
|
138
|
-
Number of dataflow nodes: ${formatSummarizedMeasure(stats.reduction.numberOfDataflowNodes, asPercentage)}
|
|
139
|
-
|
|
140
|
-
Shell close: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('close R session'))}
|
|
141
|
-
Total: ${formatSummarizedTimeMeasure(stats.commonMeasurements.get('total'))}
|
|
142
|
-
|
|
143
|
-
Input:
|
|
144
|
-
Number of lines: ${formatSummarizedMeasure(stats.input.numberOfLines)}
|
|
145
|
-
Number of characters: ${formatSummarizedMeasure(stats.input.numberOfCharacters)}
|
|
146
|
-
Number of non whitespace characters: ${formatSummarizedMeasure(stats.input.numberOfNonWhitespaceCharacters)}
|
|
147
|
-
Number of tokens: ${formatSummarizedMeasure(stats.input.numberOfRTokens)}
|
|
148
|
-
Normalized R tokens: ${formatSummarizedMeasure(stats.input.numberOfNormalizedTokens)}
|
|
149
|
-
|
|
150
|
-
Dataflow:
|
|
151
|
-
Number of nodes: ${formatSummarizedMeasure(stats.dataflow.numberOfNodes)}
|
|
152
|
-
Number of edges: ${formatSummarizedMeasure(stats.dataflow.numberOfEdges)}
|
|
153
|
-
Number of calls: ${formatSummarizedMeasure(stats.dataflow.numberOfCalls)}
|
|
154
|
-
Number of function defs: ${formatSummarizedMeasure(stats.dataflow.numberOfFunctionDefinitions)}`;
|
|
155
|
-
}
|
|
156
|
-
exports.ultimateStats2String = ultimateStats2String;
|
|
157
|
-
//# sourceMappingURL=print.js.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { SingleSlicingCriterion, SlicingCriteria } from '../../slicing';
|
|
2
|
-
import type { NodeId, RParseRequestFromFile, RParseRequestFromText } from '../../r-bridge';
|
|
3
|
-
import type { ReconstructionResult } from '../../slicing';
|
|
4
|
-
export declare const CommonSlicerMeasurements: readonly ["initialize R session", "inject home path", "ensure installation of xmlparsedata", "retrieve token map", "retrieve AST from R code", "normalize R AST", "produce dataflow information", "run abstract interpretation", "close R session", "total"];
|
|
5
|
-
export type CommonSlicerMeasurements = typeof CommonSlicerMeasurements[number];
|
|
6
|
-
export declare const PerSliceMeasurements: readonly ["static slicing", "reconstruct code", "total"];
|
|
7
|
-
export type PerSliceMeasurements = typeof PerSliceMeasurements[number];
|
|
8
|
-
export type ElapsedTime = bigint;
|
|
9
|
-
export interface PerSliceStats {
|
|
10
|
-
measurements: Map<PerSliceMeasurements, ElapsedTime>;
|
|
11
|
-
slicingCriteria: {
|
|
12
|
-
criterion: SingleSlicingCriterion;
|
|
13
|
-
id: NodeId;
|
|
14
|
-
}[];
|
|
15
|
-
reconstructedCode: ReconstructionResult;
|
|
16
|
-
numberOfDataflowNodesSliced: number;
|
|
17
|
-
timesHitThreshold: number;
|
|
18
|
-
}
|
|
19
|
-
export interface SlicerStatsInput<T = number> {
|
|
20
|
-
numberOfLines: T;
|
|
21
|
-
numberOfCharacters: T;
|
|
22
|
-
numberOfNonWhitespaceCharacters: T;
|
|
23
|
-
numberOfRTokens: T;
|
|
24
|
-
numberOfNormalizedTokens: T;
|
|
25
|
-
}
|
|
26
|
-
export interface SlicerStatsDataflow<T = number> {
|
|
27
|
-
numberOfNodes: T;
|
|
28
|
-
numberOfEdges: T;
|
|
29
|
-
numberOfCalls: T;
|
|
30
|
-
numberOfFunctionDefinitions: T;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* The statistics that are collected by the {@link BenchmarkSlicer} and used for benchmarking.
|
|
34
|
-
*/
|
|
35
|
-
export interface SlicerStats {
|
|
36
|
-
commonMeasurements: Map<CommonSlicerMeasurements, ElapsedTime>;
|
|
37
|
-
perSliceMeasurements: Map<SlicingCriteria, PerSliceStats>;
|
|
38
|
-
request: RParseRequestFromFile | RParseRequestFromText;
|
|
39
|
-
input: SlicerStatsInput;
|
|
40
|
-
dataflow: SlicerStatsDataflow;
|
|
41
|
-
}
|
package/benchmark/stats/stats.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PerSliceMeasurements = exports.CommonSlicerMeasurements = void 0;
|
|
4
|
-
exports.CommonSlicerMeasurements = ['initialize R session', 'inject home path', 'ensure installation of xmlparsedata', 'retrieve token map', 'retrieve AST from R code', 'normalize R AST', 'produce dataflow information', 'run abstract interpretation', 'close R session', 'total'];
|
|
5
|
-
exports.PerSliceMeasurements = ['static slicing', 'reconstruct code', 'total'];
|
|
6
|
-
//# sourceMappingURL=stats.js.map
|
package/benchmark/stopwatch.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface IStoppableStopwatch {
|
|
2
|
-
/** Stop the given stopwatch. */
|
|
3
|
-
stop(): void;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Allows to measure keys of type `T` with a `Stopwatch`.
|
|
7
|
-
*
|
|
8
|
-
* Measure with {@link start}, {@link measure} or {@link measureAsync}, retrieve the final measurements with {@link get}.
|
|
9
|
-
*/
|
|
10
|
-
export declare class Measurements<T> {
|
|
11
|
-
private measurements;
|
|
12
|
-
/**
|
|
13
|
-
* Start a timer for the given key, and guards that this is the first time this key is started.
|
|
14
|
-
* Call {@link IStoppableStopwatch#stop} on the returned stopwatch to stop the timer.
|
|
15
|
-
*/
|
|
16
|
-
start(key: T): IStoppableStopwatch;
|
|
17
|
-
/**
|
|
18
|
-
* Automatically call {@link Measurements#start | start} and the corresponding stop to measure the execution time of the given function.
|
|
19
|
-
* @see {@link measureAsync}
|
|
20
|
-
*/
|
|
21
|
-
measure<Out>(key: T, fn: () => Out): Out;
|
|
22
|
-
/**
|
|
23
|
-
* Similar to {@link measure}, but await the promise as part of the measurement
|
|
24
|
-
*
|
|
25
|
-
* @param key - The key to write the resulting measurement to
|
|
26
|
-
* @param fn - The function to measure
|
|
27
|
-
*
|
|
28
|
-
* @see measure
|
|
29
|
-
*/
|
|
30
|
-
measureAsync<Out>(key: T, fn: () => Promise<Out>): Promise<Out>;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieve all measure-results, requires that all stop-watches that have been started have also been stopped.
|
|
33
|
-
*/
|
|
34
|
-
get(): Map<T, bigint>;
|
|
35
|
-
}
|