MCPcopy
hub / github.com/tornadoweb/tornado / cpu_count

Function cpu_count

tornado/process.py:49–62  ·  view source on GitHub ↗

Returns the number of processors on this machine.

()

Source from the content-addressed store, hash-verified

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

Callers 2

run_in_executorMethod · 0.90
fork_processesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected