aboutsummaryrefslogtreecommitdiff
blob: 669e707b575ffce5e64b90e048f92142009b9a65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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