From patchwork Wed Feb 8 08:45:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robin Jarry X-Patchwork-Id: 123445 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C6ED41C3C; Wed, 8 Feb 2023 09:45:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7AE8F41153; Wed, 8 Feb 2023 09:45:49 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8F6AA42B8E for ; Wed, 8 Feb 2023 09:45:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675845947; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g4aodA0tW4w72nTc2pJb1Tk4UYX7CGHAEkfFsVYXWdY=; b=IMxbQYWREKzvo5eLxPIC5ii93FMoURqRWLjPHW5gYh6wwWCZY7u2LPHRL8h3OO87DwRrI9 +cuAyFPfwAAgF09cG/wlFZ4pPw6uAGmQ98CjuFERcaD0GC7NXfFnyuGsUSzmFdlKarZVhJ qFMXxZCFabMQnUjMlF2CQ9sP8vzDrlI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-443-3IVMPsA5OK-gXd0R3-BiDQ-1; Wed, 08 Feb 2023 03:45:43 -0500 X-MC-Unique: 3IVMPsA5OK-gXd0R3-BiDQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ADFCF380673F; Wed, 8 Feb 2023 08:45:42 +0000 (UTC) Received: from ringo.redhat.com (unknown [10.39.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92784492C3C; Wed, 8 Feb 2023 08:45:41 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org Cc: Robin Jarry , =?utf-8?q?Morten_Br=C3=B8rup?= , Kevin Laatz Subject: [RESEND PATCH v9 1/5] eal: add lcore info in telemetry Date: Wed, 8 Feb 2023 09:45:03 +0100 Message-Id: <20230208084507.1328625-2-rjarry@redhat.com> In-Reply-To: <20230208084507.1328625-1-rjarry@redhat.com> References: <20221123102612.1688865-1-rjarry@redhat.com> <20230208084507.1328625-1-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Report the same information than rte_lcore_dump() in the telemetry API into /eal/lcore/list and /eal/lcore/info,ID. Example: --> /eal/lcore/info,3 { "/eal/lcore/info": { "lcore_id": 3, "socket": 0, "role": "RTE", "cpuset": [ 3 ] } } Signed-off-by: Robin Jarry Acked-by: Morten Brørup Reviewed-by: Kevin Laatz --- Notes: v8 -> v9: Updated with 64 bits integers telemetry functions lib/eal/common/eal_common_lcore.c | 123 +++++++++++++++++++++++++----- 1 file changed, 105 insertions(+), 18 deletions(-) diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c index 06c594b0224f..f53fc17b4d04 100644 --- a/lib/eal/common/eal_common_lcore.c +++ b/lib/eal/common/eal_common_lcore.c @@ -10,6 +10,9 @@ #include #include #include +#ifndef RTE_EXEC_ENV_WINDOWS +#include +#endif #include "eal_private.h" #include "eal_thread.h" @@ -419,35 +422,35 @@ rte_lcore_iterate(rte_lcore_iterate_cb cb, void *arg) return ret; } +static const char * +lcore_role_str(enum rte_lcore_role_t role) +{ + switch (role) { + case ROLE_RTE: + return "RTE"; + case ROLE_SERVICE: + return "SERVICE"; + case ROLE_NON_EAL: + return "NON_EAL"; + default: + return "UNKNOWN"; + } +} + static int lcore_dump_cb(unsigned int lcore_id, void *arg) { struct rte_config *cfg = rte_eal_get_configuration(); char cpuset[RTE_CPU_AFFINITY_STR_LEN]; - const char *role; FILE *f = arg; int ret; - switch (cfg->lcore_role[lcore_id]) { - case ROLE_RTE: - role = "RTE"; - break; - case ROLE_SERVICE: - role = "SERVICE"; - break; - case ROLE_NON_EAL: - role = "NON_EAL"; - break; - default: - role = "UNKNOWN"; - break; - } - ret = eal_thread_dump_affinity(&lcore_config[lcore_id].cpuset, cpuset, sizeof(cpuset)); fprintf(f, "lcore %u, socket %u, role %s, cpuset %s%s\n", lcore_id, - rte_lcore_to_socket_id(lcore_id), role, cpuset, - ret == 0 ? "" : "..."); + rte_lcore_to_socket_id(lcore_id), + lcore_role_str(cfg->lcore_role[lcore_id]), + cpuset, ret == 0 ? "" : "..."); return 0; } @@ -456,3 +459,87 @@ rte_lcore_dump(FILE *f) { rte_lcore_iterate(lcore_dump_cb, f); } + +#ifndef RTE_EXEC_ENV_WINDOWS +static int +lcore_telemetry_id_cb(unsigned int lcore_id, void *arg) +{ + struct rte_tel_data *d = arg; + return rte_tel_data_add_array_int(d, lcore_id); +} + +static int +handle_lcore_list(const char *cmd __rte_unused, + const char *params __rte_unused, + struct rte_tel_data *d) +{ + int ret = rte_tel_data_start_array(d, RTE_TEL_INT_VAL); + if (ret) + return ret; + return rte_lcore_iterate(lcore_telemetry_id_cb, d); +} + +struct lcore_telemetry_info { + unsigned int lcore_id; + struct rte_tel_data *d; +}; + +static int +lcore_telemetry_info_cb(unsigned int lcore_id, void *arg) +{ + struct rte_config *cfg = rte_eal_get_configuration(); + struct lcore_telemetry_info *info = arg; + struct rte_tel_data *cpuset; + unsigned int cpu; + + if (info->lcore_id != lcore_id) + return 0; + + rte_tel_data_start_dict(info->d); + rte_tel_data_add_dict_int(info->d, "lcore_id", lcore_id); + rte_tel_data_add_dict_int(info->d, "socket", rte_lcore_to_socket_id(lcore_id)); + rte_tel_data_add_dict_string(info->d, "role", lcore_role_str(cfg->lcore_role[lcore_id])); + cpuset = rte_tel_data_alloc(); + if (cpuset == NULL) + return -ENOMEM; + rte_tel_data_start_array(cpuset, RTE_TEL_INT_VAL); + for (cpu = 0; cpu < CPU_SETSIZE; cpu++) { + if (CPU_ISSET(cpu, &lcore_config[lcore_id].cpuset)) + rte_tel_data_add_array_int(cpuset, cpu); + } + rte_tel_data_add_dict_container(info->d, "cpuset", cpuset, 0); + + return 0; +} + +static int +handle_lcore_info(const char *cmd __rte_unused, const char *params, struct rte_tel_data *d) +{ + struct lcore_telemetry_info info = { .d = d }; + unsigned long lcore_id; + char *endptr; + + if (params == NULL) + return -EINVAL; + errno = 0; + lcore_id = strtoul(params, &endptr, 10); + if (errno) + return -errno; + if (*params == '\0' || *endptr != '\0' || lcore_id >= RTE_MAX_LCORE) + return -EINVAL; + + info.lcore_id = lcore_id; + + return rte_lcore_iterate(lcore_telemetry_info_cb, &info); +} + +RTE_INIT(lcore_telemetry) +{ + rte_telemetry_register_cmd( + "/eal/lcore/list", handle_lcore_list, + "List of lcore ids. Takes no parameters"); + rte_telemetry_register_cmd( + "/eal/lcore/info", handle_lcore_info, + "Returns lcore info. Parameters: int lcore_id"); +} +#endif /* !RTE_EXEC_ENV_WINDOWS */ From patchwork Wed Feb 8 08:45:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robin Jarry X-Patchwork-Id: 123444 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 800EE41C3C; Wed, 8 Feb 2023 09:45:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E0E542B7E; Wed, 8 Feb 2023 09:45:47 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 13A5C410EE for ; Wed, 8 Feb 2023 09:45:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675845945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PmbNxnRhq+kMZ2tOy3UHLl2BJLERZizXGdAHkCzHCZ0=; b=XDxpGQaJgtB6ZD+Zd2DGdt/xe1PTYk7KJQyvXvikHAnDcsY7vUg6oTs2u3YSvtZWeu86ov 1xBXCaSg5qILRuALfT5oa/8sqZLI3TQm4Ptmz7LtBJN4ICjPUT7Hhi1Ub6ZZ/XOLSb+Xmt uvXeHqMHut8j6mfoT9ZgQZ6rzWNKbic= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-278-opywiLWEOxiGiv5aVdwLlQ-1; Wed, 08 Feb 2023 03:45:44 -0500 X-MC-Unique: opywiLWEOxiGiv5aVdwLlQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2745B3C02190; Wed, 8 Feb 2023 08:45:44 +0000 (UTC) Received: from ringo.redhat.com (unknown [10.39.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E9AE492C3C; Wed, 8 Feb 2023 08:45:42 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org Cc: Robin Jarry , =?utf-8?q?Morten_Br=C3=B8rup?= , Kevin Laatz Subject: [RESEND PATCH v9 2/5] eal: report applications lcore usage Date: Wed, 8 Feb 2023 09:45:04 +0100 Message-Id: <20230208084507.1328625-3-rjarry@redhat.com> In-Reply-To: <20230208084507.1328625-1-rjarry@redhat.com> References: <20221123102612.1688865-1-rjarry@redhat.com> <20230208084507.1328625-1-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Allow applications to register a callback that will be invoked in rte_lcore_dump() and when requesting lcore info in the telemetry API. The callback is expected to return the number of TSC cycles that have passed since application start and the number of these cycles that were spent doing busy work. Signed-off-by: Robin Jarry Acked-by: Morten Brørup Reviewed-by: Kevin Laatz --- Notes: v8 -> v9: - Fixed changelog & version.map order. - Updated with 64-bit integer telemetry functions. - Refined docstrings (added notice about resetting the callback). doc/guides/rel_notes/release_23_03.rst | 7 ++++ lib/eal/common/eal_common_lcore.c | 40 +++++++++++++++++++-- lib/eal/include/rte_lcore.h | 48 ++++++++++++++++++++++++++ lib/eal/version.map | 1 + 4 files changed, 94 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index 1fa101c420cd..17d38d5ea264 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -55,6 +55,13 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added support for reporting lcore usage in applications.** + + * The ``/eal/lcore/list`` and ``/eal/lcore/info`` telemetry endpoints have + been added to provide information similar to ``rte_lcore_dump()``. + * Applications can register a callback at startup via + ``rte_lcore_register_usage_cb()`` to provide lcore usage information. + * **Updated AMD axgbe driver.** * Added multi-process support. diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c index f53fc17b4d04..fcda7c50119a 100644 --- a/lib/eal/common/eal_common_lcore.c +++ b/lib/eal/common/eal_common_lcore.c @@ -2,6 +2,7 @@ * Copyright(c) 2010-2014 Intel Corporation */ +#include #include #include @@ -437,20 +438,45 @@ lcore_role_str(enum rte_lcore_role_t role) } } +static rte_lcore_usage_cb lcore_usage_cb; + +void +rte_lcore_register_usage_cb(rte_lcore_usage_cb cb) +{ + lcore_usage_cb = cb; +} + static int lcore_dump_cb(unsigned int lcore_id, void *arg) { struct rte_config *cfg = rte_eal_get_configuration(); char cpuset[RTE_CPU_AFFINITY_STR_LEN]; + struct rte_lcore_usage usage; + rte_lcore_usage_cb usage_cb; + char *usage_str = NULL; FILE *f = arg; int ret; + /* The callback may not set all the fields in the structure, so clear it here. */ + memset(&usage, 0, sizeof(usage)); + /* Guard against concurrent modification of lcore_usage_cb. */ + usage_cb = lcore_usage_cb; + if (usage_cb != NULL && usage_cb(lcore_id, &usage) == 0) { + if (asprintf(&usage_str, ", busy cycles %"PRIu64"/%"PRIu64, + usage.busy_cycles, usage.total_cycles) < 0) { + return -ENOMEM; + } + } ret = eal_thread_dump_affinity(&lcore_config[lcore_id].cpuset, cpuset, sizeof(cpuset)); - fprintf(f, "lcore %u, socket %u, role %s, cpuset %s%s\n", lcore_id, + fprintf(f, "lcore %u, socket %u, role %s, cpuset %s%s%s\n", lcore_id, rte_lcore_to_socket_id(lcore_id), lcore_role_str(cfg->lcore_role[lcore_id]), - cpuset, ret == 0 ? "" : "..."); + cpuset, ret == 0 ? "" : "...", + usage_str != NULL ? usage_str : ""); + + free(usage_str); + return 0; } @@ -489,7 +515,9 @@ lcore_telemetry_info_cb(unsigned int lcore_id, void *arg) { struct rte_config *cfg = rte_eal_get_configuration(); struct lcore_telemetry_info *info = arg; + struct rte_lcore_usage usage; struct rte_tel_data *cpuset; + rte_lcore_usage_cb usage_cb; unsigned int cpu; if (info->lcore_id != lcore_id) @@ -508,6 +536,14 @@ lcore_telemetry_info_cb(unsigned int lcore_id, void *arg) rte_tel_data_add_array_int(cpuset, cpu); } rte_tel_data_add_dict_container(info->d, "cpuset", cpuset, 0); + /* The callback may not set all the fields in the structure, so clear it here. */ + memset(&usage, 0, sizeof(usage)); + /* Guard against concurrent modification of lcore_usage_cb. */ + usage_cb = lcore_usage_cb; + if (usage_cb != NULL && usage_cb(lcore_id, &usage) == 0) { + rte_tel_data_add_dict_uint(info->d, "total_cycles", usage.total_cycles); + rte_tel_data_add_dict_uint(info->d, "busy_cycles", usage.busy_cycles); + } return 0; } diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h index 9c7865052100..30f83f4d578c 100644 --- a/lib/eal/include/rte_lcore.h +++ b/lib/eal/include/rte_lcore.h @@ -328,6 +328,54 @@ typedef int (*rte_lcore_iterate_cb)(unsigned int lcore_id, void *arg); int rte_lcore_iterate(rte_lcore_iterate_cb cb, void *arg); +/** + * lcore usage statistics. + */ +struct rte_lcore_usage { + /** + * The total amount of time that the application has been running on + * this lcore, in TSC cycles. + */ + uint64_t total_cycles; + /** + * The amount of time the application was busy, handling some + * workload on this lcore, in TSC cycles. + */ + uint64_t busy_cycles; +}; + +/** + * Callback to allow applications to report lcore usage. + * + * @param [in] lcore_id + * The lcore to consider. + * @param [out] usage + * Counters representing this lcore usage. This can never be NULL. + * @return + * - 0 if fields in usage were updated successfully. The fields that the + * application does not support must not be modified. + * - a negative value if the information is not available or if any error occurred. + */ +typedef int (*rte_lcore_usage_cb)(unsigned int lcore_id, struct rte_lcore_usage *usage); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Register a callback from an application to be called in rte_lcore_dump() and + * the /eal/lcore/info telemetry endpoint handler. Applications are expected to + * report lcore usage statistics via this callback. + * + * If a callback was already registered, it can be replaced with another callback + * or unregistered with NULL. The previously registered callback may remain in + * use for an undetermined period of time. + * + * @param cb + * The callback function. + */ +__rte_experimental +void rte_lcore_register_usage_cb(rte_lcore_usage_cb cb); + /** * List all lcores. * diff --git a/lib/eal/version.map b/lib/eal/version.map index 6523102157e2..2c05e5f2fb60 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -441,6 +441,7 @@ EXPERIMENTAL { rte_thread_join; # added in 23.03 + rte_lcore_register_usage_cb; rte_thread_set_name; }; From patchwork Wed Feb 8 08:45:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robin Jarry X-Patchwork-Id: 123446 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DE6141C3C; Wed, 8 Feb 2023 09:45:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1FB242C54; Wed, 8 Feb 2023 09:45:53 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id D724242B8E for ; Wed, 8 Feb 2023 09:45:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675845952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HB28pzaI5uDodFI0U3c8O8TCBJiuRs80pNflxgbZrvY=; b=LN5uNfZATdO7/1Sli3WOgcCQ9snutH1TqCftCQgHagxRezLYTfMtk4MkJvnE01LWGTH/Ra OL5z4yztQ+xfDuTlesoY0hZqLcP2ggDUUVrwU1ZDL+09/2ig05VcWjuHmMuItLLA8/oC3w L2h8UQWArBVFI+O1jgvCQZarF9uu35c= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-NnBaefjiOZmvqP-35tMb_Q-1; Wed, 08 Feb 2023 03:45:46 -0500 X-MC-Unique: NnBaefjiOZmvqP-35tMb_Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28116857AA1; Wed, 8 Feb 2023 08:45:46 +0000 (UTC) Received: from ringo.redhat.com (unknown [10.39.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 828D7492C3C; Wed, 8 Feb 2023 08:45:44 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org Cc: Robin Jarry , =?utf-8?q?Morten_Br=C3=B8rup?= , Konstantin Ananyev , Kevin Laatz , Aman Singh , Yuying Zhang Subject: [RESEND PATCH v9 3/5] app/testpmd: add dump command for lcores Date: Wed, 8 Feb 2023 09:45:05 +0100 Message-Id: <20230208084507.1328625-4-rjarry@redhat.com> In-Reply-To: <20230208084507.1328625-1-rjarry@redhat.com> References: <20221123102612.1688865-1-rjarry@redhat.com> <20230208084507.1328625-1-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add a simple command that calls rte_lcore_dump(). Signed-off-by: Robin Jarry Acked-by: Morten Brørup Acked-by: Konstantin Ananyev Reviewed-by: Kevin Laatz --- Notes: v8 -> v9: no change app/test-pmd/cmdline.c | 3 +++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index cb8c174020b0..bb7ff2b44989 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -8357,6 +8357,8 @@ static void cmd_dump_parsed(void *parsed_result, rte_mempool_list_dump(stdout); else if (!strcmp(res->dump, "dump_devargs")) rte_devargs_dump(stdout); + else if (!strcmp(res->dump, "dump_lcores")) + rte_lcore_dump(stdout); else if (!strcmp(res->dump, "dump_log_types")) rte_log_dump(stdout); } @@ -8370,6 +8372,7 @@ static cmdline_parse_token_string_t cmd_dump_dump = "dump_ring#" "dump_mempool#" "dump_devargs#" + "dump_lcores#" "dump_log_types"); static cmdline_parse_inst_t cmd_dump = { diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 79a1fa9cb73d..9ceb21dfbbdf 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -591,6 +591,13 @@ Dumps the user device list:: testpmd> dump_devargs +dump lcores +~~~~~~~~~~~ + +Dumps the logical cores list:: + + testpmd> dump_lcores + dump log types ~~~~~~~~~~~~~~ From patchwork Wed Feb 8 08:45:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robin Jarry X-Patchwork-Id: 123448 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7858C41C3C; Wed, 8 Feb 2023 09:49:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6133A40141; Wed, 8 Feb 2023 09:49:04 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 0F829400D6 for ; Wed, 8 Feb 2023 09:49:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675846142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2YKjJYqCIhopAU/3ZXeketZLTEOrs3PSm9c1aNIIK0A=; b=icZTAQ6nzkzlsFetKUWubH/RUclszGHDbv0VdukVl81laMSKTQ6R5v/MDR40h+ynwH0aGY A7heXZ31cmuPrR7SsPc7hSP/HV2Y8HgnwkWGB7/3rdXEegUu86lYLPXDGkHEsjokgj+xSq LguUP3bKMr5Lke+aulwzj1W6FzQe2gY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-7-iHCudSBSNLewFzfsxv7mnw-1; Wed, 08 Feb 2023 03:45:48 -0500 X-MC-Unique: iHCudSBSNLewFzfsxv7mnw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D0A4857D07; Wed, 8 Feb 2023 08:45:48 +0000 (UTC) Received: from ringo.redhat.com (unknown [10.39.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83535492C3C; Wed, 8 Feb 2023 08:45:46 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org Cc: Robin Jarry , =?utf-8?q?Morten_Br=C3=B8rup?= , Konstantin Ananyev , Kevin Laatz , Aman Singh , Yuying Zhang Subject: [RESEND PATCH v9 4/5] app/testpmd: report lcore usage Date: Wed, 8 Feb 2023 09:45:06 +0100 Message-Id: <20230208084507.1328625-5-rjarry@redhat.com> In-Reply-To: <20230208084507.1328625-1-rjarry@redhat.com> References: <20221123102612.1688865-1-rjarry@redhat.com> <20230208084507.1328625-1-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The --record-core-cycles option already accounts for busy cycles. One turn of packet_fwd_t is considered "busy" if there was at least one received or transmitted packet. Rename core_cycles to busy_cycles in struct fwd_stream to make it more explicit. Add total_cycles to struct fwd_lcore. Add cycles accounting in noisy_vnf where it was missing. When --record-core-cycles is specified, register a callback with rte_lcore_register_usage_cb() and update total_cycles every turn of lcore loop based on a starting tsc value. In the callback, resolve the proper struct fwd_lcore based on lcore_id and return the lcore total_cycles and the sum of busy_cycles of all its fwd_streams. This makes the cycles counters available in rte_lcore_dump() and the lcore telemetry API: testpmd> dump_lcores lcore 3, socket 0, role RTE, cpuset 3 lcore 4, socket 0, role RTE, cpuset 4, busy cycles 1228584096/9239923140 lcore 5, socket 0, role RTE, cpuset 5, busy cycles 1255661768/9218141538 --> /eal/lcore/info,4 { "/eal/lcore/info": { "lcore_id": 4, "socket": 0, "role": "RTE", "cpuset": [ 4 ], "busy_cycles": 10623340318, "total_cycles": 55331167354 } } Signed-off-by: Robin Jarry Acked-by: Morten Brørup Acked-by: Konstantin Ananyev Reviewed-by: Kevin Laatz --- Notes: v8 -> v9: Fixed accounting of total cycles app/test-pmd/noisy_vnf.c | 8 +++++++- app/test-pmd/testpmd.c | 42 ++++++++++++++++++++++++++++++++++++---- app/test-pmd/testpmd.h | 25 +++++++++++++++--------- 3 files changed, 61 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c index c65ec6f06a5c..ce5a3e5e6987 100644 --- a/app/test-pmd/noisy_vnf.c +++ b/app/test-pmd/noisy_vnf.c @@ -144,6 +144,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs) struct noisy_config *ncf = noisy_cfg[fs->rx_port]; struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *tmp_pkts[MAX_PKT_BURST]; + uint64_t start_tsc = 0; uint16_t nb_deqd = 0; uint16_t nb_rx = 0; uint16_t nb_tx = 0; @@ -153,6 +154,8 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs) bool needs_flush = false; uint64_t now; + get_start_cycles(&start_tsc); + nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst, nb_pkt_per_burst); inc_rx_burst_stats(fs, nb_rx); @@ -169,7 +172,7 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs) inc_tx_burst_stats(fs, nb_tx); fs->tx_packets += nb_tx; fs->fwd_dropped += drop_pkts(pkts_burst, nb_rx, nb_tx); - return; + goto end; } fifo_free = rte_ring_free_count(ncf->f); @@ -219,6 +222,9 @@ pkt_burst_noisy_vnf(struct fwd_stream *fs) fs->fwd_dropped += drop_pkts(tmp_pkts, nb_deqd, sent); ncf->prev_time = rte_get_timer_cycles(); } +end: + if (nb_rx > 0 || nb_tx > 0) + get_end_cycles(fs, start_tsc); } #define NOISY_STRSIZE 256 diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e366f81a0f46..eeb96aefa80b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2053,7 +2053,7 @@ fwd_stats_display(void) fs->rx_bad_outer_ip_csum; if (record_core_cycles) - fwd_cycles += fs->core_cycles; + fwd_cycles += fs->busy_cycles; } for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { pt_id = fwd_ports_ids[i]; @@ -2145,7 +2145,7 @@ fwd_stats_display(void) else total_pkts = total_recv; - printf("\n CPU cycles/packet=%.2F (total cycles=" + printf("\n CPU cycles/packet=%.2F (busy cycles=" "%"PRIu64" / total %s packets=%"PRIu64") at %"PRIu64 " MHz Clock\n", (double) fwd_cycles / total_pkts, @@ -2184,8 +2184,10 @@ fwd_stats_reset(void) memset(&fs->rx_burst_stats, 0, sizeof(fs->rx_burst_stats)); memset(&fs->tx_burst_stats, 0, sizeof(fs->tx_burst_stats)); - fs->core_cycles = 0; + fs->busy_cycles = 0; } + for (i = 0; i < cur_fwd_config.nb_fwd_lcores; i++) + fwd_lcores[i]->total_cycles = 0; } static void @@ -2248,6 +2250,7 @@ static void run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) { struct fwd_stream **fsm; + uint64_t start_tsc; streamid_t nb_fs; streamid_t sm_id; #ifdef RTE_LIB_BITRATESTATS @@ -2262,6 +2265,7 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) #endif fsm = &fwd_streams[fc->stream_idx]; nb_fs = fc->stream_nb; + start_tsc = rte_rdtsc(); do { for (sm_id = 0; sm_id < nb_fs; sm_id++) if (!fsm[sm_id]->disabled) @@ -2284,10 +2288,36 @@ run_pkt_fwd_on_lcore(struct fwd_lcore *fc, packet_fwd_t pkt_fwd) latencystats_lcore_id == rte_lcore_id()) rte_latencystats_update(); #endif - + if (record_core_cycles) + fc->total_cycles = rte_rdtsc() - start_tsc; } while (! fc->stopped); } +static int +lcore_usage_callback(unsigned int lcore_id, struct rte_lcore_usage *usage) +{ + struct fwd_stream **fsm; + struct fwd_lcore *fc; + streamid_t nb_fs; + streamid_t sm_id; + + fc = lcore_to_fwd_lcore(lcore_id); + if (fc == NULL) + return -1; + + fsm = &fwd_streams[fc->stream_idx]; + nb_fs = fc->stream_nb; + usage->busy_cycles = 0; + usage->total_cycles = fc->total_cycles; + + for (sm_id = 0; sm_id < nb_fs; sm_id++) { + if (!fsm[sm_id]->disabled) + usage->busy_cycles += fsm[sm_id]->busy_cycles; + } + + return 0; +} + static int start_pkt_forward_on_core(void *fwd_arg) { @@ -4527,6 +4557,10 @@ main(int argc, char** argv) rte_stats_bitrate_reg(bitrate_data); } #endif + + if (record_core_cycles) + rte_lcore_register_usage_cb(lcore_usage_callback); + #ifdef RTE_LIB_CMDLINE if (init_cmdline() != 0) rte_exit(EXIT_FAILURE, diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 7d24d25970d2..6ec2f6879b47 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -174,7 +174,7 @@ struct fwd_stream { #ifdef RTE_LIB_GRO unsigned int gro_times; /**< GRO operation times */ #endif - uint64_t core_cycles; /**< used for RX and TX processing */ + uint64_t busy_cycles; /**< used with --record-core-cycles */ struct pkt_burst_stats rx_burst_stats; struct pkt_burst_stats tx_burst_stats; struct fwd_lcore *lcore; /**< Lcore being scheduled. */ @@ -360,6 +360,7 @@ struct fwd_lcore { streamid_t stream_nb; /**< number of streams in "fwd_streams" */ lcoreid_t cpuid_idx; /**< index of logical core in CPU id table */ volatile char stopped; /**< stop forwarding when set */ + uint64_t total_cycles; /**< used with --record-core-cycles */ }; /* @@ -785,16 +786,17 @@ is_proc_primary(void) return rte_eal_process_type() == RTE_PROC_PRIMARY; } -static inline unsigned int -lcore_num(void) +static inline struct fwd_lcore * +lcore_to_fwd_lcore(uint16_t lcore_id) { unsigned int i; - for (i = 0; i < RTE_MAX_LCORE; ++i) - if (fwd_lcores_cpuids[i] == rte_lcore_id()) - return i; + for (i = 0; i < cur_fwd_config.nb_fwd_lcores; ++i) { + if (fwd_lcores_cpuids[i] == lcore_id) + return fwd_lcores[i]; + } - rte_panic("lcore_id of current thread not found in fwd_lcores_cpuids\n"); + return NULL; } void @@ -803,7 +805,12 @@ parse_fwd_portlist(const char *port); static inline struct fwd_lcore * current_fwd_lcore(void) { - return fwd_lcores[lcore_num()]; + struct fwd_lcore *fc = lcore_to_fwd_lcore(rte_lcore_id()); + + if (fc == NULL) + rte_panic("lcore_id of current thread not found in fwd_lcores_cpuids\n"); + + return fc; } /* Mbuf Pools */ @@ -839,7 +846,7 @@ static inline void get_end_cycles(struct fwd_stream *fs, uint64_t start_tsc) { if (record_core_cycles) - fs->core_cycles += rte_rdtsc() - start_tsc; + fs->busy_cycles += rte_rdtsc() - start_tsc; } static inline void From patchwork Wed Feb 8 08:45:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Jarry X-Patchwork-Id: 123447 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C7E841C3C; Wed, 8 Feb 2023 09:46:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FE7142BD9; Wed, 8 Feb 2023 09:45:58 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 136A742C4D for ; Wed, 8 Feb 2023 09:45:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675845956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sUIaYtxK64a4+Pe43pleFN9m60Ys9Uhyd8DlUAo1V5k=; b=NRmRuGoozzI04v1r5JIUiFgLDwizG1kxkrSEiLQANjkRLHCeYXfPxkPuQaiSZPN9H/LoPn 2pPGvX4lJwWOq0QK44PrUmxYm7bgAyskgSvST/m//j0Z+GTAebfwV4FK9CIk3yLdO0/9sd yenEqF3B1Q4LZHjurfc60a/q0phPnbY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-592-6mip5m9EPkK9N_oCvnw4tw-1; Wed, 08 Feb 2023 03:45:49 -0500 X-MC-Unique: 6mip5m9EPkK9N_oCvnw4tw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 652B7101A521; Wed, 8 Feb 2023 08:45:49 +0000 (UTC) Received: from ringo.redhat.com (unknown [10.39.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C50A492C3C; Wed, 8 Feb 2023 08:45:48 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org Cc: Robin Jarry , Kevin Laatz Subject: [RESEND PATCH v9 5/5] eal: add lcore usage telemetry endpoint Date: Wed, 8 Feb 2023 09:45:07 +0100 Message-Id: <20230208084507.1328625-6-rjarry@redhat.com> In-Reply-To: <20230208084507.1328625-1-rjarry@redhat.com> References: <20221123102612.1688865-1-rjarry@redhat.com> <20230208084507.1328625-1-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Allow fetching CPU cycles usage for all lcores with a single request. This endpoint is intended for repeated and frequent invocations by external monitoring systems and therefore returns condensed data. It consists of a single dictionary with three keys: "lcore_ids", "total_cycles" and "busy_cycles" that are mapped to three arrays of integer values. Each array has the same number of values, one per lcore, in the same order. Example: --> /eal/lcore/usage { "/eal/lcore/usage": { "lcore_ids": [ 4, 5 ], "total_cycles": [ 23846845590, 23900558914 ], "busy_cycles": [ 21043446682, 21448837316 ] } } Signed-off-by: Robin Jarry Reviewed-by: Kevin Laatz --- Notes: v8 -> v9: Updated with 64 bits integer telemetry functions doc/guides/rel_notes/release_23_03.rst | 5 ++- lib/eal/common/eal_common_lcore.c | 60 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/doc/guides/rel_notes/release_23_03.rst b/doc/guides/rel_notes/release_23_03.rst index 17d38d5ea264..4f2878846829 100644 --- a/doc/guides/rel_notes/release_23_03.rst +++ b/doc/guides/rel_notes/release_23_03.rst @@ -57,8 +57,9 @@ New Features * **Added support for reporting lcore usage in applications.** - * The ``/eal/lcore/list`` and ``/eal/lcore/info`` telemetry endpoints have - been added to provide information similar to ``rte_lcore_dump()``. + * The ``/eal/lcore/list``, ``/eal/lcore/usage`` and ``/eal/lcore/info`` + telemetry endpoints have been added to provide information similar to + ``rte_lcore_dump()``. * Applications can register a callback at startup via ``rte_lcore_register_usage_cb()`` to provide lcore usage information. diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c index fcda7c50119a..088adb14b4b6 100644 --- a/lib/eal/common/eal_common_lcore.c +++ b/lib/eal/common/eal_common_lcore.c @@ -569,6 +569,63 @@ handle_lcore_info(const char *cmd __rte_unused, const char *params, struct rte_t return rte_lcore_iterate(lcore_telemetry_info_cb, &info); } +struct lcore_telemetry_usage { + struct rte_tel_data *lcore_ids; + struct rte_tel_data *total_cycles; + struct rte_tel_data *busy_cycles; +}; + +static int +lcore_telemetry_usage_cb(unsigned int lcore_id, void *arg) +{ + struct lcore_telemetry_usage *u = arg; + struct rte_lcore_usage usage; + rte_lcore_usage_cb usage_cb; + + /* The callback may not set all the fields in the structure, so clear it here. */ + memset(&usage, 0, sizeof(usage)); + /* Guard against concurrent modification of lcore_usage_cb. */ + usage_cb = lcore_usage_cb; + if (usage_cb != NULL && usage_cb(lcore_id, &usage) == 0) { + rte_tel_data_add_array_uint(u->lcore_ids, lcore_id); + rte_tel_data_add_array_uint(u->total_cycles, usage.total_cycles); + rte_tel_data_add_array_uint(u->busy_cycles, usage.busy_cycles); + } + + return 0; +} + +static int +handle_lcore_usage(const char *cmd __rte_unused, + const char *params __rte_unused, + struct rte_tel_data *d) +{ + struct lcore_telemetry_usage usage; + struct rte_tel_data *lcore_ids = rte_tel_data_alloc(); + struct rte_tel_data *total_cycles = rte_tel_data_alloc(); + struct rte_tel_data *busy_cycles = rte_tel_data_alloc(); + + if (!lcore_ids || !total_cycles || !busy_cycles) { + rte_tel_data_free(lcore_ids); + rte_tel_data_free(total_cycles); + rte_tel_data_free(busy_cycles); + return -ENOMEM; + } + + rte_tel_data_start_dict(d); + rte_tel_data_start_array(lcore_ids, RTE_TEL_UINT_VAL); + rte_tel_data_start_array(total_cycles, RTE_TEL_UINT_VAL); + rte_tel_data_start_array(busy_cycles, RTE_TEL_UINT_VAL); + rte_tel_data_add_dict_container(d, "lcore_ids", lcore_ids, 0); + rte_tel_data_add_dict_container(d, "total_cycles", total_cycles, 0); + rte_tel_data_add_dict_container(d, "busy_cycles", busy_cycles, 0); + usage.lcore_ids = lcore_ids; + usage.total_cycles = total_cycles; + usage.busy_cycles = busy_cycles; + + return rte_lcore_iterate(lcore_telemetry_usage_cb, &usage); +} + RTE_INIT(lcore_telemetry) { rte_telemetry_register_cmd( @@ -577,5 +634,8 @@ RTE_INIT(lcore_telemetry) rte_telemetry_register_cmd( "/eal/lcore/info", handle_lcore_info, "Returns lcore info. Parameters: int lcore_id"); + rte_telemetry_register_cmd( + "/eal/lcore/usage", handle_lcore_usage, + "Returns lcore cycles usage. Takes no parameters"); } #endif /* !RTE_EXEC_ENV_WINDOWS */