blktrace: Use number of online CPUs

Currently, blktrace uses _SC_NPROCESSORS_CONF to find out the number of
CPUs.  This is a problem, because if you reduce the number of online
CPUs by passing kernel parameter maxcpus, then blktrace fails to start
with the error:

FAILED to start thread on CPU 4: 22/Invalid argument
FAILED to start thread on CPU 5: 22/Invalid argument

The attached patch fixes it to use _SC_NPROCESSORS_ONLN.

Signed-off-by: Jens Axboe <>
3 files changed