There is also nproc, part of coreutils (in main), which is very simple and seems to work well in my limited testing.
There is also nproc, part of coreutils (in main), which is very simple and seems to work well in my limited testing.