YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
config.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace yaclib {
6
7/**
8 * Sets frequency with which fault will be injected.
9 * Default is 16.
10 */
11void SetFaultFrequency(std::uint32_t freq) noexcept;
12
13/**
14 * Sets seed for random, which will be used when deciding when to yield, for fibers scheduler and random wrapper for
15 * tests. Default is 1239.
16 */
17void SetSeed(std::uint32_t seed) noexcept;
18
19/**
20 * Sets sleep time if sleep is used instead of yield for interrupting thread execution for fault injection.
21 * Default is 200
22 */
23void SetFaultSleepTime(std::uint32_t ns) noexcept;
24
25std::uint32_t GetFaultSleepTime() noexcept;
26
27/**
28 * Sets frequency with which compare_exchange_weak would fail.
29 * Default is 13
30 */
31void SetAtomicFailFrequency(std::uint32_t k) noexcept;
32
33namespace fiber {
34
35/**
36 * Sets the amount of time to be added to fiber's scheduler time after each schedule cycle.
37 * Default is 10
38 */
39void SetFaultTickLength(std::uint32_t ns) noexcept;
40
41/**
42 * Sets the length of scheduler queue prefix and suffix from which the next schedule candidate will be chosen.
43 * Default is 10.
44 */
45void SetFaultRandomListPick(std::uint32_t k) noexcept;
46
47/**
48 * Sets fiber stack size for fault injection in pages.
49 * Default is 8.
50 */
51void SetStackSize(std::uint32_t pages) noexcept;
52
53/**
54 * Sets fiber stack cache size for fault injection.
55 * Default is 100.
56 */
57void SetStackCacheSize(std::uint32_t c) noexcept;
58
59/**
60 * Sets hardware_concurrency in fiber based execution.
61 * Default equals to std::thread::hardware_concurrency.
62 */
63void SetHardwareConcurrency(std::uint32_t c) noexcept;
64
65/**
66 * @return current random count for fiber-based execution
67 */
68std::uint64_t GetFaultRandomCount() noexcept;
69
70/**
71 * Forwards random count for fiber-based execution to supplied one
72 */
73void ForwardToFaultRandomCount(std::uint64_t random_count) noexcept;
74
75/**
76 * @return current injector state
77 */
78std::uint32_t GetInjectorState() noexcept;
79
80/**
81 * Sets injector state to the supplied one
82 */
83void SetInjectorState(std::uint32_t state) noexcept;
84
85} // namespace fiber
86} // namespace yaclib
void ForwardToFaultRandomCount(std::uint64_t random_count) noexcept
Forwards random count for fiber-based execution to supplied one.
Definition config.cpp:73
std::uint32_t GetInjectorState() noexcept
Definition config.cpp:77
void SetFaultTickLength(std::uint32_t ns) noexcept
Sets the amount of time to be added to fiber's scheduler time after each schedule cycle.
Definition config.cpp:39
void SetHardwareConcurrency(std::uint32_t c) noexcept
Sets hardware_concurrency in fiber based execution.
Definition config.cpp:63
void SetStackCacheSize(std::uint32_t c) noexcept
Sets fiber stack cache size for fault injection.
Definition config.cpp:57
void SetFaultRandomListPick(std::uint32_t k) noexcept
Sets the length of scheduler queue prefix and suffix from which the next schedule candidate will be c...
Definition config.cpp:45
void SetInjectorState(std::uint32_t state) noexcept
Sets injector state to the supplied one.
Definition config.cpp:85
void SetStackSize(std::uint32_t pages) noexcept
Sets fiber stack size for fault injection in pages.
Definition config.cpp:51
std::uint64_t GetFaultRandomCount() noexcept
Definition config.cpp:69
void SetSeed(std::uint32_t seed) noexcept
Sets seed for random, which will be used when deciding when to yield, for fibers scheduler and random...
Definition config.cpp:33
void SetAtomicFailFrequency(std::uint32_t k) noexcept
Sets frequency with which compare_exchange_weak would fail.
Definition config.cpp:27
void SetFaultSleepTime(std::uint32_t ns) noexcept
Sets sleep time if sleep is used instead of yield for interrupting thread execution for fault injecti...
Definition config.cpp:19
void SetFaultFrequency(std::uint32_t freq) noexcept
Sets frequency with which fault will be injected.
Definition config.cpp:15
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25
std::uint32_t GetFaultSleepTime() noexcept
Definition config.cpp:23