[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 20/23] instrument: Add client-side API to control
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH v2 20/23] instrument: Add client-side API to control event instrumentation |
Date: |
Tue, 16 Apr 2013 15:51:45 +0200 |
User-agent: |
StGit/0.16 |
Signed-off-by: Lluís Vilanova <address@hidden>
---
instrument/qemu-instr/control-internal.h | 16 ++++++++
instrument/qemu-instr/control.h | 61 ++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
diff --git a/instrument/qemu-instr/control-internal.h
b/instrument/qemu-instr/control-internal.h
index 6e419e7..0ddbc74 100644
--- a/instrument/qemu-instr/control-internal.h
+++ b/instrument/qemu-instr/control-internal.h
@@ -11,6 +11,7 @@
#define QI__CONTROL_INTERNAL_H
#include "trace/control.h"
+#include "instrument/control.h"
QI_IDEF QIEvent* qi_ctrl_event_id(QIEventID id)
@@ -38,6 +39,16 @@ QI_IDEF QIEventID qi_ctrl_event_count(void)
return (QIEventID)trace_event_count();
}
+QI_IDEF bool qi_ctrl_dynamic(void)
+{
+ return instr_dynamic();
+}
+
+QI_IDEF bool qi_ctrl_event_is_available(QIEvent *ev)
+{
+ return instr_event_available((TraceEvent*)ev);
+}
+
QI_IDEF QIEventID qi_ctrl_event_get_id(QIEvent *ev)
@@ -50,4 +61,9 @@ QI_IDEF const char * qi_ctrl_event_get_name(QIEvent *ev)
return trace_event_get_name((TraceEvent*)ev);
}
+QI_IDEF bool qi_ctrl_event_set(QIEvent *ev, void *cb)
+{
+ return instr_event_set((TraceEvent*)ev, cb);
+}
+
#endif /* QI__CONTROL_INTERNAL_H */
diff --git a/instrument/qemu-instr/control.h b/instrument/qemu-instr/control.h
index d3fadd1..3509b71 100644
--- a/instrument/qemu-instr/control.h
+++ b/instrument/qemu-instr/control.h
@@ -96,6 +96,13 @@ QI_IDECL bool qi_ctrl_event_is_pattern(const char *str);
*/
QI_IDECL QIEventID qi_ctrl_event_count(void);
+/**
+ * qi_ctrl_dynamic:
+ *
+ * Returns: Whether dynamic trace instrumentation is available.
+ */
+QI_IDECL bool qi_ctrl_dynamic(void);
+
/**
@@ -112,6 +119,60 @@ QI_IDECL QIEventID qi_ctrl_event_get_id(QIEvent *ev);
*/
QI_IDECL const char * qi_ctrl_event_get_name(QIEvent *ev);
+/**
+ * qi_ctrl_event_is_available:
+ *
+ * Returns: Whether the given event has the 'instrument' property.
+ */
+QI_IDECL bool qi_ctrl_event_is_available(QIEvent *ev);
+
+
+/**
+ * QI_CTRL_INSTR_NOP:
+ *
+ * Set instrumentation callback to no-operation.
+ * (qi_event_${name}_nop).
+ */
+#define QI_CTRL_INSTR_NOP ((void*)NULL)
+
+/**
+ * QI_CTRL_INSTR_NEXT:
+ *
+ * Set instrumentation callback to the "next logical step"
+ * (qi_event_${name}_trace).
+ */
+#define QI_CTRL_INSTR_NEXT ((void*)1)
+
+/**
+ * QI_CTRL_INSTR_AUTO:
+ *
+ * Automatically set callback to proper routine.
+ *
+ * Looks for a symbol name in the instrumentation library matching the event
+ * name (qi_event_${name}).
+ */
+#define QI_CTRL_INSTR_AUTO ((void*)2)
+
+/**
+ * qi_ctrl_event_set:
+ * @ev: Event descriptor.
+ * @cb: Pointer to instrumentation callback.
+ *
+ * Set the instrumentation callback for the given event.
+ *
+ * @cb can also be set to any of the QI_CTRL_INSTR_* special values.
+ *
+ * #false indicates that the instrumentation library does not export the
+ * appropriate symbol for the instrumentation routine.
+ *
+ * Pre-condition: qi_ctrl_dynamic() == true
+ * Pre-condition: qi_ctrl_event_is_available(ev) == true
+ *
+ * Returns: Whether the callback could be set (if @cb was QI_CTRL_INSTR_AUTO,
+ * otherwise always #true).
+ */
+QI_IDECL bool qi_ctrl_event_set(QIEvent *ev, void *cb);
+
#if !defined(QI_TYPE_DYNAMIC)
#include "instrument/qemu-instr/control-internal.h"
- [Qemu-devel] [RFC][PATCH v2 00/23] instrument: Let the user wrap/override specific event tracing routines, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 21/23] build: Fix installation of target-dependant files, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 22/23] instrument: Install headers for dynamic instrumentation clients, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 20/23] instrument: Add client-side API to control event instrumentation,
Lluís Vilanova <=
- [Qemu-devel] [PATCH v2 19/23] instrument: Add client-side API to control tracing state of events, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 18/23] instrument: Add client-side API to enumerate events, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 17/23] instrument: Add commandline options to start with an instrumentation library, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 09/23] build: Add variable 'tools-obj-y' for tool-only files, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 08/23] instrument: [static] Call statically linked user-provided routines, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 07/23] system: [linux] Use absolute include path for linux-headers, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 06/23] instrument: [none] Add null instrumentation, Lluís Vilanova, 2013/04/16
- [Qemu-devel] [PATCH v2 13/23] qapi: Add a primitive to include other files from a QAPI schema file, Lluís Vilanova, 2013/04/16