Created
January 12, 2026 10:25
-
-
Save Albert26193/b1f244358e451bb6bdd5384a6b44d45d to your computer and use it in GitHub Desktop.
makefile for cpu in k8s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get cpu info for docker/k8s container env | |
| BUILD_JOBS ?= | |
| ifeq ($(BUILD_JOBS),) | |
| BUILD_JOBS := $(shell nproc) | |
| ifeq ($(shell test -d /sys/fs/cgroup/cpu && echo 1),1) | |
| CPU_QUOTA := $(shell cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us) | |
| CPU_PERIOD := $(shell cat /sys/fs/cgroup/cpu/cpu.cfs_period_us) | |
| ifneq ($(CPU_QUOTA),-1) | |
| BUILD_JOBS := $(shell expr $(CPU_QUOTA) / $(CPU_PERIOD)) | |
| endif | |
| endif | |
| endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment