[Spice-devel] [PATCH spice-common v3 3/3] build: Introduce the agent-interface as an alternative instrumentation library
Kevin Pouget
kpouget at redhat.com
Fri Oct 18 15:51:19 UTC 2019
The agent-interface is an experimental instrumentation library for
capturing and sharing Spice performance indicators with an external
agent.
--enable-instrumentation=[recorder/agent/no]
Enable instrumentation [default=no]
The former configuration option '--enable-recorder' is transformed
into '--enable-instrumentation=recorder'.
Signed-off-by: Kevin Pouget <kpouget at redhat.com>
---
v2->v3: renamed option 'c3d-rec' into 'recorder' and changed variable
names accordingly
---
common/Makefile.am | 7 +++++++
common/meson.build | 8 +++++++-
common/recorder.h | 12 ++++++++----
configure.ac | 2 +-
m4/spice-deps.m4 | 23 +++++++++++++----------
meson.build | 5 ++++-
meson_options.txt | 10 +++++-----
tests/test-dummy-recorder.c | 2 +-
8 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/common/Makefile.am b/common/Makefile.am
index 9638635..b6c29e1 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -65,6 +65,13 @@ libspice_common_la_SOURCES += \
$(NULL)
endif
+if ENABLE_AGENT_INTERFACE
+libspice_common_la_SOURCES += \
+ agent_interface.c \
+ agent_interface.h \
+ $(NULL)
+endif
+
# These 2 files are not build as part of spice-common
# build system, but modules using spice-common will build
# them with the appropriate options. We need to let automake
diff --git a/common/meson.build b/common/meson.build
index 9a2725f..7356cc0 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -41,7 +41,7 @@ spice_common_sources = [
'recorder.h'
]
-if get_option('recorder')
+if get_option('instrumentation') == 'recorder'
spice_common_sources += [
'recorder/recorder.c',
'recorder/recorder.h',
@@ -49,6 +49,12 @@ if get_option('recorder')
'recorder/recorder_ring.h'
]
endif
+if get_option('instrumentation') == 'agent'
+ spice_common_sources += [
+ 'agent_interface.c',
+ 'agent_interface.h'
+ ]
+endif
spice_common_lib = static_library('spice-common', spice_common_sources,
install : false,
diff --git a/common/recorder.h b/common/recorder.h
index 7194ab5..61aa759 100644
--- a/common/recorder.h
+++ b/common/recorder.h
@@ -16,7 +16,14 @@
*/
/* This file include recorder library headers or if disabled provide
* replacement declarations */
-#ifndef ENABLE_RECORDER
+
+#ifdef ENABLE_RECORDER
+#include <common/recorder/recorder.h>
+
+#elif defined(ENABLE_AGENT_INTERFACE)
+#include <common/agent_interface.h>
+
+#else
#include <stdio.h>
#include <stdint.h>
@@ -69,9 +76,6 @@ static inline void
recorder_dump_on_common_signals(unsigned add, unsigned remove)
{
}
-
-#else
-#include <common/recorder/recorder.h>
#endif
#if !defined(ENABLE_AGENT_INTERFACE)
diff --git a/configure.ac b/configure.ac
index da0a687..9d10287 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ AC_ARG_ENABLE([alignment-checks],
AS_IF([test "x$enable_alignment_checks" = "xyes"],
[AC_DEFINE([SPICE_DEBUG_ALIGNMENT], 1, [Enable runtime checks for cast alignment])])
-SPICE_CHECK_RECORDER
+SPICE_CHECK_INSTRUMENTATION
# Checks for libraries
PKG_CHECK_MODULES([PROTOCOL], [spice-protocol >= 0.12.12])
diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 1214341..c4a16e7 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -341,17 +341,20 @@ AC_DEFUN([SPICE_CHECK_OPENSSL], [
PKG_CHECK_MODULES(OPENSSL, openssl)
])
-# SPICE_CHECK_RECORDER
+# SPICE_CHECK_INSTRUMENTATION
# -----------------
-# Check for the availability of recorder library.
+# Check for the availability of an instrumentation library.
#------------------
-AC_DEFUN([SPICE_CHECK_RECORDER], [
- AC_ARG_ENABLE([recorder],
- AS_HELP_STRING([--enable-recorder],
- [Enable recorder instrumentation @<:@default=no@:>@]),
+AC_DEFUN([SPICE_CHECK_INSTRUMENTATION], [
+ AC_ARG_ENABLE([instrumentation],
+ AS_HELP_STRING([--enable-instrumentation=@<:@recorder/agent/no@:>@],
+ [Enable instrumentation @<:@default=no@:>@]),
[],
- enable_recorder="no")
- AS_IF([test "$enable_recorder" = "yes"],
- AC_DEFINE([ENABLE_RECORDER], [1], [Define if recorder instrumentation is enabled]))
- AM_CONDITIONAL([ENABLE_RECORDER],[test "$enable_recorder" = "yes"])
+ enable_instrumentation="no")
+ AS_IF([test "$enable_instrumentation" = "recorder"],
+ AC_DEFINE([ENABLE_RECORDER], [1], [Define if the recorder instrumentation is enabled]))
+ AS_IF([test "$enable_instrumentation" = "agent"],
+ AC_DEFINE([ENABLE_AGENT_INTERFACE], [1], [Define if the agent-interface instrumentation is enabled]))
+ AM_CONDITIONAL([ENABLE_RECORDER],[test "$enable_instrumentation" = "recorder"])
+ AM_CONDITIONAL([ENABLE_AGENT_INTERFACE],[test "$enable_instrumentation" = "agent"])
])
diff --git a/meson.build b/meson.build
index 694119d..2e75e89 100644
--- a/meson.build
+++ b/meson.build
@@ -36,9 +36,12 @@ if host_machine.endian() == 'big'
spice_common_config_data.set('WORDS_BIGENDIAN', '1')
endif
-if get_option('recorder')
+if get_option('instrumentation') == 'recorder'
spice_common_config_data.set('ENABLE_RECORDER', '1')
endif
+if get_option('instrumentation') == 'agent'
+ spice_common_config_data.set('ENABLE_AGENT_INTERFACE', '1')
+endif
spice_common_generate_code = get_option('generate-code')
spice_common_generate_client_code = spice_common_generate_code == 'all' or spice_common_generate_code == 'client'
diff --git a/meson_options.txt b/meson_options.txt
index c982736..84445fc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -21,11 +21,11 @@ option('opus',
yield : true,
description: 'Enable Opus audio codec')
-option('recorder',
- type : 'boolean',
- value : false,
- yield : true,
- description: 'Enable recorder instrumentation')
+option('instrumentation',
+ type : 'combo',
+ value : 'no',
+ choices : ['recorder', 'agent', 'no'],
+ description: 'Enable instrumentation')
option('smartcard',
type : 'feature',
diff --git a/tests/test-dummy-recorder.c b/tests/test-dummy-recorder.c
index 5be4cbd..e54f4ef 100644
--- a/tests/test-dummy-recorder.c
+++ b/tests/test-dummy-recorder.c
@@ -19,7 +19,7 @@
#include <config.h>
#include <assert.h>
-#undef ENABLE_C3D_RECORDER
+#undef ENABLE_RECORDER
#undef ENABLE_AGENT_INTERFACE
#include <common/recorder.h>
--
2.21.0
More information about the Spice-devel
mailing list