관리-도구
편집 파일: function_package2cpus.cpython-39.opt-1.pyc
a ,�g� � @ s\ d dl Z d dlZddlmZ d dlmZ d dlmZ e�� Z e� Z dZG dd� dej�Z dS ) � N� )�base)�commands)�logsz/sys/devices/system/cpu/c s, e Zd ZdZ� fdd�Z� fdd�Z� ZS )�package2cpusz3 Provides cpu device list for a package (socket) c s t t| ��dd� d S )Nr r )�superr �__init__)�self�� __class__� �R/usr/lib/python3.9/site-packages/tuned/profiles/functions/function_package2cpus.pyr s zpackage2cpus.__init__c s8 t t| ��|�sd S t|�dkr$d S zt�t�t�d�}W n t yN Y d S 0 g }|D ]�}t| d }tj �|�s�t� d| � qXt�|�}zt|�}W n( ty� t� d||f � Y qXY n0 |D ]P}zt|�} W n, t�y t�||��r |�|� Y q�0 || kr�|�|� q�qXt|�dk�r4d�|�S d S )Nr z cpu[0-9]*z/topology/physical_package_idzFile '%s' does not existz$Invalid package id '%s' for cpu '%s'�,)r r �execute�len�fnmatch�filter�os�listdir� SYSFS_DIR�OSError�path�exists�logZwarning�cmdZ read_file�int� ValueError�append�join) r �argsZall_cpusZdevicesZcpu�f�valueZ package_idZpackage_patternZthis_package_idr r r r s: zpackage2cpus.execute)�__name__� __module__�__qualname__�__doc__r r � __classcell__r r r r r s r )r r � r Ztuned.utils.commandsr Ztunedr �getr r r ZFunctionr r r r r �<module> s