xref: /openbmc/qemu/scripts/tracetool/backend/ust.py (revision bc5c4f21)
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4"""
5LTTng User Space Tracing backend.
6"""
7
8__author__     = "Lluís Vilanova <vilanova@ac.upc.edu>"
9__copyright__  = "Copyright 2012-2016, Lluís Vilanova <vilanova@ac.upc.edu>"
10__license__    = "GPL version 2 or (at your option) any later version"
11
12__maintainer__ = "Stefan Hajnoczi"
13__email__      = "stefanha@linux.vnet.ibm.com"
14
15
16from tracetool import out
17
18
19PUBLIC = True
20
21
22def generate_h_begin(events, group):
23    if group == "root":
24        header = "trace-ust-root.h"
25    else:
26        header = "trace-ust.h"
27
28    out('#include <lttng/tracepoint.h>',
29        '#include "%s"' % header,
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