Support linux cgroup resource limit
In Linux container environment, it should report the cpu and memory limit instead of the host machine's total cpu and memory. Golang has similar library handling this https://github.com/uber-go/automaxprocs.
You mean if the linux is running in a container environment or if a specific program is running in a container environment? Because in the second case, I can add an option to switch from one state to another but it seems good as is for me.
A program running in a container environment, users use this library may want to adjust the resources allocated according to the system info retrieved. For example, adjust the thread pool count and cache size, when in container environment, these needs to be the cgroup cpu/memory limit.
Note we do not yet read CPU limits
Best to keep this issue open then.
I'm thinking about contributing cgroups CPU limits. In my target environment I found that the set of available cores is not limited (Cpus_allowed_list in /proc/self/status is the full range of cores) even if you are limited by the CPU quota to < 100% of 1 core. What should sysinfo report in this case? Should we add something like "effective number of cores" that is a float?
@GuillaumeGomez
I honestly have no idea. What are the other tools doing in such a situation?