From: Remy Horton <remy.horton@intel.com>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>
Subject: [dpdk-dev] [PATCH v5 1/4] lib: add information metrics library
Date: Fri, 18 Nov 2016 16:00:03 +0800 [thread overview]
Message-ID: <1479456006-10891-2-git-send-email-remy.horton@intel.com> (raw)
In-Reply-To: <1479456006-10891-1-git-send-email-remy.horton@intel.com>
This patch adds a new information metric library that allows other
modules to register named metrics and update their values. It is
intended to be independent of ethdev, rather than mixing ethdev
and non-ethdev information in xstats.
Signed-off-by: Remy Horton <remy.horton@intel.com>
---
MAINTAINERS | 5 +
config/common_base | 5 +
doc/api/doxy-api-index.md | 1 +
doc/api/doxy-api.conf | 1 +
doc/guides/rel_notes/release_17_02.rst | 7 +
lib/Makefile | 1 +
lib/librte_metrics/Makefile | 51 +++++
lib/librte_metrics/rte_metrics.c | 308 +++++++++++++++++++++++++++++
lib/librte_metrics/rte_metrics.h | 190 ++++++++++++++++++
lib/librte_metrics/rte_metrics_version.map | 13 ++
mk/rte.app.mk | 2 +
11 files changed, 584 insertions(+)
create mode 100644 lib/librte_metrics/Makefile
create mode 100644 lib/librte_metrics/rte_metrics.c
create mode 100644 lib/librte_metrics/rte_metrics.h
create mode 100644 lib/librte_metrics/rte_metrics_version.map
diff --git a/MAINTAINERS b/MAINTAINERS
index d6bb8f8..52bd8a9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -595,6 +595,11 @@ F: lib/librte_jobstats/
F: examples/l2fwd-jobstats/
F: doc/guides/sample_app_ug/l2_forward_job_stats.rst
+Metrics
+M: Remy Horton <remy.horton@intel.com>
+F: lib/librte_metrics/
+F: doc/guides/sample_app_ug/keep_alive.rst
+
Test Applications
-----------------
diff --git a/config/common_base b/config/common_base
index 4bff83a..dedc4c3 100644
--- a/config/common_base
+++ b/config/common_base
@@ -589,3 +589,8 @@ CONFIG_RTE_APP_TEST_RESOURCE_TAR=n
CONFIG_RTE_TEST_PMD=y
CONFIG_RTE_TEST_PMD_RECORD_CORE_CYCLES=n
CONFIG_RTE_TEST_PMD_RECORD_BURST_STATS=n
+
+#
+# Compile the device metrics library
+#
+CONFIG_RTE_LIBRTE_METRICS=y
diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
index 6675f96..ca50fa6 100644
--- a/doc/api/doxy-api-index.md
+++ b/doc/api/doxy-api-index.md
@@ -147,4 +147,5 @@ There are many libraries, so their headers may be grouped by topics:
[common] (@ref rte_common.h),
[ABI compat] (@ref rte_compat.h),
[keepalive] (@ref rte_keepalive.h),
+ [Device Metrics] (@ref rte_metrics.h),
[version] (@ref rte_version.h)
diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf
index 9dc7ae5..fe830eb 100644
--- a/doc/api/doxy-api.conf
+++ b/doc/api/doxy-api.conf
@@ -57,6 +57,7 @@ INPUT = doc/api/doxy-api-index.md \
lib/librte_reorder \
lib/librte_ring \
lib/librte_sched \
+ lib/librte_metrics \
lib/librte_table \
lib/librte_timer \
lib/librte_vhost
diff --git a/doc/guides/rel_notes/release_17_02.rst b/doc/guides/rel_notes/release_17_02.rst
index 3b65038..2d82dd1 100644
--- a/doc/guides/rel_notes/release_17_02.rst
+++ b/doc/guides/rel_notes/release_17_02.rst
@@ -34,6 +34,12 @@ New Features
Refer to the previous release notes for examples.
+ * **Added information metric library.**
+
+ A library that allows information metrics to be added and update. It is
+ intended to provide a reporting mechanism that is independent of the
+ ethdev library.
+
This section is a comment. do not overwrite or remove it.
Also, make sure to start the actual text at the margin.
=========================================================
@@ -152,6 +158,7 @@ The libraries prepended with a plus sign were incremented in this version.
librte_mbuf.so.2
librte_mempool.so.2
librte_meter.so.1
+ + librte_metrics.so.1
librte_net.so.1
librte_pdump.so.1
librte_pipeline.so.3
diff --git a/lib/Makefile b/lib/Makefile
index 990f23a..5d85dcf 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -58,6 +58,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table
DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline
DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder
DIRS-$(CONFIG_RTE_LIBRTE_PDUMP) += librte_pdump
+DIRS-$(CONFIG_RTE_LIBRTE_METRICS) += librte_metrics
ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni
diff --git a/lib/librte_metrics/Makefile b/lib/librte_metrics/Makefile
new file mode 100644
index 0000000..8d6e23a
--- /dev/null
+++ b/lib/librte_metrics/Makefile
@@ -0,0 +1,51 @@
+# BSD LICENSE
+#
+# Copyright(c) 2016 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_metrics.a
+
+CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+
+EXPORT_MAP := rte_metrics_version.map
+
+LIBABIVER := 1
+
+# all source are stored in SRCS-y
+SRCS-$(CONFIG_RTE_LIBRTE_METRICS) := rte_metrics.c
+
+# Install header file
+SYMLINK-$(CONFIG_RTE_LIBRTE_METRICS)-include += rte_metrics.h
+
+DEPDIRS-$(CONFIG_RTE_LIBRTE_METRICS) += lib/librte_eal
+
+include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_metrics/rte_metrics.c b/lib/librte_metrics/rte_metrics.c
new file mode 100644
index 0000000..5edacc6
--- /dev/null
+++ b/lib/librte_metrics/rte_metrics.c
@@ -0,0 +1,308 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <sys/queue.h>
+
+#include <rte_common.h>
+#include <rte_malloc.h>
+#include <rte_metrics.h>
+#include <rte_lcore.h>
+#include <rte_memzone.h>
+#include <rte_spinlock.h>
+
+#define RTE_METRICS_MAX_METRICS 256
+#define RTE_METRICS_MEMZONE_NAME "RTE_METRICS"
+
+/**
+ * Internal stats metadata and value entry.
+ *
+ * @internal
+ * @param name
+ * Name of metric
+ * @param value
+ * Current value for metric
+ * @param idx_next_set
+ * Index of next root element (zero for none)
+ * @param idx_next_metric
+ * Index of next metric in set (zero for none)
+ *
+ * Only the root of each set needs idx_next_set but since it has to be
+ * assumed that number of sets could equal total number of metrics,
+ * having a separate set metadata table doesn't save any memory.
+ */
+struct rte_metrics_meta_s {
+ char name[RTE_METRICS_MAX_NAME_LEN];
+ uint64_t value[RTE_MAX_ETHPORTS];
+ uint64_t nonport_value;
+ uint16_t idx_next_set;
+ uint16_t idx_next_stat;
+};
+
+/**
+ * Internal stats info structure.
+ *
+ * @internal
+ * @param idx_last_set
+ * Index of last metadata entry with valid data. This value is
+ * not valid if cnt_stats is zero.
+ * @param cnt_stats
+ * Number of metrics.
+ * @param metadata
+ * Stat data memory block.
+ *
+ * Offsets into metadata are used instead of pointers because ASLR
+ * means that having the same physical addresses in different
+ * processes is not guaranteed.
+ */
+struct rte_metrics_data_s {
+ uint16_t idx_last_set;
+ uint16_t cnt_stats;
+ struct rte_metrics_meta_s metadata[RTE_METRICS_MAX_METRICS];
+ rte_spinlock_t lock;
+};
+
+void
+rte_metrics_init(void)
+{
+ struct rte_metrics_data_s *stats;
+ const struct rte_memzone *memzone;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return;
+
+ memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
+ if (memzone != NULL)
+ return;
+ memzone = rte_memzone_reserve(RTE_METRICS_MEMZONE_NAME,
+ sizeof(struct rte_metrics_data_s), rte_socket_id(), 0);
+ if (memzone == NULL)
+ rte_exit(EXIT_FAILURE, "Unable to allocate stats memzone\n");
+ stats = memzone->addr;
+ memset(stats, 0, sizeof(struct rte_metrics_data_s));
+ rte_spinlock_init(&stats->lock);
+}
+
+int
+rte_metrics_reg_metric(const char *name)
+{
+ const char *list_names[] = {name};
+
+ return rte_metrics_reg_metrics(list_names, 1);
+}
+
+int
+rte_metrics_reg_metrics(const char **names, uint16_t cnt_names)
+{
+ struct rte_metrics_meta_s *entry;
+ struct rte_metrics_data_s *stats;
+ const struct rte_memzone *memzone;
+ uint16_t idx_name;
+ uint16_t idx_base;
+
+ /* Some sanity checks */
+ if (cnt_names < 1 || names == NULL)
+ return -EINVAL;
+
+ rte_metrics_init();
+ memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
+ if (memzone == NULL)
+ return -EIO;
+ stats = memzone->addr;
+
+ if (stats->cnt_stats + cnt_names >= RTE_METRICS_MAX_METRICS)
+ return -ENOMEM;
+
+ rte_spinlock_lock(&stats->lock);
+
+ /* Overwritten later if this is actually first set.. */
+ stats->metadata[stats->idx_last_set].idx_next_set = stats->cnt_stats;
+
+ stats->idx_last_set = idx_base = stats->cnt_stats;
+
+ for (idx_name = 0; idx_name < cnt_names; idx_name++) {
+ entry = &stats->metadata[idx_name + stats->cnt_stats];
+ strncpy(entry->name, names[idx_name],
+ RTE_METRICS_MAX_NAME_LEN);
+ memset(entry->value, 0, sizeof(entry->value));
+ entry->idx_next_stat = idx_name + stats->cnt_stats + 1;
+ }
+ entry->idx_next_stat = 0;
+ entry->idx_next_set = 0;
+ stats->cnt_stats += cnt_names;
+
+ rte_spinlock_unlock(&stats->lock);
+
+ return idx_base;
+}
+
+int
+rte_metrics_update_metric(int port_id, uint16_t key, const uint64_t value)
+{
+ return rte_metrics_update_metrics(port_id, key, &value, 1);
+}
+
+int
+rte_metrics_update_metrics(int port_id,
+ uint16_t key,
+ const uint64_t *values,
+ uint32_t count)
+{
+ struct rte_metrics_meta_s *entry;
+ struct rte_metrics_data_s *stats;
+ const struct rte_memzone *memzone;
+ uint16_t idx_metric;
+ uint16_t idx_value;
+ uint16_t cnt_setsize;
+
+ if (port_id != RTE_METRICS_NONPORT &&
+ (port_id < 0 || port_id > RTE_MAX_ETHPORTS))
+ return -EINVAL;
+
+ rte_metrics_init();
+ memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
+ if (memzone == NULL)
+ return -EIO;
+ stats = memzone->addr;
+
+ rte_spinlock_lock(&stats->lock);
+ idx_metric = key;
+ cnt_setsize = 1;
+ while (idx_metric < stats->cnt_stats) {
+ entry = &stats->metadata[idx_metric];
+ if (entry->idx_next_stat == 0)
+ break;
+ cnt_setsize++;
+ idx_metric++;
+ }
+ /* Check update does not cross set border */
+ if (count > cnt_setsize) {
+ rte_spinlock_unlock(&stats->lock);
+ return -ERANGE;
+ }
+
+ if (port_id == RTE_METRICS_NONPORT)
+ for (idx_value = 0; idx_value < count; idx_value++) {
+ idx_metric = key + idx_value;
+ stats->metadata[idx_metric].nonport_value =
+ values[idx_value];
+ }
+ else
+ for (idx_value = 0; idx_value < count; idx_value++) {
+ idx_metric = key + idx_value;
+ stats->metadata[idx_metric].value[port_id] =
+ values[idx_value];
+ }
+ rte_spinlock_unlock(&stats->lock);
+ return 0;
+}
+
+int
+rte_metrics_get_names(struct rte_metric_name *names,
+ uint16_t capacity)
+{
+ struct rte_metrics_data_s *stats;
+ const struct rte_memzone *memzone;
+ uint16_t idx_name;
+ int return_value;
+
+ memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
+ /* If not allocated, fail silently */
+ if (memzone == NULL)
+ return 0;
+
+ stats = memzone->addr;
+ rte_spinlock_lock(&stats->lock);
+ if (names != NULL) {
+ if (capacity < stats->cnt_stats) {
+ rte_spinlock_unlock(&stats->lock);
+ return -ERANGE;
+ }
+ for (idx_name = 0; idx_name < stats->cnt_stats; idx_name++)
+ strncpy(names[idx_name].name,
+ stats->metadata[idx_name].name,
+ RTE_METRICS_MAX_NAME_LEN);
+ }
+ return_value = stats->cnt_stats;
+ rte_spinlock_unlock(&stats->lock);
+ return return_value;
+}
+
+int
+rte_metrics_get_values(int port_id,
+ struct rte_metric_value *values,
+ uint16_t capacity)
+{
+ struct rte_metrics_meta_s *entry;
+ struct rte_metrics_data_s *stats;
+ const struct rte_memzone *memzone;
+ uint16_t idx_name;
+ int return_value;
+
+ if (port_id != RTE_METRICS_NONPORT &&
+ (port_id < 0 || port_id > RTE_MAX_ETHPORTS))
+ return -EINVAL;
+
+ memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
+ /* If not allocated, fail silently */
+ if (memzone == NULL)
+ return 0;
+ stats = memzone->addr;
+ rte_spinlock_lock(&stats->lock);
+
+ if (values != NULL) {
+ if (capacity < stats->cnt_stats) {
+ rte_spinlock_unlock(&stats->lock);
+ return -ERANGE;
+ }
+ if (port_id == RTE_METRICS_NONPORT)
+ for (idx_name = 0;
+ idx_name < stats->cnt_stats;
+ idx_name++) {
+ entry = &stats->metadata[idx_name];
+ values[idx_name].key = idx_name;
+ values[idx_name].value = entry->nonport_value;
+ }
+ else
+ for (idx_name = 0;
+ idx_name < stats->cnt_stats;
+ idx_name++) {
+ entry = &stats->metadata[idx_name];
+ values[idx_name].key = idx_name;
+ values[idx_name].value = entry->value[port_id];
+ }
+ }
+ return_value = stats->cnt_stats;
+ rte_spinlock_unlock(&stats->lock);
+ return return_value;
+}
diff --git a/lib/librte_metrics/rte_metrics.h b/lib/librte_metrics/rte_metrics.h
new file mode 100644
index 0000000..c58b366
--- /dev/null
+++ b/lib/librte_metrics/rte_metrics.h
@@ -0,0 +1,190 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2016 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ *
+ * RTE Metrics module
+ *
+ * Metric information is populated using a push model, where the
+ * information provider calls an update function on the relevant
+ * metrics. Currently only bulk querying of metrics is supported.
+ */
+
+#ifndef _RTE_METRICS_H_
+#define _RTE_METRICS_H_
+
+/** Maximum length of metric name (including null-terminator) */
+#define RTE_METRICS_MAX_NAME_LEN 64
+
+/** Used to indicate port-independent information */
+#define RTE_METRICS_NONPORT -1
+
+
+/**
+ * Metric name
+ */
+struct rte_metric_name {
+ /** String describing metric */
+ char name[RTE_METRICS_MAX_NAME_LEN];
+};
+
+
+/**
+ * Metric name.
+ */
+struct rte_metric_value {
+ /** Numeric identifier of metric */
+ uint16_t key;
+ /** Value for metric */
+ uint64_t value;
+};
+
+
+/**
+ * Initializes metric module. This only has to be explicitly called if you
+ * intend to use rte_metrics_reg_metric() or rte_metrics_reg_metrics() from a
+ * secondary process. This function must be called from a primary process.
+ */
+void rte_metrics_init(void);
+
+
+/**
+ * Register a metric
+ *
+ * @param name
+ * Metric name
+ *
+ * @return
+ * - Zero or positive: Success
+ * - Negative: Failure
+ */
+int rte_metrics_reg_metric(const char *name);
+
+/**
+ * Register a set of metrics
+ *
+ * @param names
+ * List of metric names
+ *
+ * @param cnt_names
+ * Number of metrics in set
+ *
+ * @return
+ * - Zero or positive: Success
+ * - Negative: Failure
+ */
+int rte_metrics_reg_metrics(const char **names, uint16_t cnt_names);
+
+/**
+ * Get metric name-key lookup table.
+ *
+ * @param names
+ * Array of names to receive key names
+ *
+ * @param capacity
+ * Space available in names
+ *
+ * @return
+ * - Non-negative: Success (number of names)
+ * - Negative: Failure
+ */
+int rte_metrics_get_names(
+ struct rte_metric_name *names,
+ uint16_t capacity);
+
+/**
+ * Fetch metrics.
+ *
+ * @param port_id
+ * Port id to query
+ *
+ * @param values
+ * Array to receive values and their keys
+ *
+ * @param capacity
+ * Space available in values
+ *
+ * @return
+ * - Non-negative: Success (number of names)
+ * - Negative: Failure
+ */
+int rte_metrics_get_values(
+ int port_id,
+ struct rte_metric_value *values,
+ uint16_t capacity);
+
+/**
+ * Updates a metric
+ *
+ * @param port_id
+ * Port to update metrics for
+ * @param key
+ * Id of metric to update
+ * @param value
+ * New value
+ *
+ * @return
+ * - -EIO if unable to access shared metrics memory
+ * - Zero on success
+ */
+int rte_metrics_update_metric(
+ int port_id,
+ uint16_t key,
+ const uint64_t value);
+
+/**
+ * Updates a metric set. Note that it is an error to try to
+ * update across a set boundary.
+ *
+ * @param port_id
+ * Port to update metrics for
+ * @param key
+ * Base id of metrics set to update
+ * @param values
+ * Set of new values
+ * @param count
+ * Number of new values
+ *
+ * @return
+ * - -ERANGE if count exceeds metric set size
+ * - -EIO if upable to access shared metrics memory
+ * - Zero on success
+ */
+int rte_metrics_update_metrics(
+ int port_id,
+ uint16_t key,
+ const uint64_t *values,
+ uint32_t count);
+
+#endif
diff --git a/lib/librte_metrics/rte_metrics_version.map b/lib/librte_metrics/rte_metrics_version.map
new file mode 100644
index 0000000..f904814
--- /dev/null
+++ b/lib/librte_metrics/rte_metrics_version.map
@@ -0,0 +1,13 @@
+DPDK_17.02 {
+ global:
+
+ rte_metrics_get_names;
+ rte_metrics_get_values;
+ rte_metrics_init;
+ rte_metrics_reg_metric;
+ rte_metrics_reg_metrics;
+ rte_metrics_update_metric;
+ rte_metrics_update_metrics;
+
+ local: *;
+};
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index f75f0e2..40fcf33 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -98,6 +98,8 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_RING) += -lrte_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_EAL) += -lrte_eal
_LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE) += -lrte_cmdline
_LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE) += -lrte_cfgfile
+_LDLIBS-$(CONFIG_RTE_LIBRTE_METRICS) += -lrte_metrics
+
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND) += -lrte_pmd_bond
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt -lxenstore
--
2.5.5
next prev parent reply other threads:[~2016-11-18 8:00 UTC|newest]
Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 14:58 [dpdk-dev] [RFC PATCH v1] rte: add bit-rate metrics to xstats Remy Horton
2016-08-26 13:28 ` Pattan, Reshma
2016-08-29 10:01 ` Pattan, Reshma
2016-08-29 11:19 ` Remy Horton
2016-10-28 1:04 ` [dpdk-dev] [PATCH v2 0/3] expanded statistic reporting Remy Horton
2016-10-28 1:04 ` [dpdk-dev] [RFC PATCH v2 1/3] lib: add information metrics library Remy Horton
2016-10-28 1:04 ` [dpdk-dev] [RFC PATCH v2 2/3] lib: add bitrate statistics library Remy Horton
2016-10-28 1:12 ` Stephen Hemminger
2016-10-28 7:48 ` Remy Horton
2016-10-28 7:39 ` Morten Brørup
2016-11-01 1:53 ` Remy Horton
2016-10-28 1:04 ` [dpdk-dev] [RFC PATCH v2 3/3] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-04 3:36 ` [dpdk-dev] [PATCH v3 0/3] Expanded statistics reporting Remy Horton
2016-11-04 3:36 ` [dpdk-dev] [PATCH v3 1/3] lib: add information metrics library Remy Horton
2016-11-04 16:42 ` Pattan, Reshma
2016-11-07 15:25 ` Pattan, Reshma
2016-11-08 3:19 ` Remy Horton
2016-11-04 3:36 ` [dpdk-dev] [PATCH v3 2/3] lib: add bitrate statistics library Remy Horton
2016-11-04 3:36 ` [dpdk-dev] [PATCH v3 3/3] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-15 7:15 ` [dpdk-dev] [PATCH v4 0/3] Expanded statistics reporting Remy Horton
2016-11-15 7:15 ` [dpdk-dev] [PATCH v4 1/3] lib: add information metrics library Remy Horton
2016-11-15 7:15 ` [dpdk-dev] [PATCH v4 2/3] lib: add bitrate statistics library Remy Horton
2016-11-15 15:17 ` Pattan, Reshma
2016-11-15 7:15 ` [dpdk-dev] [PATCH v4 3/3] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-18 8:00 ` [dpdk-dev] [PATCH v5 0/4] Expanded statistics reporting Remy Horton
2016-11-18 8:00 ` Remy Horton [this message]
2016-11-18 8:00 ` [dpdk-dev] [PATCH v5 2/4] lib: add bitrate statistics library Remy Horton
2016-11-18 8:00 ` [dpdk-dev] [PATCH v5 3/4] app/test-pmd: add support for bitrate statistics Remy Horton
2016-11-18 8:00 ` [dpdk-dev] [PATCH v5 4/4] latencystats: added new library for latency stats Remy Horton
2017-01-11 16:03 ` [dpdk-dev] [PATCH v6 0/4] Expanded statistics reporting Remy Horton
2017-01-11 16:03 ` [dpdk-dev] [PATCH v6 1/4] lib: add information metrics library Remy Horton
2017-01-12 13:22 ` Thomas Monjalon
2017-01-12 15:30 ` Remy Horton
2017-01-12 19:05 ` Thomas Monjalon
2017-01-16 10:27 ` Remy Horton
2017-01-11 16:03 ` [dpdk-dev] [PATCH v6 2/4] lib: add bitrate statistics library Remy Horton
2017-01-11 16:15 ` Stephen Hemminger
2017-01-16 13:18 ` Remy Horton
2017-01-11 16:03 ` [dpdk-dev] [PATCH v6 3/4] app/test-pmd: add support for bitrate statistics Remy Horton
2017-01-12 13:32 ` Thomas Monjalon
2017-01-11 16:03 ` [dpdk-dev] [PATCH v6 4/4] latencystats: added new library for latency stats Remy Horton
2017-01-12 13:41 ` Thomas Monjalon
2017-01-12 14:44 ` Remy Horton
2017-01-13 9:45 ` Mcnamara, John
2017-01-13 9:53 ` Thomas Monjalon
2017-01-16 16:18 ` Mcnamara, John
2017-01-11 16:58 ` [dpdk-dev] [PATCH v6 0/4] Expanded statistics reporting Thomas Monjalon
2017-01-16 16:19 ` [dpdk-dev] [PATCH v7 0/6] " Remy Horton
2017-01-16 16:19 ` [dpdk-dev] [PATCH v7 1/6] lib: add information metrics library Remy Horton
2017-01-17 11:01 ` Van Haaren, Harry
2017-01-17 13:40 ` Remy Horton
2017-01-17 14:23 ` Van Haaren, Harry
2017-01-16 16:19 ` [dpdk-dev] [PATCH v7 2/6] app/proc_info: add metrics displaying Remy Horton
2017-01-17 11:08 ` Van Haaren, Harry
2017-01-17 14:27 ` Remy Horton
2017-01-16 16:19 ` [dpdk-dev] [PATCH v7 3/6] lib: add bitrate statistics library Remy Horton
2017-01-17 11:16 ` Van Haaren, Harry
2017-01-17 15:37 ` Remy Horton
2017-01-16 16:19 ` [dpdk-dev] [PATCH v7 4/6] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-01-17 11:19 ` Van Haaren, Harry
2017-01-16 16:19 ` [dpdk-dev] [PATCH v7 5/6] lib: added new library for latency stats Remy Horton
2017-01-17 4:29 ` Jerin Jacob
2017-01-17 6:48 ` Remy Horton
2017-01-17 7:35 ` Jerin Jacob
2017-01-17 11:19 ` Mcnamara, John
2017-01-17 12:34 ` Jerin Jacob
2017-01-17 14:53 ` Mcnamara, John
2017-01-17 16:25 ` Jerin Jacob
2017-01-18 20:11 ` Olivier Matz
2017-01-24 15:24 ` Olivier MATZ
2017-01-17 11:41 ` Van Haaren, Harry
2017-01-16 16:19 ` [dpdk-dev] [PATCH v7 6/6] app/test-pmd: add latency statistics calculation Remy Horton
2017-01-17 11:45 ` Van Haaren, Harry
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 0/7] Expanded statistics reporting Remy Horton
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 1/7] lib: add information metrics library Remy Horton
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 2/7] app/proc_info: add metrics displaying Remy Horton
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 3/7] lib: add bitrate statistics library Remy Horton
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 6/7] lib: added new library for latency stats Remy Horton
2017-01-17 23:24 ` [dpdk-dev] [PATCH v8 7/7] app/test-pmd: add latency statistics calculation Remy Horton
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 0/7] Expanded statistics reporting Remy Horton
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 1/7] lib: add information metrics library Remy Horton
2017-01-30 15:50 ` Thomas Monjalon
2017-01-30 21:44 ` Remy Horton
2017-01-31 13:13 ` Mcnamara, John
2017-01-31 13:28 ` Bruce Richardson
2017-02-02 17:22 ` Thomas Monjalon
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 2/7] app/proc_info: add metrics displaying Remy Horton
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 3/7] lib: add bitrate statistics library Remy Horton
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 6/7] lib: added new library for latency stats Remy Horton
2017-01-18 15:05 ` [dpdk-dev] [PATCH v9 7/7] app/test-pmd: add latency statistics calculation Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 0/7] Expanded statistics reporting Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 1/7] lib: add information metrics library Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 2/7] app/proc_info: add metrics displaying Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 3/7] lib: add bitrate statistics library Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 6/7] lib: added new library for latency stats Remy Horton
2017-02-03 10:33 ` [dpdk-dev] [PATCH v10 7/7] app/test-pmd: add latency statistics calculation Remy Horton
2017-02-16 10:53 ` [dpdk-dev] [PATCH v10 0/7] Expanded statistics reporting Thomas Monjalon
2017-02-23 7:09 ` Remy Horton
2017-02-23 8:45 ` Thomas Monjalon
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 " Remy Horton
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 1/7] lib: add information metrics library Remy Horton
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 2/7] app/proc_info: add metrics displaying Remy Horton
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 3/7] lib: add bitrate statistics library Remy Horton
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 4/7] app/test-pmd: add bitrate statistics calculation Remy Horton
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 5/7] mbuf: add a timestamp to the mbuf for latencystats Remy Horton
2017-03-09 19:02 ` Stephen Hemminger
2017-03-10 9:48 ` Van Haaren, Harry
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 6/7] lib: added new library for latency stats Remy Horton
2017-03-09 16:25 ` [dpdk-dev] [PATCH v11 7/7] app/test-pmd: add latency statistics calculation Remy Horton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1479456006-10891-2-git-send-email-remy.horton@intel.com \
--to=remy.horton@intel.com \
--cc=dev@dpdk.org \
--cc=thomas.monjalon@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).