mercurial/worker.py
changeset 26587 56b2bcea2529
parent 26568 c0501c26b05c
child 28181 f8efc8a3a991
equal deleted inserted replaced
26586:d51c658d3f04 26587:56b2bcea2529
    12 import signal
    12 import signal
    13 import sys
    13 import sys
    14 import threading
    14 import threading
    15 
    15 
    16 from .i18n import _
    16 from .i18n import _
    17 from . import util
    17 from . import error
    18 
    18 
    19 def countcpus():
    19 def countcpus():
    20     '''try to count the number of CPUs on the system'''
    20     '''try to count the number of CPUs on the system'''
    21 
    21 
    22     # posix
    22     # posix
    43         try:
    43         try:
    44             n = int(s)
    44             n = int(s)
    45             if n >= 1:
    45             if n >= 1:
    46                 return n
    46                 return n
    47         except ValueError:
    47         except ValueError:
    48             raise util.Abort(_('number of cpus must be an integer'))
    48             raise error.Abort(_('number of cpus must be an integer'))
    49     return min(max(countcpus(), 4), 32)
    49     return min(max(countcpus(), 4), 32)
    50 
    50 
    51 if os.name == 'posix':
    51 if os.name == 'posix':
    52     _startupcost = 0.01
    52     _startupcost = 0.01
    53 else:
    53 else: