aboutsummaryrefslogtreecommitdiff
path: root/qapi
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-09-30 15:45:26 +0100
committerMarkus Armbruster <armbru@redhat.com>2016-10-25 13:57:58 +0200
commitebfd93b6803acef1a799ef6c755500087e37496e (patch)
treea6942163890b11ee63d717b809f0eadfe4cac3d1 /qapi
parent6235b9cd859153a8eabd4efa309a0c541ebb3cc3 (diff)
downloadqemu-ebfd93b6803acef1a799ef6c755500087e37496e.zip
qemu-ebfd93b6803acef1a799ef6c755500087e37496e.tar.gz
qemu-ebfd93b6803acef1a799ef6c755500087e37496e.tar.bz2
qapi: add trace events for visitor
Allow tracing of the operation of visitors Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1475246744-29302-4-git-send-email-berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [visit_type_uint8() & friends rearranged slightly for clarity] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r--qapi/qapi-visit-core.c51
-rw-r--r--qapi/trace-events33
2 files changed, 78 insertions, 6 deletions
diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c
index 55f5876..63bd97b 100644
--- a/qapi/qapi-visit-core.c
+++ b/qapi/qapi-visit-core.c
@@ -19,10 +19,12 @@
#include "qapi/qmp/qerror.h"
#include "qapi/visitor.h"
#include "qapi/visitor-impl.h"
+#include "trace.h"
void visit_complete(Visitor *v, void *opaque)
{
assert(v->type != VISITOR_OUTPUT || v->complete);
+ trace_visit_complete(v, opaque);
if (v->complete) {
v->complete(v, opaque);
}
@@ -30,6 +32,7 @@ void visit_complete(Visitor *v, void *opaque)
void visit_free(Visitor *v)
{
+ trace_visit_free(v);
if (v) {
v->free(v);
}
@@ -40,6 +43,7 @@ void visit_start_struct(Visitor *v, const char *name, void **obj,
{
Error *err = NULL;
+ trace_visit_start_struct(v, name, obj, size);
if (obj) {
assert(size);
assert(!(v->type & VISITOR_OUTPUT) || *obj);
@@ -53,6 +57,7 @@ void visit_start_struct(Visitor *v, const char *name, void **obj,
void visit_check_struct(Visitor *v, Error **errp)
{
+ trace_visit_check_struct(v);
if (v->check_struct) {
v->check_struct(v, errp);
}
@@ -60,6 +65,7 @@ void visit_check_struct(Visitor *v, Error **errp)
void visit_end_struct(Visitor *v, void **obj)
{
+ trace_visit_end_struct(v, obj);
v->end_struct(v, obj);
}
@@ -69,6 +75,7 @@ void visit_start_list(Visitor *v, const char *name, GenericList **list,
Error *err = NULL;
assert(!list || size >= sizeof(GenericList));
+ trace_visit_start_list(v, name, list, size);
v->start_list(v, name, list, size, &err);
if (list && (v->type & VISITOR_INPUT)) {
assert(!(err && *list));
@@ -79,11 +86,13 @@ void visit_start_list(Visitor *v, const char *name, GenericList **list,
GenericList *visit_next_list(Visitor *v, GenericList *tail, size_t size)
{
assert(tail && size >= sizeof(GenericList));
+ trace_visit_next_list(v, tail, size);
return v->next_list(v, tail, size);
}
void visit_end_list(Visitor *v, void **obj)
{
+ trace_visit_end_list(v, obj);
v->end_list(v, obj);
}
@@ -95,6 +104,7 @@ void visit_start_alternate(Visitor *v, const char *name,
assert(obj && size >= sizeof(GenericAlternate));
assert(!(v->type & VISITOR_OUTPUT) || *obj);
+ trace_visit_start_alternate(v, name, obj, size, promote_int);
if (v->start_alternate) {
v->start_alternate(v, name, obj, size, promote_int, &err);
}
@@ -106,6 +116,7 @@ void visit_start_alternate(Visitor *v, const char *name,
void visit_end_alternate(Visitor *v, void **obj)
{
+ trace_visit_end_alternate(v, obj);
if (v->end_alternate) {
v->end_alternate(v, obj);
}
@@ -113,6 +124,7 @@ void visit_end_alternate(Visitor *v, void **obj)
bool visit_optional(Visitor *v, const char *name, bool *present)
{
+ trace_visit_optional(v, name, present);
if (v->optional) {
v->optional(v, name, present);
}
@@ -127,6 +139,7 @@ bool visit_is_input(Visitor *v)
void visit_type_int(Visitor *v, const char *name, int64_t *obj, Error **errp)
{
assert(obj);
+ trace_visit_type_int(v, name, obj);
v->type_int64(v, name, obj, errp);
}
@@ -150,7 +163,10 @@ static void visit_type_uintN(Visitor *v, uint64_t *obj, const char *name,
void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
Error **errp)
{
- uint64_t value = *obj;
+ uint64_t value;
+
+ trace_visit_type_uint8(v, name, obj);
+ value = *obj;
visit_type_uintN(v, &value, name, UINT8_MAX, "uint8_t", errp);
*obj = value;
}
@@ -158,7 +174,10 @@ void visit_type_uint8(Visitor *v, const char *name, uint8_t *obj,
void visit_type_uint16(Visitor *v, const char *name, uint16_t *obj,
Error **errp)
{
- uint64_t value = *obj;
+ uint64_t value;
+
+ trace_visit_type_uint16(v, name, obj);
+ value = *obj;
visit_type_uintN(v, &value, name, UINT16_MAX, "uint16_t", errp);
*obj = value;
}
@@ -166,7 +185,10 @@ void visit_type_uint16(Visitor *v, const char *name, uint16_t *obj,
void visit_type_uint32(Visitor *v, const char *name, uint32_t *obj,
Error **errp)
{
- uint64_t value = *obj;
+ uint64_t value;
+
+ trace_visit_type_uint32(v, name, obj);
+ value = *obj;
visit_type_uintN(v, &value, name, UINT32_MAX, "uint32_t", errp);
*obj = value;
}
@@ -175,6 +197,7 @@ void visit_type_uint64(Visitor *v, const char *name, uint64_t *obj,
Error **errp)
{
assert(obj);
+ trace_visit_type_uint64(v, name, obj);
v->type_uint64(v, name, obj, errp);
}
@@ -198,7 +221,10 @@ static void visit_type_intN(Visitor *v, int64_t *obj, const char *name,
void visit_type_int8(Visitor *v, const char *name, int8_t *obj, Error **errp)
{
- int64_t value = *obj;
+ int64_t value;
+
+ trace_visit_type_int8(v, name, obj);
+ value = *obj;
visit_type_intN(v, &value, name, INT8_MIN, INT8_MAX, "int8_t", errp);
*obj = value;
}
@@ -206,7 +232,10 @@ void visit_type_int8(Visitor *v, const char *name, int8_t *obj, Error **errp)
void visit_type_int16(Visitor *v, const char *name, int16_t *obj,
Error **errp)
{
- int64_t value = *obj;
+ int64_t value;
+
+ trace_visit_type_int16(v, name, obj);
+ value = *obj;
visit_type_intN(v, &value, name, INT16_MIN, INT16_MAX, "int16_t", errp);
*obj = value;
}
@@ -214,7 +243,10 @@ void visit_type_int16(Visitor *v, const char *name, int16_t *obj,
void visit_type_int32(Visitor *v, const char *name, int32_t *obj,
Error **errp)
{
- int64_t value = *obj;
+ int64_t value;
+
+ trace_visit_type_int32(v, name, obj);
+ value = *obj;
visit_type_intN(v, &value, name, INT32_MIN, INT32_MAX, "int32_t", errp);
*obj = value;
}
@@ -223,6 +255,7 @@ void visit_type_int64(Visitor *v, const char *name, int64_t *obj,
Error **errp)
{
assert(obj);
+ trace_visit_type_int64(v, name, obj);
v->type_int64(v, name, obj, errp);
}
@@ -230,6 +263,7 @@ void visit_type_size(Visitor *v, const char *name, uint64_t *obj,
Error **errp)
{
assert(obj);
+ trace_visit_type_size(v, name, obj);
if (v->type_size) {
v->type_size(v, name, obj, errp);
} else {
@@ -240,6 +274,7 @@ void visit_type_size(Visitor *v, const char *name, uint64_t *obj,
void visit_type_bool(Visitor *v, const char *name, bool *obj, Error **errp)
{
assert(obj);
+ trace_visit_type_bool(v, name, obj);
v->type_bool(v, name, obj, errp);
}
@@ -252,6 +287,7 @@ void visit_type_str(Visitor *v, const char *name, char **obj, Error **errp)
* can enable:
assert(!(v->type & VISITOR_OUTPUT) || *obj);
*/
+ trace_visit_type_str(v, name, obj);
v->type_str(v, name, obj, &err);
if (v->type & VISITOR_INPUT) {
assert(!err != !*obj);
@@ -263,6 +299,7 @@ void visit_type_number(Visitor *v, const char *name, double *obj,
Error **errp)
{
assert(obj);
+ trace_visit_type_number(v, name, obj);
v->type_number(v, name, obj, errp);
}
@@ -272,6 +309,7 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp)
assert(obj);
assert(v->type != VISITOR_OUTPUT || *obj);
+ trace_visit_type_any(v, name, obj);
v->type_any(v, name, obj, &err);
if (v->type == VISITOR_INPUT) {
assert(!err != !*obj);
@@ -281,6 +319,7 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp)
void visit_type_null(Visitor *v, const char *name, Error **errp)
{
+ trace_visit_type_null(v, name);
v->type_null(v, name, errp);
}
diff --git a/qapi/trace-events b/qapi/trace-events
new file mode 100644
index 0000000..2c5d3bc
--- /dev/null
+++ b/qapi/trace-events
@@ -0,0 +1,33 @@
+# qapi-visit-core.c
+visit_free(void *v) "v=%p"
+visit_complete(void *v, void *opaque) "v=%p opaque=%p"
+
+visit_start_struct(void *v, const char *name, void *obj, size_t size) "v=%p name=%s obj=%p size=%zu"
+visit_check_struct(void *v) "v=%p"
+visit_end_struct(void *v, void *obj) "v=%p obj=%p"
+
+visit_start_list(void *v, const char *name, void *obj, size_t size) "v=%p name=%s obj=%p size=%zu"
+visit_next_list(void *v, void *tail, size_t size) "v=%p tail=%p size=%zu"
+visit_end_list(void *v, void *obj) "v=%p obj=%p"
+
+visit_start_alternate(void *v, const char *name, void *obj, size_t size, bool promote_int) "v=%p name=%s obj=%p size=%zu promote_int=%d"
+visit_end_alternate(void *v, void *obj) "v=%p obj=%p"
+
+visit_optional(void *v, const char *name, bool *present) "v=%p name=%s present=%p"
+
+visit_type_enum(void *v, const char *name, int *obj) "v=%p name=%s obj=%p"
+visit_type_int(void *v, const char *name, int64_t *obj) "v=%p name=%s obj=%p"
+visit_type_uint8(void *v, const char *name, uint8_t *obj) "v=%p name=%s obj=%p"
+visit_type_uint16(void *v, const char *name, uint16_t *obj) "v=%p name=%s obj=%p"
+visit_type_uint32(void *v, const char *name, uint32_t *obj) "v=%p name=%s obj=%p"
+visit_type_uint64(void *v, const char *name, uint64_t *obj) "v=%p name=%s obj=%p"
+visit_type_int8(void *v, const char *name, int8_t *obj) "v=%p name=%s obj=%p"
+visit_type_int16(void *v, const char *name, int16_t *obj) "v=%p name=%s obj=%p"
+visit_type_int32(void *v, const char *name, int32_t *obj) "v=%p name=%s obj=%p"
+visit_type_int64(void *v, const char *name, int64_t *obj) "v=%p name=%s obj=%p"
+visit_type_size(void *v, const char *name, uint64_t *obj) "v=%p name=%s obj=%p"
+visit_type_bool(void *v, const char *name, bool *obj) "v=%p name=%s obj=%p"
+visit_type_str(void *v, const char *name, char **obj) "v=%p name=%s obj=%p"
+visit_type_number(void *v, const char *name, double *obj) "v=%p name=%s obj=%p"
+visit_type_any(void *v, const char *name, void *obj) "v=%p name=%s obj=%p"
+visit_type_null(void *v, const char *name) "v=%p name=%s"