/
lib
/
python3.9
/
site-packages
/
tuned
/
plugins
/
__pycache__
/
New Directory
Upload File
HOME
a �m�j� � @ sp d dl mZ d dlT ddlZd dl mZ ddlmZ ddlm Z ddl Z ddlZej� � ZG dd� dej�ZdS ) � )�base)�*� N)� exceptions)�commandsc s� e Zd ZdZ� fdd�Zdd� Zdd� Zedd � �Zd d� Z dd � Z dd� Zdd� Zdd� Z dd� Zejfdd�Zdd� Zeddd�dd� �Z� ZS )� SystemdPlugina� Plug-in for tuning systemd options. The [option]`cpu_affinity` option allows setting CPUAffinity in `/etc/systemd/system.conf.d/00-tuned.conf`. This configures the CPU affinity for the service manager as well as the default CPU affinity for all forked off processes. The option takes a comma-separated list of CPUs with optional CPU ranges specified by the minus sign (`-`). Please avoid changing the drop-in configuration file, as it is not backed up and will be overwritten. .Set the CPUAffinity for `systemd` to `0 1 2 3` ==== ---- [systemd] cpu_affinity=0-3 ---- ==== NOTE: These tunings are unloaded only on profile change followed by a reboot. c s� t � | _tj�tj�sptj�tj�r`t � dtj � | jjtjtjd dd�spt �dtj ��nt �dtj ��tt| �j|i |�� d S )NzCSystemd configuration file '%s' not found, attempting to create it.� T)ZmakedirzAError creating systemd configuration file '%s', disabling plugin.zQSystemd directory '%s' not found, systemd is not probably used, disabling plugin.)r �_cmd�os�path�isfile�consts�SYSTEMD_SYSTEM_CONF_FILE�isdirZSYSTEMD_CFG_PATH�log�info� write_to_fileZSYSTEMD_SYSTEM_CONF_HEADERr ZNotSupportedPluginException�superr �__init__)�self�args�kwargs�� __class__� �@/usr/lib/python3.9/site-packages/tuned/plugins/plugin_systemd.pyr $ s zSystemdPlugin.__init__c C s d|_ d|_d S )NFT)Z_has_dynamic_tuningZ_has_static_tuning�r �instancer r r �_instance_init/ s zSystemdPlugin._instance_initc C s d S �Nr r r r r �_instance_cleanup3 s zSystemdPlugin._instance_cleanupc C s dd iS )N�cpu_affinityr )�clsr r r �_get_config_options6 s �z!SystemdPlugin._get_config_optionsc C sB |d ur>t jd| d |t jd�}|d ur>|jdkr>|�d�S d S )N�^\s*z\s*=\s*(.*)$��flagsr )�re�search� MULTILINE� lastindex�group)r �conf�key�mor r r �_get_keyval<