Commit 96056d9
committed
Report distinct variable values observed in TLC coverage statistics.
These statistics show the number of unique values each variable takes
during model checking. An unusually high number of values for a
particular variable may suggest that the model is not properly
constrained, potentially leading to state space explosion during
exhaustive analysis.
Note I: The data structure used to estimate these counts is
probabilistic—specifically, HyperLogLog—which helps minimize memory
usage. As a result, the reported counts may have a small margin of
error. Additionally, the use of this structure introduces contention
among workers, which can negatively affect performance and scalability.
However, empirical measurements (see
tlaplus#1183 (comment))
have shown that the performance overhead of variable statistics
collection on top of action and ordinary coverage is negligible.
Note II: The `TLC!TLCGet("spec")` named register equals the same data
and serves as a more appropriate and structured input for extracting
and parsing these numeric values during subsequent processing stages:
```tla
---- MODULE Spec ----
EXTENDS TLC, Json
...
MyStats ==
PrintT(
ToJson( \* Alternatively, see CSV!CSVWrite operator.
{
[name |-> v.name, count |-> v.coverage.distinct]
: v \in TLCGet("spec").variables
}
)
)
====
---- CONFIG Spec ----
...
_PERIODIC MyStats
POSTCONDITION MyStats
====
```
Variable statistics can be enabled independently of the `-coverage
someTime` option by setting the Java system property
`-Dtlc2.TLCGlobals.coverage=2` when running TLC. To activate both action
and variable statistics, use `-Dtlc2.TLCGlobals.coverage=3`.
[Feature][TLC]
Signed-off-by: Markus Alexander Kuppe <github.com@lemmster.de>1 parent 96778df commit 96056d9
4 files changed
Lines changed: 49 additions & 19 deletions
File tree
- docs
- tlatools/org.lamport.tlatools/src/tlc2
- output
- tool/coverage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
61 | | - | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
77 | | - | |
| 81 | + | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| |||
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| 103 | + | |
99 | 104 | | |
100 | 105 | | |
101 | 106 | | |
| |||
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
114 | | - | |
| 119 | + | |
115 | 120 | | |
116 | 121 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | | - | |
| 296 | + | |
| 297 | + | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1172 | 1175 | | |
1173 | 1176 | | |
1174 | 1177 | | |
| |||
Lines changed: 34 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
428 | 430 | | |
429 | 431 | | |
430 | 432 | | |
431 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
432 | 465 | | |
433 | 466 | | |
434 | 467 | | |
| |||
495 | 528 | | |
496 | 529 | | |
497 | 530 | | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | 531 | | |
511 | 532 | | |
0 commit comments