mCRL2
|
class for time complexity checks More...
#include <check_complexity.h>
Classes | |
class | B_to_C_counter_t |
counters for a B_to_C slice More... | |
class | BLC_gj_counter_t |
class | block_bunch_dnj_counter_t |
class | block_counter_t |
counters for a block More... | |
class | block_dnj_counter_t |
class | block_gj_counter_t |
class | bunch_dnj_counter_t |
class | counter_t |
subset of counters (to be associated with a state or transition) More... | |
class | state_counter_t |
class | state_dnj_counter_t |
class | state_gj_counter_t |
class | trans_counter_t |
class | trans_dnj_counter_t |
class | trans_gj_counter_t |
Static Public Member Functions | |
static int | ilog2 (state_type size) |
calculate the base-2 logarithm, rounded down | |
static void | wait (trans_type units=1) |
do some work that cannot be assigned directly | |
static void | check_waiting_cycles () |
static void | check_temporary_work () |
check that not too much superfluous work has been done | |
static void | init (state_type n) |
starts counting for a new refinement run | |
static void | print_grand_totals () |
print grand total of work in the coroutines (to measure overhead) | |
Static Public Attributes | |
static unsigned char | log_n = '\0' |
value of floor(log2(n)) for easy access | |
static const char * | work_names [TRANS_gj_MAX - BLOCK_MIN+1] |
printable names of the counter types (for error messages) | |
Static Private Member Functions | |
static void | finalise_work_units (trans_type units=1) |
static void | cancel_work_units (trans_type units=1) |
Static Private Attributes | |
static signed_trans_type | sensible_work = 0 |
counter to register the work balance for coroutines | |
static trans_type | no_of_waiting_cycles = 0 |
the number of waiting cycles that have been done in the current accounting period | |
static bool | cannot_wait_before_reset = false |
indicates whether waiting cycles are allowed | |
static trans_type | sensible_work_grand_total = 0 |
the number of useful steps in the course of the whole algorithm | |
static trans_type | cancelled_work_grand_total = 0 |
the number of cancelled steps (in aborted coroutines) in the course of the whole algorithm | |
static trans_type | no_of_waiting_cycles_grand_total = 0 |
the number of waiting cycles in the course of the whole algorithm | |
class for time complexity checks
The class stores (as static members) the global counters needed for checking time complexity budgets.
It could almost be defined as a namespace because all members are static. Still, just a few members are private.
Definition at line 137 of file check_complexity.h.
Type for complexity budget counters.
The enumeration constants defined by this type are used to distinguish the many counters that the time budget check uses. There are counters assigned to blocks, states, B_to_C slices, and transitions. Counters assigned to a block are regarded as if the work would be registered with every state in the block. Counters assigned to a B_to_C slice are regarded as if the work would be registered with every transition in the slice. (These conventions are important when splitting a block or a B_to_C slice.)
Definition at line 149 of file check_complexity.h.
Enumerator | |
---|---|
complexity_ok | |
complexity_print | |
complexity_error |
Definition at line 464 of file check_complexity.h.
|
inlinestaticprivate |
Definition at line 562 of file check_complexity.h.
|
inlinestatic |
check that not too much superfluous work has been done
After having moved all temporary work counters to the normal counters, this function can be used to ensure that not too much temporary work is cancelled.
Definition at line 575 of file check_complexity.h.
|
inlinestatic |
Definition at line 543 of file check_complexity.h.
|
inlinestaticprivate |
Definition at line 554 of file check_complexity.h.
|
inlinestatic |
calculate the base-2 logarithm, rounded down
The function cannot be constexpr because std::log2() may have the side effect of setting errno
.
Definition at line 479 of file check_complexity.h.
|
inlinestatic |
starts counting for a new refinement run
Before any work can be counted, init()
should be called to set the size of the state space to the appropriate value.
n | size of the state space |
Definition at line 1858 of file check_complexity.h.
|
inlinestatic |
print grand total of work in the coroutines (to measure overhead)
Definition at line 1878 of file check_complexity.h.
|
inlinestatic |
do some work that cannot be assigned directly
This is meant for a coroutine that has nothing to do currently; in particular, it cannot do sensible work on a state or transition.
Definition at line 534 of file check_complexity.h.
|
staticprivate |
the number of cancelled steps (in aborted coroutines) in the course of the whole algorithm
Definition at line 521 of file check_complexity.h.
|
staticprivate |
indicates whether waiting cycles are allowed
During finalising all counters of an accounting period, there is a point when waiting cycles are measured (by calling the function check_waiting_cycles()
); from that moment until the balance is reset (using check_temporary_work()
) one cannot insert waiting cycles. This boolean is used to check for the restriction.
Definition at line 518 of file check_complexity.h.
|
static |
value of floor(log2(n)) for easy access
binary logarithm of the state space size, rounded down
This variable has to be set by init()
before counting work can begin.
Definition at line 474 of file check_complexity.h.
|
staticprivate |
the number of waiting cycles that have been done in the current accounting period
After finalising all counters of an accounting period, the number of waiting cycles should not exceed the sensible work. However, in contrast to cancelled work, it is not subtracted from the balance.
Definition at line 517 of file check_complexity.h.
|
staticprivate |
the number of waiting cycles in the course of the whole algorithm
Definition at line 522 of file check_complexity.h.
|
staticprivate |
counter to register the work balance for coroutines
the number of useful steps in the last refinement
Sensible work will be counted positively, and cancelled work negatively.
Definition at line 516 of file check_complexity.h.
|
staticprivate |
the number of useful steps in the course of the whole algorithm
Definition at line 520 of file check_complexity.h.
|
static |
printable names of the counter types (for error messages)
names for complexity counters
Every complexity counter (defined in check_complexity.h) corresponds to a loop in one of the places of the algorithm. Here, an English description of that place is given, together with the line number in the pseudocode in the article [Groote/Jansen/Keiren/Wijs: An O(m log n) algorithm for computing stuttering equivalence and branching bisimulation. Accepted for publication in ACM TOCL 2017].
Definition at line 527 of file check_complexity.h.