build: Introduce the agent-interface as an alternative instrumentation library

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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Kevin Pouget 2019-10-18 17:51:19 +02:00 committed by Frediano Ziglio
parent 3331ad1a04
commit f191053a8c
7 changed files with 45 additions and 22 deletions

View File

@ -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

View File

@ -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,

View File

@ -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)

View File

@ -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])

View File

@ -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"])
])

View File

@ -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'

View File

@ -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',