cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

ust.py (1121B)


      1# -*- coding: utf-8 -*-
      2
      3"""
      4LTTng User Space Tracing backend.
      5"""
      6
      7__author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
      8__copyright__  = "Copyright 2012-2017, Lluís Vilanova <vilanova@ac.upc.edu>"
      9__license__    = "GPL version 2 or (at your option) any later version"
     10
     11__maintainer__ = "Stefan Hajnoczi"
     12__email__      = "stefanha@redhat.com"
     13
     14
     15from tracetool import out
     16
     17
     18PUBLIC = True
     19
     20
     21def generate_h_begin(events, group):
     22    header = 'trace-ust-' + group + '.h'
     23    out('#include <lttng/tracepoint.h>',
     24        '#include "%s"' % header,
     25        '',
     26        '/* tracepoint_enabled() was introduced in LTTng UST 2.7 */',
     27        '#ifndef tracepoint_enabled',
     28        '#define tracepoint_enabled(a, b) true',
     29        '#endif',
     30        '')
     31
     32
     33def generate_h(event, group):
     34    argnames = ", ".join(event.args.names())
     35    if len(event.args) > 0:
     36        argnames = ", " + argnames
     37
     38    out('    tracepoint(qemu, %(name)s%(tp_args)s);',
     39        name=event.name,
     40        tp_args=argnames)
     41
     42
     43def generate_h_backend_dstate(event, group):
     44    out('    tracepoint_enabled(qemu, %(name)s) || \\',
     45        name=event.name)