userver: hostinfo Namespace Reference
Loading...
Searching...
No Matches
hostinfo Namespace Reference

Detailed Description

Information about current host.

Namespaces

namespace  blocking
 Blocking functions for getting information about hosts.
 

Functions

std::optional< double > CpuLimit ()
 Returns the CPU limit.
 
bool IsInRtc ()
 Returns true if the current process is run in container (CPU_LIMIT environment variable is set).
 

Function Documentation

◆ CpuLimit()

std::optional< double > hostinfo::CpuLimit ( )

Returns the CPU limit.

Unlike nproc and std::thread::hardware_concurrency this method considers container limits and may return fractional values.

Uses:

  • CPU_LIMIT environment variable (example: CPU_LIMIT=1.95c).