Changeset c7315a2 in rtems-tools


Ignore:
Timestamp:
Mar 5, 2020, 9:33:07 AM (4 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
763f102
Parents:
00b9f1d
Message:

rtemstoolkit: Use multiprocessing.cpu_count()

The previous implementation does not work on some Linux distributions,
e.g. Debian on sparc64. Use a standard function instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtemstoolkit/linux.py

    r00b9f1d rc7315a2  
    3434#
    3535
     36import multiprocessing
    3637import os
    3738import platform
    3839
    39 from rtemstoolkit import execute
    4040from rtemstoolkit import path
    4141
    4242def cpus():
    43     processors = '/bin/grep processor /proc/cpuinfo'
    44     e = execute.capture_execution()
    45     exit_code, proc, output = e.shell(processors)
    46     ncpus = 0
    47     if exit_code == 0:
    48         try:
    49             for l in output.split('\n'):
    50                 count = l.split(':')[1].strip()
    51                 if int(count) > ncpus:
    52                     ncpus = int(count)
    53         except:
    54             pass
    55     return ncpus + 1
     43    return multiprocessing.cpu_count()
    5644
    5745def overrides():
Note: See TracChangeset for help on using the changeset viewer.