From bb9be9a45e01e09caaf3e57b0c2c68c87a925b01 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Wed, 17 Nov 2021 12:28:45 +0100 Subject: [PATCH] build: make metrics libraries optional metrics, bitratestats, jobstats and latencystats libraries can be made optional as they provide standalone features. Signed-off-by: David Marchand Acked-by: Bruce Richardson Acked-by: Thomas Monjalon --- app/proc-info/main.c | 16 ++++++++++++++++ app/proc-info/meson.build | 5 ++++- app/test-pmd/meson.build | 5 ++++- app/test-pmd/testpmd.c | 4 ++++ app/test/meson.build | 24 +++++++++++++++--------- lib/meson.build | 4 ++++ 6 files changed, 47 insertions(+), 11 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index ebe2d77264..ce140aaf84 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -29,7 +29,9 @@ #include #include #include +#ifdef RTE_LIB_METRICS #include +#endif #include #ifdef RTE_LIB_SECURITY #include @@ -58,8 +60,10 @@ static uint32_t enable_collectd_format; static int stdout_fd; /**< Host id process is running on */ static char host_id[MAX_LONG_OPT_SZ]; +#ifdef RTE_LIB_METRICS /**< Enable metrics. */ static uint32_t enable_metrics; +#endif /**< Enable stats reset. */ static uint32_t reset_stats; /**< Enable xstats reset. */ @@ -107,8 +111,10 @@ proc_info_usage(const char *prgname) " --stats: to display port statistics, enabled by default\n" " --xstats: to display extended port statistics, disabled by " "default\n" +#ifdef RTE_LIB_METRICS " --metrics: to display derived metrics of the ports, disabled by " "default\n" +#endif " --xstats-name NAME: to display single xstat id by NAME\n" " --xstats-ids IDLIST: to display xstat values by id. " "The argument is comma-separated list of xstat ids to print out.\n" @@ -217,7 +223,9 @@ proc_info_parse_args(int argc, char **argv) {"stats", 0, NULL, 0}, {"stats-reset", 0, NULL, 0}, {"xstats", 0, NULL, 0}, +#ifdef RTE_LIB_METRICS {"metrics", 0, NULL, 0}, +#endif {"xstats-reset", 0, NULL, 0}, {"xstats-name", required_argument, NULL, 1}, {"collectd-format", 0, NULL, 0}, @@ -259,10 +267,12 @@ proc_info_parse_args(int argc, char **argv) else if (!strncmp(long_option[option_index].name, "xstats", MAX_LONG_OPT_SZ)) enable_xstats = 1; +#ifdef RTE_LIB_METRICS else if (!strncmp(long_option[option_index].name, "metrics", MAX_LONG_OPT_SZ)) enable_metrics = 1; +#endif /* Reset stats */ if (!strncmp(long_option[option_index].name, "stats-reset", MAX_LONG_OPT_SZ)) @@ -592,6 +602,7 @@ nic_xstats_clear(uint16_t port_id) printf("\n NIC extended statistics for port %d cleared\n", port_id); } +#ifdef RTE_LIB_METRICS static void metrics_display(int port_id) { @@ -652,6 +663,7 @@ metrics_display(int port_id) rte_free(metrics); rte_free(names); } +#endif static void show_security_context(uint16_t portid, bool inline_offload) @@ -1521,14 +1533,18 @@ main(int argc, char **argv) else if (nb_xstats_ids > 0) nic_xstats_by_ids_display(i, xstats_ids, nb_xstats_ids); +#ifdef RTE_LIB_METRICS else if (enable_metrics) metrics_display(i); +#endif } +#ifdef RTE_LIB_METRICS /* print port independent stats */ if (enable_metrics) metrics_display(RTE_METRICS_GLOBAL); +#endif /* show information for PMD */ if (enable_shw_port) diff --git a/app/proc-info/meson.build b/app/proc-info/meson.build index 1062e0ef86..1563ce656a 100644 --- a/app/proc-info/meson.build +++ b/app/proc-info/meson.build @@ -8,4 +8,7 @@ if is_windows endif sources = files('main.c') -deps += ['ethdev', 'metrics', 'security'] +deps += ['ethdev', 'security'] +if dpdk_conf.has('RTE_LIB_METRICS') + deps += 'metrics' +endif diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index eba03b572c..43130c8856 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON') ext_deps += jansson_dep endif -deps += ['ethdev', 'cmdline', 'metrics', 'bus_pci'] +deps += ['ethdev', 'cmdline', 'bus_pci'] if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') deps += 'crypto_scheduler' endif @@ -52,6 +52,9 @@ endif if dpdk_conf.has('RTE_LIB_LATENCYSTATS') deps += 'latencystats' endif +if dpdk_conf.has('RTE_LIB_METRICS') + deps += 'metrics' +endif if dpdk_conf.has('RTE_LIB_PDUMP') deps += 'pdump' endif diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index f74ba61be6..ba65342b6d 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -54,7 +54,9 @@ #include #endif #include +#ifdef RTE_LIB_METRICS #include +#endif #ifdef RTE_LIB_BITRATESTATS #include #endif @@ -4242,8 +4244,10 @@ main(int argc, char** argv) port_id, rte_strerror(-ret)); } +#ifdef RTE_LIB_METRICS /* Init metrics library */ rte_metrics_init(rte_socket_id()); +#endif #ifdef RTE_LIB_LATENCYSTATS if (latencystats_enabled != 0) { diff --git a/app/test/meson.build b/app/test/meson.build index 2191a5e146..0d261b1138 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -98,7 +98,6 @@ test_sources = files( 'test_mempool_perf.c', 'test_memzone.c', 'test_meter.c', - 'test_metrics.c', 'test_mcslock.c', 'test_mp_secondary.c', 'test_per_lcore.c', @@ -162,7 +161,6 @@ test_deps = [ 'acl', 'bus_pci', 'bus_vdev', - 'bitratestats', 'bpf', 'cfgfile', 'cmdline', @@ -177,10 +175,8 @@ test_deps = [ 'graph', 'hash', 'ipsec', - 'latencystats', 'lpm', 'member', - 'metrics', 'node', 'pipeline', 'port', @@ -280,7 +276,6 @@ fast_tests = [ ['kni_autotest', false], ['kvargs_autotest', true], ['member_autotest', true], - ['metrics_autotest', true], ['power_cpufreq_autotest', false], ['power_autotest', true], ['power_kvm_vm_autotest', false], @@ -385,6 +380,11 @@ endif if dpdk_conf.has('RTE_EVENT_SKELETON') test_deps += 'event_skeleton' endif +if dpdk_conf.has('RTE_LIB_METRICS') + test_deps += 'metrics' + test_sources += ['test_metrics.c'] + fast_tests += [['metrics_autotest', true]] +endif if dpdk_conf.has('RTE_LIB_TELEMETRY') test_sources += ['test_telemetry_json.c', 'test_telemetry_data.c'] fast_tests += [['telemetry_json_autotest', true], ['telemetry_data_autotest', true]] @@ -406,16 +406,22 @@ if dpdk_conf.has('RTE_NET_RING') test_sources += 'test_pmd_ring_perf.c' test_sources += 'test_pmd_ring.c' test_sources += 'test_event_eth_tx_adapter.c' - test_sources += 'test_bitratestats.c' - test_sources += 'test_latencystats.c' test_sources += 'sample_packet_forward.c' test_sources += 'test_pdump.c' fast_tests += [['ring_pmd_autotest', true]] perf_test_names += 'ring_pmd_perf_autotest' fast_tests += [['event_eth_tx_adapter_autotest', false]] - fast_tests += [['bitratestats_autotest', true]] - fast_tests += [['latencystats_autotest', true]] fast_tests += [['pdump_autotest', true]] + if dpdk_conf.has('RTE_LIB_BITRATESTATS') + test_deps += 'bitratestats' + test_sources += 'test_bitratestats.c' + fast_tests += [['bitratestats_autotest', true]] + endif + if dpdk_conf.has('RTE_LIB_LATENCYSTATS') + test_deps += 'latencystats' + test_sources += 'test_latencystats.c' + fast_tests += [['latencystats_autotest', true]] + endif endif if dpdk_conf.has('RTE_HAS_LIBPCAP') diff --git a/lib/meson.build b/lib/meson.build index 2766c02bd2..961b95f4ad 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -66,9 +66,13 @@ libraries = [ ] optional_libs = [ + 'bitratestats', 'gro', 'gso', 'kni', + 'jobstats', + 'latencystats', + 'metrics', 'power', 'vhost', ] -- 2.39.5