2013-03-05 17:47:32 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
2014-02-23 23:37:30 +04:00
|
|
|
trace/generated-events.c
|
2013-03-05 17:47:32 +04:00
|
|
|
"""
|
|
|
|
|
|
|
|
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
|
2014-02-23 23:37:30 +04:00
|
|
|
__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
|
2013-03-05 17:47:32 +04:00
|
|
|
__license__ = "GPL version 2 or (at your option) any later version"
|
|
|
|
|
|
|
|
__maintainer__ = "Stefan Hajnoczi"
|
|
|
|
__email__ = "stefanha@linux.vnet.ibm.com"
|
|
|
|
|
|
|
|
|
|
|
|
from tracetool import out
|
|
|
|
|
|
|
|
|
2014-02-23 23:37:40 +04:00
|
|
|
def generate(events, backend):
|
2013-03-05 17:47:32 +04:00
|
|
|
out('/* This file is autogenerated by tracetool, do not edit. */',
|
|
|
|
'',
|
|
|
|
'#include "trace.h"',
|
|
|
|
'#include "trace/generated-events.h"',
|
|
|
|
'#include "trace/control.h"',
|
2014-02-23 23:37:40 +04:00
|
|
|
'')
|
2013-03-05 17:47:32 +04:00
|
|
|
|
|
|
|
out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
|
|
|
|
|
|
|
|
for e in events:
|
|
|
|
out(' { .id = %(id)s, .name = \"%(name)s\", .sstate = %(sstate)s, .dstate = 0 },',
|
|
|
|
id = "TRACE_" + e.name.upper(),
|
|
|
|
name = e.name,
|
2014-02-23 23:37:40 +04:00
|
|
|
sstate = "TRACE_%s_ENABLED" % e.name.upper())
|
2013-03-05 17:47:32 +04:00
|
|
|
|
|
|
|
out('};',
|
2014-02-23 23:37:40 +04:00
|
|
|
'')
|