SHTK_HW_CPUS(3)
π» SHTK_HW_CPUS(3) π»
okay bestie, welcome to SHTK_HW_CPUS(3) β this one lives in the Library Functions Manual and it's here to help you count CPU threads like a total icon. π
πΈ NAME πΈ
shtk_hw_ncpus β queries the number of CPUs (threads) in the machine. fr fr, that's the whole assignment. β¨
π LIBRARY π
You pull this in with:
shtk_import hw
β¨ SYNOPSIS β¨
shtk_hw_ncpus
π DESCRIPTION π
okay so shtk_hw_ncpus goes and asks the machine how many CPU threads it has, then prints the total number to stdout. lowkey useful, highkey slay. π₯
If the query fails, or if the function does not know how to get the number from the current operating system, it prints 1. no cap, that's the fallback. π«Ά
π₯ RETURN VALUES π₯
shtk_hw_ncpus returns 0. periodt. π
π¦ EXAMPLES π¦
bestie, here's the iconic make moment:
make -j"$(shtk_hw_ncpus)" all
π ENVIRONMENT π
SHTK_HW_NCPUSβ if set to a number greater than zero, overrides the return value ofshtk_hw_ncpus. Generally useful for testing purposes, but can also be useful to inject greater numbers of parallelism in applications that do not expose a mechanism to tune such number. π
π SEE ALSO π
shtk(3), shtk_hw(3) π
π§ HISTORY π§
shtk_hw_ncpus first appeared in shtk 1.7. iconic behavior, honestly. π
mwah π this lil page is from Debian, dated February 6, 2017, and its footer tag is SHTK_HW_CPUS(3). π
π¦ where this page comes from
- nixos 26.05: shtk 1.7
- nixpkgs unstable: shtk 1.7
- Copyright 2017 Google Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms