Class anira::Budget#

class Budget#

The inference budget of a Hard contract: measured by default, as the C contract’s (Hard{.host_block_min = 512, .host_block_max = 512, .host_rate = 48000} prepares with the budget the warm-up pass measures), explicit from a duration (.budget = 5ms), as the web package’s budgetMs. A std::chrono duration converts to an explicit budget (ANIRA_BUDGET_EXPLICIT with that figure, anira_contract_hard_set_budget); a default-constructed Budget, Budget::measured(), is the budget the warm-up pass measures at prepare (ANIRA_BUDGET_MEASURED). The warm-up pass also measures the inference time; a measured budget is the maximum of its last four inferences; under an explicit budget the timings are only reported. An explicit budget gives a reproducible latency, a measured one a latency that depends on the machine.

Public Functions

inline Budget() noexcept#

The measured budget, the C contract’s default (Budget::measured()).

template<class Rep, class Period>
inline Budget(std::chrono::duration<Rep, Period> value) noexcept#

An explicit budget of value per inference.

inline anira_budget_kind kind() const noexcept#
inline std::chrono::nanoseconds value() const noexcept#

The explicit figure; 0 for a measured budget.

bool operator==(const Budget &other) const noexcept = default#

Public Static Functions

static inline Budget measured() noexcept#

The budget the warm-up pass measures at prepare: the slowest plan’s figure.