userver: utils::StreamingCpuRelax Class Reference
No Matches
utils::StreamingCpuRelax Class Reference

#include <userver/utils/cpu_relax.hpp>

Detailed Description

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

Constructor & Destructor Documentation

◆ StreamingCpuRelax()

utils::StreamingCpuRelax::StreamingCpuRelax ( std::uint64_t check_time_after_bytes,
tracing::ScopeTime * scope )
check_time_after_bytesnumber of bytes to call yield
scopethe tracing::ScopeTime to pause when yielding, if any
The ScopeTime must live at least as long as the CpuRelax

Member Function Documentation

◆ GetBytesProcessed()

std::uint64_t utils::StreamingCpuRelax::GetBytesProcessed ( ) const

Returns the total amount of bytes processed since the creation of StreamingCpuRelax

◆ Relax()

void utils::StreamingCpuRelax::Relax ( std::uint64_t bytes_processed)

Checks time and potentially calls engine::Yield() each check_time_after_bytes bytes

The documentation for this class was generated from the following file: