
    rC
f7                        d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
 ddlmZmZmZmZ ddlmZ  e ed            Z e ed            Z G d	 d
e      Zeej(                  _        eeegej(                  _        eej.                  _        ee e ee            gej.                  _        eej0                  _         ee      eegej0                  _         G d de      Zy)zF Wrapper module for libpcp_gui - PCP Graphical User Interface clients     )pmErr)
PM_ERR_IPC)CDLL	StructurePOINTERcastbyref)c_void_pc_char_pc_intc_long)find_librarypcp_guicc                   2    e Zd ZdZdefdefdefdefdefgZy)pmRecordHostzAstate information between the recording session and the pmlogger f_configfd_ipclogfilepidstatusN)__name__
__module____qualname____doc__r
   r   r   _fields_     +/usr/lib/python3/dist-packages/pcp/pmgui.pyr   r   2   s3    KX&5!H%5!	#Hr   r   c                   @    e Zd ZdZed        Zed        Zed        Zy)	GuiClientz; Provides metric recording and time control interfaces
    c                     t        | t              s| j                  d      } t        |t              s|j                  d      }t        j	                  t        |       t        |      |      }|dk(  rt        |      |S )zp GUI API - Setup an archive recording session
        File* file = pmRecordSetup("folio", "creator", 0)
        utf-8r   )
isinstancebytesencode
LIBPCP_GUIpmRecordSetupr   r   )foliocreatorreplayfile_results       r   r(   zGuiClient.pmRecordSetup\   sn    
 %'LL)E'5)nnW-G ..x/7/@&J!$$r   c                    t        | t              s| j                  d      }  t        t                     }t
        j                  t        |       |t        |            }|dk  rt        |      t        |t              s|j                  d      }t        j                  t        |      t        |j                  j                              }|dk  r)t        j                  t        d             t        |      ||fS )z GUI API - Adds host to an archive recording session
        (status, recordhost) = pmRecordAddHost("host", 1, "configuration")
        r#   r    )r$   r%   r&   r   r   r'   pmRecordAddHostr   r	   r   LIBCfputsr   contentsr   perror)host	isdefaultconfigrhpr   s        r   r/   zGuiClient.pmRecordAddHostk   s    
 $&;;w'D#gl#%++HTN,5uSzCA:-&%(]]7+FHV,fS\\5J5J.KLA:KK%-s{r   c                     t        |t              s|j                  d      }t        j	                  t        | t        t                    |t        |            }|dk  r|t        k7  rt        |      |S )zPMAPI - Control an archive recording session
        status = pmRecordControl(0, cpmgui.PM_RCSETARG, "args")
        status = pmRecordControl(0, cpmgui.PM_REC_ON)
        status = pmRecordControl(0, cpmgui.PM_REC_OFF)
        r#   r   )r$   r%   r&   r'   pmRecordControlr   r   r   r   r   r   )r7   requestoptionsr   s       r   r9   zGuiClient.pmRecordControl   sb     '5)nnW-G++Dgl6K,L,3Xg5FHA:&J.-r   N)r   r   r   r   staticmethodr(   r/   r9   r   r   r   r!   r!   U   sC        &  r   r!   N)r   	pcp.pmapir   cpmapir   ctypesr   r   r   r   r	   r
   r   r   r   ctypes.utilr   r'   r0   r   r(   restypeargtypesr/   r9   objectr!   r   r   r   <module>rD      s    L4   9 8 4 4 $ ,y)*
L#9 #" $*
    %-x$?
   !%*
   "%!67'9
   # &+
   "'.|'<eX&N
   #7 7r   