summaryrefslogtreecommitdiffstats
path: root/qemu/scripts/tracetool/backend
diff options
context:
space:
mode:
authorRajithaY <rajithax.yerrumsetty@intel.com>2017-04-25 03:31:15 -0700
committerRajitha Yerrumchetty <rajithax.yerrumsetty@intel.com>2017-05-22 06:48:08 +0000
commitbb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch)
treeca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/scripts/tracetool/backend
parenta14b48d18a9ed03ec191cf16b162206998a895ce (diff)
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/scripts/tracetool/backend')
-rw-r--r--qemu/scripts/tracetool/backend/__init__.py123
-rw-r--r--qemu/scripts/tracetool/backend/dtrace.py46
-rw-r--r--qemu/scripts/tracetool/backend/ftrace.py48
-rw-r--r--qemu/scripts/tracetool/backend/log.py44
-rw-r--r--qemu/scripts/tracetool/backend/simple.py100
-rw-r--r--qemu/scripts/tracetool/backend/ust.py35
6 files changed, 0 insertions, 396 deletions
diff --git a/qemu/scripts/tracetool/backend/__init__.py b/qemu/scripts/tracetool/backend/__init__.py
deleted file mode 100644
index d4b6dab9c..000000000
--- a/qemu/scripts/tracetool/backend/__init__.py
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-Backend management.
-
-
-Creating new backends
----------------------
-
-A new backend named 'foo-bar' corresponds to Python module
-'tracetool/backend/foo_bar.py'.
-
-A backend module should provide a docstring, whose first non-empty line will be
-considered its short description.
-
-All backends must generate their contents through the 'tracetool.out' routine.
-
-
-Backend attributes
-------------------
-
-========= ====================================================================
-Attribute Description
-========= ====================================================================
-PUBLIC If exists and is set to 'True', the backend is considered "public".
-========= ====================================================================
-
-
-Backend functions
------------------
-
-All the following functions are optional, and no output will be generated if
-they do not exist.
-
-=============================== ==============================================
-Function Description
-=============================== ==============================================
-generate_<format>_begin(events) Generate backend- and format-specific file
- header contents.
-generate_<format>_end(events) Generate backend- and format-specific file
- footer contents.
-generate_<format>(event) Generate backend- and format-specific contents
- for the given event.
-=============================== ==============================================
-
-"""
-
-__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
-__license__ = "GPL version 2 or (at your option) any later version"
-
-__maintainer__ = "Stefan Hajnoczi"
-__email__ = "stefanha@linux.vnet.ibm.com"
-
-
-import os
-
-import tracetool
-
-
-def get_list(only_public = False):
- """Get a list of (name, description) pairs."""
- res = [("nop", "Tracing disabled.")]
- modnames = []
- for filename in os.listdir(tracetool.backend.__path__[0]):
- if filename.endswith('.py') and filename != '__init__.py':
- modnames.append(filename.rsplit('.', 1)[0])
- for modname in sorted(modnames):
- module = tracetool.try_import("tracetool.backend." + modname)
-
- # just in case; should never fail unless non-module files are put there
- if not module[0]:
- continue
- module = module[1]
-
- public = getattr(module, "PUBLIC", False)
- if only_public and not public:
- continue
-
- doc = module.__doc__
- if doc is None:
- doc = ""
- doc = doc.strip().split("\n")[0]
-
- name = modname.replace("_", "-")
- res.append((name, doc))
- return res
-
-
-def exists(name):
- """Return whether the given backend exists."""
- if len(name) == 0:
- return False
- if name == "nop":
- return True
- name = name.replace("-", "_")
- return tracetool.try_import("tracetool.backend." + name)[1]
-
-
-class Wrapper:
- def __init__(self, backends, format):
- self._backends = [backend.replace("-", "_") for backend in backends]
- self._format = format.replace("-", "_")
- for backend in self._backends:
- assert exists(backend)
- assert tracetool.format.exists(self._format)
-
- def _run_function(self, name, *args, **kwargs):
- for backend in self._backends:
- func = tracetool.try_import("tracetool.backend." + backend,
- name % self._format, None)[1]
- if func is not None:
- func(*args, **kwargs)
-
- def generate_begin(self, events):
- self._run_function("generate_%s_begin", events)
-
- def generate(self, event):
- self._run_function("generate_%s", event)
-
- def generate_end(self, events):
- self._run_function("generate_%s_end", events)
diff --git a/qemu/scripts/tracetool/backend/dtrace.py b/qemu/scripts/tracetool/backend/dtrace.py
deleted file mode 100644
index fabfe9988..000000000
--- a/qemu/scripts/tracetool/backend/dtrace.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-DTrace/SystemTAP backend.
-"""
-
-__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
-__license__ = "GPL version 2 or (at your option) any later version"
-
-__maintainer__ = "Stefan Hajnoczi"
-__email__ = "stefanha@linux.vnet.ibm.com"
-
-
-from tracetool import out
-
-
-PUBLIC = True
-
-
-PROBEPREFIX = None
-
-def probeprefix():
- if PROBEPREFIX is None:
- raise ValueError("you must set PROBEPREFIX")
- return PROBEPREFIX
-
-
-BINARY = None
-
-def binary():
- if BINARY is None:
- raise ValueError("you must set BINARY")
- return BINARY
-
-
-def generate_h_begin(events):
- out('#include "trace/generated-tracers-dtrace.h"',
- '')
-
-
-def generate_h(event):
- out(' QEMU_%(uppername)s(%(argnames)s);',
- uppername=event.name.upper(),
- argnames=", ".join(event.args.names()))
diff --git a/qemu/scripts/tracetool/backend/ftrace.py b/qemu/scripts/tracetool/backend/ftrace.py
deleted file mode 100644
index d798c7134..000000000
--- a/qemu/scripts/tracetool/backend/ftrace.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-Ftrace built-in backend.
-"""
-
-__author__ = "Eiichi Tsukata <eiichi.tsukata.xh@hitachi.com>"
-__copyright__ = "Copyright (C) 2013 Hitachi, Ltd."
-__license__ = "GPL version 2 or (at your option) any later version"
-
-__maintainer__ = "Stefan Hajnoczi"
-__email__ = "stefanha@redhat.com"
-
-
-from tracetool import out
-
-
-PUBLIC = True
-
-
-def generate_h_begin(events):
- out('#include "trace/ftrace.h"',
- '#include "trace/control.h"',
- '')
-
-
-def generate_h(event):
- argnames = ", ".join(event.args.names())
- if len(event.args) > 0:
- argnames = ", " + argnames
-
- out(' {',
- ' char ftrace_buf[MAX_TRACE_STRLEN];',
- ' int unused __attribute__ ((unused));',
- ' int trlen;',
- ' if (trace_event_get_state(%(event_id)s)) {',
- ' trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
- ' "%(name)s " %(fmt)s "\\n" %(argnames)s);',
- ' trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
- ' unused = write(trace_marker_fd, ftrace_buf, trlen);',
- ' }',
- ' }',
- name=event.name,
- args=event.args,
- event_id="TRACE_" + event.name.upper(),
- fmt=event.fmt.rstrip("\n"),
- argnames=argnames)
diff --git a/qemu/scripts/tracetool/backend/log.py b/qemu/scripts/tracetool/backend/log.py
deleted file mode 100644
index e409b7326..000000000
--- a/qemu/scripts/tracetool/backend/log.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-Stderr built-in backend.
-"""
-
-__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
-__license__ = "GPL version 2 or (at your option) any later version"
-
-__maintainer__ = "Stefan Hajnoczi"
-__email__ = "stefanha@linux.vnet.ibm.com"
-
-
-from tracetool import out
-
-
-PUBLIC = True
-
-
-def generate_h_begin(events):
- out('#include "trace/control.h"',
- '#include "qemu/log.h"',
- '')
-
-
-def generate_h(event):
- argnames = ", ".join(event.args.names())
- if len(event.args) > 0:
- argnames = ", " + argnames
-
- out(' if (trace_event_get_state(%(event_id)s)) {',
- ' struct timeval _now;',
- ' gettimeofday(&_now, NULL);',
- ' qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
- ' getpid(),',
- ' (size_t)_now.tv_sec, (size_t)_now.tv_usec',
- ' %(argnames)s);',
- ' }',
- event_id="TRACE_" + event.name.upper(),
- name=event.name,
- fmt=event.fmt.rstrip("\n"),
- argnames=argnames)
diff --git a/qemu/scripts/tracetool/backend/simple.py b/qemu/scripts/tracetool/backend/simple.py
deleted file mode 100644
index 3246c2001..000000000
--- a/qemu/scripts/tracetool/backend/simple.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-Simple built-in backend.
-"""
-
-__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
-__license__ = "GPL version 2 or (at your option) any later version"
-
-__maintainer__ = "Stefan Hajnoczi"
-__email__ = "stefanha@linux.vnet.ibm.com"
-
-
-from tracetool import out
-
-
-PUBLIC = True
-
-
-def is_string(arg):
- strtype = ('const char*', 'char*', 'const char *', 'char *')
- if arg.lstrip().startswith(strtype):
- return True
- else:
- return False
-
-
-def generate_h_begin(events):
- for event in events:
- out('void _simple_%(api)s(%(args)s);',
- api=event.api(),
- args=event.args)
- out('')
-
-
-def generate_h(event):
- out(' _simple_%(api)s(%(args)s);',
- api=event.api(),
- args=", ".join(event.args.names()))
-
-
-def generate_c_begin(events):
- out('#include "qemu/osdep.h"',
- '#include "trace.h"',
- '#include "trace/control.h"',
- '#include "trace/simple.h"',
- '')
-
-
-def generate_c(event):
- out('void _simple_%(api)s(%(args)s)',
- '{',
- ' TraceBufferRecord rec;',
- api=event.api(),
- args=event.args)
- sizes = []
- for type_, name in event.args:
- if is_string(type_):
- out(' size_t arg%(name)s_len = %(name)s ? MIN(strlen(%(name)s), MAX_TRACE_STRLEN) : 0;',
- name=name)
- strsizeinfo = "4 + arg%s_len" % name
- sizes.append(strsizeinfo)
- else:
- sizes.append("8")
- sizestr = " + ".join(sizes)
- if len(event.args) == 0:
- sizestr = '0'
-
-
- out('',
- ' if (!trace_event_get_state(%(event_id)s)) {',
- ' return;',
- ' }',
- '',
- ' if (trace_record_start(&rec, %(event_id)s, %(size_str)s)) {',
- ' return; /* Trace Buffer Full, Event Dropped ! */',
- ' }',
- event_id='TRACE_' + event.name.upper(),
- size_str=sizestr)
-
- if len(event.args) > 0:
- for type_, name in event.args:
- # string
- if is_string(type_):
- out(' trace_record_write_str(&rec, %(name)s, arg%(name)s_len);',
- name=name)
- # pointer var (not string)
- elif type_.endswith('*'):
- out(' trace_record_write_u64(&rec, (uintptr_t)(uint64_t *)%(name)s);',
- name=name)
- # primitive data type
- else:
- out(' trace_record_write_u64(&rec, (uint64_t)%(name)s);',
- name=name)
-
- out(' trace_record_finish(&rec);',
- '}',
- '')
diff --git a/qemu/scripts/tracetool/backend/ust.py b/qemu/scripts/tracetool/backend/ust.py
deleted file mode 100644
index 2f8f44abd..000000000
--- a/qemu/scripts/tracetool/backend/ust.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""
-LTTng User Space Tracing backend.
-"""
-
-__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
-__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
-__license__ = "GPL version 2 or (at your option) any later version"
-
-__maintainer__ = "Stefan Hajnoczi"
-__email__ = "stefanha@linux.vnet.ibm.com"
-
-
-from tracetool import out
-
-
-PUBLIC = True
-
-
-def generate_h_begin(events):
- out('#include <lttng/tracepoint.h>',
- '#include "trace/generated-ust-provider.h"',
- '')
-
-
-def generate_h(event):
- argnames = ", ".join(event.args.names())
- if len(event.args) > 0:
- argnames = ", " + argnames
-
- out(' tracepoint(qemu, %(name)s%(tp_args)s);',
- name=event.name,
- tp_args=argnames)