blob: 669e707b575ffce5e64b90e048f92142009b9a65 [file] [log] [blame]
# Copyright 2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ['get_cpu_count']
def get_cpu_count():
"""
Try to obtain the number of CPUs available.
@return: Number of CPUs or None if unable to obtain.
"""
try:
import multiprocessing
return multiprocessing.cpu_count()
except (ImportError, NotImplementedError):
return None