[Spice-devel] [PATCH spice-common 3/3] build: Introduce 'agent' as an alternative instrumentation library
Kevin Pouget
kpouget at redhat.com
Fri Oct 18 09:53:48 UTC 2019
On Fri, Oct 18, 2019 at 11:22 AM Frediano Ziglio <fziglio at redhat.com> wrote:
>
> >
> > The 'agent' interface is an experimental instrumentation library for
> > capturing and sharing Spice performance indicators with an external
> > agent.
> >
> > --enable-instrumentation=[c3d-rec/agent/no]
> > Enable instrumentation [default=no]
> >
> > Former configuration option '--enable-recorder=c3d' is transformed into
> > '--enable-instrumentation=c3d-rec'.
> >
> > Signed-off-by: Kevin Pouget <kpouget at redhat.com>
>
> "make check" is failing with agent instrumentation.
>
> Probably test-dummy-recorder needs updates.
thanks for spotting this, I didn't know this "make check" command :#
it is fixed by the patch below, that force-disables C3D-recorder and
the agent interface
diff --git a/tests/test-dummy-recorder.c b/tests/test-dummy-recorder.c
index 4e674a9..5be4cbd 100644
--- a/tests/test-dummy-recorder.c
+++ b/tests/test-dummy-recorder.c
@@ -19,7 +19,8 @@
#include <config.h>
#include <assert.h>
-#undef ENABLE_RECORDER
+#undef ENABLE_C3D_RECORDER
+#undef ENABLE_AGENT_INTERFACE
#include <common/recorder.h>
> > ---
> > common/Makefile.am | 9 ++++++++-
> > common/meson.build | 8 +++++++-
> > common/recorder.h | 12 ++++++++----
> > configure.ac | 2 +-
> > m4/spice-deps.m4 | 23 +++++++++++++----------
> > meson.build | 7 +++++--
> > meson_options.txt | 10 +++++-----
> > 7 files changed, 47 insertions(+), 24 deletions(-)
> >
> > diff --git a/common/Makefile.am b/common/Makefile.am
> > index 9638635..fc466bd 100644
> > --- a/common/Makefile.am
> > +++ b/common/Makefile.am
> > @@ -56,7 +56,7 @@ libspice_common_la_SOURCES = \
> > recorder.h \
> > $(NULL)
> >
> > -if ENABLE_RECORDER
> > +if ENABLE_C3D_RECORDER
> > libspice_common_la_SOURCES += \
> > recorder/recorder.c \
> > recorder/recorder.h \
> > @@ -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..418593e 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') == 'c3d-rec'
> > 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..f776fd3 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_C3D_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..34f73e6 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=@<:@c3d-rec/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" = "c3d-rec"],
> > + AC_DEFINE([ENABLE_C3D_RECORDER], [1], [Define if c3d 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_C3D_RECORDER],[test "$enable_instrumentation" =
> > "c3d-rec"])
> > + AM_CONDITIONAL([ENABLE_AGENT_INTERFACE],[test "$enable_instrumentation"
> > = "agent"])
> > ])
> > diff --git a/meson.build b/meson.build
> > index 694119d..064c56e 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -36,8 +36,11 @@ if host_machine.endian() == 'big'
> > spice_common_config_data.set('WORDS_BIGENDIAN', '1')
> > endif
> >
> > -if get_option('recorder')
> > - spice_common_config_data.set('ENABLE_RECORDER', '1')
> > +if get_option('instrumentation') == 'c3d-rec'
> > + spice_common_config_data.set('ENABLE_C3D_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')
> > diff --git a/meson_options.txt b/meson_options.txt
> > index c982736..e94bb89 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 : 'off',
> > + choices : ['c3d-rec', 'agent', 'off'],
> > + description: 'Enable instrumentation')
> >
> > option('smartcard',
> > type : 'feature',
>
> Frediano
More information about the Spice-devel
mailing list