parameters: ()
docstring: Return the number of logical CPUs in the system.
docstring_summary: Return the number of logical CPUs in the system.
docstring_tokens: Return the number of logical CPUs in the system .
function: def cpu_count_logical():
      """Return the number of logical CPUs in the system."""
      try:
          return os.sysconf("SC_NPROCESSORS_ONLN")
      except ValueError:
          # as a second fallback we try to parse /proc/cpuinfo
          num = 0
          with open_binary('%s/cpuinfo' % get_procfs_path()) as f:
              for line in f:
                  if line.lower().startswith(b'processor'):
                      num += 1
  
          # unknown format (e.g. amrel/sparc architectures), see:
          # https://github.com/giampaolo/psutil/issues/200
          # try to parse /proc/stat as a last resort
          if num == 0:
              search = re.compile(r'cpu\d')
              with open_text('%s/stat' % get_procfs_path()) as f:
                  for line in f:
                      line = line.split(' ')[0]
                      if search.match(line):
                          num += 1
  
          if num == 0:
              # mimic os.cpu_count()
              return None
          return num
function_tokens: def cpu_count_logical ( ) : try : return os . sysconf ( "SC_NPROCESSORS_ONLN" ) except ValueError : # as a second fallback we try to parse /proc/cpuinfo num = 0 with open_binary ( '%s/cpuinfo' % get_procfs_path ( ) ) as f : for line in f : if line . lower ( ) . startswith ( b'processor' ) : num += 1 # unknown format (e.g. amrel/sparc architectures), see: # https://github.com/giampaolo/psutil/issues/200 # try to parse /proc/stat as a last resort if num == 0 : search = re . compile ( r'cpu\d' ) with open_text ( '%s/stat' % get_procfs_path ( ) ) as f : for line in f : line = line . split ( ' ' ) [ 0 ] if search . match ( line ) : num += 1 if num == 0 : # mimic os.cpu_count() return None return num