#include <userver/utils/cpu_relax.hpp>
Utility to yield in a CPU-bound data processing task to give other tasks an opportunity to get CPU time
Definition at line 54 of file cpu_relax.hpp.
Public Member Functions | |
StreamingCpuRelax (std::uint64_t check_time_after_bytes, tracing::ScopeTime *scope) | |
void | Relax (std::uint64_t bytes_processed) |
std::uint64_t | GetBytesProcessed () const |
|
explicit |
check_time_after_bytes | number of bytes to call yield |
scope | the tracing::ScopeTime to pause when yielding, if any |
ScopeTime
must live at least as long as the CpuRelax
std::uint64_t utils::StreamingCpuRelax::GetBytesProcessed | ( | ) | const |
Returns the total amount of bytes processed since the creation of StreamingCpuRelax
void utils::StreamingCpuRelax::Relax | ( | std::uint64_t | bytes_processed | ) |
Checks time and potentially calls engine::Yield()
each check_time_after_bytes
bytes