MCPcopy Create free account
hub / github.com/EasyIME/PIME / cpu_count

Function cpu_count

python/python3/tornado/process.py:48–61  ·  view source on GitHub ↗

Returns the number of processors on this machine.

()

Source from the content-addressed store, hash-verified

46
47
48def cpu_count() -> int:
49 """Returns the number of processors on this machine."""
50 if multiprocessing is None:
51 return 1
52 try:
53 return multiprocessing.cpu_count()
54 except NotImplementedError:
55 pass
56 try:
57 return os.sysconf("SC_NPROCESSORS_CONF") # type: ignore
58 except (AttributeError, ValueError):
59 pass
60 gen_log.error("Could not detect number of processors; assuming 1")
61 return 1
62
63
64def _reseed_random() -> None:

Callers 2

run_in_executorMethod · 0.90
fork_processesFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected