userver: hostinfo Namespace Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
hostinfo Namespace Reference

Information about current host. More...

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).
 

Detailed Description

Information about current host.

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).