1# -*- coding: utf-8 -*- 2 3""" 4DTrace/SystemTAP 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@linux.vnet.ibm.com" 13 14 15from tracetool import out 16 17 18PUBLIC = True 19 20 21PROBEPREFIX = None 22 23def probeprefix(): 24 if PROBEPREFIX is None: 25 raise ValueError("you must set PROBEPREFIX") 26 return PROBEPREFIX 27 28 29BINARY = None 30 31def binary(): 32 if BINARY is None: 33 raise ValueError("you must set BINARY") 34 return BINARY 35 36 37def generate_h_begin(events, group): 38 if group == "root": 39 header = "trace-dtrace-root.h" 40 else: 41 header = "trace-dtrace.h" 42 43 out('#include "%s"' % header, 44 '') 45 46 # SystemTap defines <provider>_<name>_ENABLED() but other DTrace 47 # implementations might not. 48 for e in events: 49 out('#ifndef QEMU_%(uppername)s_ENABLED', 50 '#define QEMU_%(uppername)s_ENABLED() true', 51 '#endif', 52 uppername=e.name.upper()) 53 54def generate_h(event, group): 55 out(' QEMU_%(uppername)s(%(argnames)s);', 56 uppername=event.name.upper(), 57 argnames=", ".join(event.args.names())) 58 59 60def generate_h_backend_dstate(event, group): 61 out(' QEMU_%(uppername)s_ENABLED() || \\', 62 uppername=event.name.upper()) 63