Skip to content

Commit

Permalink
telemetry: move some functions to metrics library
Browse files Browse the repository at this point in the history
This commit moves some of the telemetry library code to a new file in
the metrics library. No modifications are made to the moved code,
except what is needed to allow it to compile and run. The additional
code in metrics is built only when the Jansson library is  present.
Telemetry functions as normal, using the functions from the
metrics_telemetry file. This move will enable code be reused by the new
version of telemetry in a later commit, to support backward
compatibility with the existing telemetry usage.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
  • Loading branch information
ciarapow authored and tmonjalo committed May 10, 2020
1 parent 44dfb29 commit c5b7197
Show file tree
Hide file tree
Showing 12 changed files with 857 additions and 817 deletions.
2 changes: 1 addition & 1 deletion lib/Makefile
Expand Up @@ -71,7 +71,7 @@ DEPDIRS-librte_gro := librte_eal librte_mbuf librte_ethdev librte_net
DIRS-$(CONFIG_RTE_LIBRTE_JOBSTATS) += librte_jobstats
DEPDIRS-librte_jobstats := librte_eal
DIRS-$(CONFIG_RTE_LIBRTE_METRICS) += librte_metrics
DEPDIRS-librte_metrics := librte_eal
DEPDIRS-librte_metrics := librte_eal librte_ethdev
DIRS-$(CONFIG_RTE_LIBRTE_BITRATE) += librte_bitratestats
DEPDIRS-librte_bitratestats := librte_eal librte_metrics librte_ethdev
DIRS-$(CONFIG_RTE_LIBRTE_LATENCY_STATS) += librte_latencystats
Expand Down
9 changes: 9 additions & 0 deletions lib/librte_metrics/Makefile
Expand Up @@ -14,6 +14,15 @@ EXPORT_MAP := rte_metrics_version.map
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_METRICS) := rte_metrics.c

ifeq ($(CONFIG_RTE_LIBRTE_TELEMETRY),y)
SRCS-y += rte_metrics_telemetry.c
SYMLINK-$(CONFIG_RTE_LIBRTE_METRICS)-include += rte_metrics_telemetry.h

LDLIBS += -lrte_ethdev
LDLIBS += -ljansson

endif

# Install header file
SYMLINK-$(CONFIG_RTE_LIBRTE_METRICS)-include += rte_metrics.h

Expand Down
8 changes: 8 additions & 0 deletions lib/librte_metrics/meson.build
Expand Up @@ -3,3 +3,11 @@

sources = files('rte_metrics.c')
headers = files('rte_metrics.h')

jansson = dependency('jansson', required: false)
if jansson.found()
ext_deps += jansson
sources += files('rte_metrics_telemetry.c')
headers = files('rte_metrics_telemetry.h')
deps += ['ethdev']
endif
1 change: 0 additions & 1 deletion lib/librte_metrics/rte_metrics.c
Expand Up @@ -13,7 +13,6 @@
#include <rte_memzone.h>
#include <rte_spinlock.h>

#define RTE_METRICS_MAX_METRICS 256
#define RTE_METRICS_MEMZONE_NAME "RTE_METRICS"

/**
Expand Down
3 changes: 1 addition & 2 deletions lib/librte_metrics/rte_metrics.h
Expand Up @@ -32,6 +32,7 @@ extern "C" {

/** Maximum length of metric name (including null-terminator) */
#define RTE_METRICS_MAX_NAME_LEN 64
#define RTE_METRICS_MAX_METRICS 256

/**
* Global metric special id.
Expand All @@ -43,7 +44,6 @@ extern "C" {
*/
#define RTE_METRICS_GLOBAL -1


/**
* A name-key lookup for metrics.
*
Expand Down Expand Up @@ -71,7 +71,6 @@ struct rte_metric_value {
uint64_t value;
};


/**
* Initializes metric module. This function must be called from
* a primary process before metrics are used.
Expand Down

0 comments on commit c5b7197

Please sign in to comment.