o
    •Û_F  ã                   @   s`   d dl mZ d dlT ddlZddlmZ ddlZddlZddl	Z	ej
 ¡ ZG dd„ dejƒZdS )é   )Úbase)Ú*é    N)Úcommandsc                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚRTENTSKPluginz¼
	Plugin for avoiding interruptions due to static key IPIs due
        to opening socket with timestamping enabled (by opening a
        socket ourselves the static key is kept enabled).
	c                 C   sL   d|_ d|_d}d}t tjtjtj¡}| tj||¡ || _t	 
d¡ d S )NTFé   i @  z*opened SOF_TIMESTAMPING_OPT_TX_SWHW socket)Ú_has_static_tuningÚ_has_dynamic_tuningÚsocketÚAF_INETÚ
SOCK_DGRAMÚIPPROTO_UDPÚ
setsockoptÚ
SOL_SOCKETÚrtentsk_socketÚlogÚinfo)ÚselfÚinstanceÚSO_TIMESTAMPÚSOF_TIMESTAMPING_OPT_TX_SWHWÚs© r   ú>/usr/lib/python3/dist-packages/tuned/plugins/plugin_rtentsk.pyÚ_instance_init   s   zRTENTSKPlugin._instance_initc                 C   s   | j }| ¡  d S )N)r   Úclose)r   r   r   r   r   r   Ú_instance_cleanup"   s   zRTENTSKPlugin._instance_cleanupN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s    r   )Ú r   Ú
decoratorsÚ
tuned.logsÚtunedÚtuned.utils.commandsr   Úglobr
   ÚtimeÚlogsÚgetr   ÚPluginr   r   r   r   r   Ú<module>   s    
