a
    Lg                     @   sL   d Z dZdZdZdZdZddlZddlm	Z	 d	Z
d
d Zdd Zdd ZdS )z
Stderr built-in backend.
u%   Lluís Vilanova <vilanova@ac.upc.edu>u:   Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>z3GPL version 2 or (at your option) any later versionzStefan Hajnoczizstefanha@redhat.com    NoutTc                 C   s   t ddd d S )Nz#include "qemu/log-for-trace.h"z#include "qemu/error-report.h" r   )eventsgroup r   H/home2/Puru_Virtio_Blk/virtio-demo/qemu/scripts/tracetool/backend/log.pygenerate_h_begin   s    r	   c                 C   s   d | j }t| jdkr&d| }d| jv r6d}ndd| j   }tddd	d
dddddddddddd|| jt	j
| j| j| jd|d d S )Nz, r   vcputrueztrace_event_get_state(%s)TRACE_z4    if (%(cond)s && qemu_loglevel_mask(LOG_TRACE)) {z%        if (message_with_timestamp) {z             struct timeval _now;z&            gettimeofday(&_now, NULL);z+#line %(event_lineno)d "%(event_filename)s"z>            qemu_log("%%d@%%zu.%%06zu:%(name)s " %(fmt)s "\n",z*                     qemu_get_thread_id(),z>                     (size_t)_now.tv_sec, (size_t)_now.tv_usecz#                     %(argnames)s);z,#line %(out_next_lineno)d "%(out_filename)s"z        } else {z;            qemu_log("%(name)s " %(fmt)s "\n"%(argnames)s);z	        }z    }
)condZevent_linenoZevent_filenamenamefmtargnames)joinargsnameslen
propertiesr   upperr   linenoospathrelpathfilenamer   rstrip)eventr   r   r   r   r   r   
generate_h   s:    

r   c                 C   s   t dd| j  d d S )Nz:    trace_event_get_state_dynamic_by_id(%(event_id)s) || \r   )Zevent_id)r   r   r   )r   r   r   r   r   generate_h_backend_dstate@   s    r    )__doc__
__author____copyright____license____maintainer__	__email__Zos.pathr   	tracetoolr   PUBLICr	   r   r    r   r   r   r   <module>   s   #