[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 1/7] trace: Extend API to manage event arguments
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH v9 1/7] trace: Extend API to manage event arguments |
Date: |
Thu, 25 Feb 2016 17:43:04 +0100 |
User-agent: |
StGit/0.17.1-dirty |
Lets the user manage event arguments as a list, and simplifies argument
concatenation.
Signed-off-by: Lluís Vilanova <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
scripts/tracetool/__init__.py | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 181675f..0663e7f 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -50,9 +50,14 @@ class Arguments:
Parameters
----------
args :
- List of (type, name) tuples.
+ List of (type, name) tuples or Arguments objects.
"""
- self._args = args
+ self._args = []
+ for arg in args:
+ if isinstance(arg, Arguments):
+ self._args.extend(arg._args)
+ else:
+ self._args.append(arg)
def copy(self):
"""Create a new copy."""
@@ -83,6 +88,12 @@ class Arguments:
res.append((arg_type, identifier))
return Arguments(res)
+ def __getitem__(self, index):
+ if isinstance(index, slice):
+ return Arguments(self._args[index])
+ else:
+ return self._args[index]
+
def __iter__(self):
"""Iterate over the (type, name) pairs."""
return iter(self._args)
- [Qemu-devel] [PATCH v9 0/7] trace: Show vCPU info in guest code events, Lluís Vilanova, 2016/02/25
- [Qemu-devel] [PATCH v9 1/7] trace: Extend API to manage event arguments,
Lluís Vilanova <=
- [Qemu-devel] [PATCH v9 2/7] trace: Remove unnecessary intermediate event copies, Lluís Vilanova, 2016/02/25
- [Qemu-devel] [PATCH v9 4/7] tcg: Move definition of type TCGv, Lluís Vilanova, 2016/02/25
- [Qemu-devel] [PATCH v9 5/7] [trivial] trace: Add helper function to cast event arguments, Lluís Vilanova, 2016/02/25
- [Qemu-devel] [PATCH v9 6/7] typedefs: Add CPUState, Lluís Vilanova, 2016/02/25
- [Qemu-devel] [PATCH v9 7/7] trace: Add 'vcpu' event property to trace guest vCPU, Lluís Vilanova, 2016/02/25
- [Qemu-devel] [PATCH v9 3/7] tcg: Add type for vCPU pointers, Lluís Vilanova, 2016/02/25