YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
injector.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <atomic>
4#include <cstdint>
5
6namespace yaclib::detail {
7
8// TODO(myannyax) Add metrics, refactor this shit
10 public:
11 void MaybeInject() noexcept;
12
13 std::uint32_t GetState() const noexcept;
14
15 void SetState(std::uint32_t state) noexcept;
16
17 void Disable() noexcept;
18
19 void Enable() noexcept;
20
21 static void SetFrequency(std::uint32_t freq) noexcept;
22 static void SetSleepTime(std::uint32_t ns) noexcept;
23
24 static std::uint32_t GetSleepTime() noexcept;
25
26 static std::uint64_t GetInjectedCount() noexcept;
27
28 private:
29 bool NeedInject() noexcept;
30 void Reset() noexcept;
31
32 std::atomic_uint32_t _count{0};
33 bool _pause{false};
34};
35
36} // namespace yaclib::detail
std::uint32_t GetState() const noexcept
Definition injector.cpp:57
void SetState(std::uint32_t state) noexcept
Definition injector.cpp:61
void Disable() noexcept
Definition injector.cpp:65
static void SetSleepTime(std::uint32_t ns) noexcept
Definition injector.cpp:45
static std::uint32_t GetSleepTime() noexcept
Definition injector.cpp:49
static std::uint64_t GetInjectedCount() noexcept
Definition injector.cpp:53
void MaybeInject() noexcept
Definition injector.cpp:13
void Enable() noexcept
Definition injector.cpp:69
static void SetFrequency(std::uint32_t freq) noexcept
Definition injector.cpp:41
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25