DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] eventdev/timer_adapter: add telemetry support
@ 2022-04-26  3:59 Ankur Dwivedi
  2022-05-16  9:58 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Ankur Dwivedi @ 2022-04-26  3:59 UTC (permalink / raw)
  To: dev; +Cc: jerinj, erik.g.carrillo, pbhagavatula, gmuthukrishn, Ankur Dwivedi

Adds telemetry support to get timer adapter info and timer adapter
statistics.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
---
 lib/eventdev/rte_event_timer_adapter.c | 91 ++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c
index 7dc39386c9..e0d978d641 100644
--- a/lib/eventdev/rte_event_timer_adapter.c
+++ b/lib/eventdev/rte_event_timer_adapter.c
@@ -14,6 +14,7 @@
 #include <rte_common.h>
 #include <rte_timer.h>
 #include <rte_service_component.h>
+#include <rte_telemetry.h>
 
 #include "event_timer_adapter_pmd.h"
 #include "eventdev_pmd.h"
@@ -1249,3 +1250,93 @@ static const struct event_timer_adapter_ops swtim_ops = {
 	.arm_tmo_tick_burst = swtim_arm_tmo_tick_burst,
 	.cancel_burst = swtim_cancel_burst,
 };
+
+static int
+handle_ta_info(const char *cmd __rte_unused, const char *params,
+		struct rte_tel_data *d)
+{
+	struct rte_event_timer_adapter_info adapter_info;
+	struct rte_event_timer_adapter *adapter;
+	uint16_t adapter_id;
+	int ret;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -1;
+
+	adapter_id = atoi(params);
+
+	if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) {
+		EVTIM_LOG_ERR("Invalid timer adapter id %u", adapter_id);
+		return -EINVAL;
+	}
+
+	adapter = &adapters[adapter_id];
+
+	ret = rte_event_timer_adapter_get_info(adapter, &adapter_info);
+	if (ret < 0) {
+		EVTIM_LOG_ERR("Failed to get info for timer adapter id %u", adapter_id);
+		return ret;
+	}
+
+	rte_tel_data_start_dict(d);
+	rte_tel_data_add_dict_u64(d, "timer_adapter_id", adapter_id);
+	rte_tel_data_add_dict_u64(d, "min_resolution_ns", adapter_info.min_resolution_ns);
+	rte_tel_data_add_dict_u64(d, "max_tmo_ns", adapter_info.max_tmo_ns);
+	rte_tel_data_add_dict_u64(d, "event_dev_id", adapter_info.conf.event_dev_id);
+	rte_tel_data_add_dict_u64(d, "socket_id", adapter_info.conf.socket_id);
+	rte_tel_data_add_dict_u64(d, "clk_src", adapter_info.conf.clk_src);
+	rte_tel_data_add_dict_u64(d, "timer_tick_ns", adapter_info.conf.timer_tick_ns);
+	rte_tel_data_add_dict_u64(d, "nb_timers", adapter_info.conf.nb_timers);
+	rte_tel_data_add_dict_u64(d, "flags", adapter_info.conf.flags);
+
+	return 0;
+}
+
+static int
+handle_ta_stats(const char *cmd __rte_unused, const char *params,
+		struct rte_tel_data *d)
+{
+	struct rte_event_timer_adapter_stats stats;
+	struct rte_event_timer_adapter *adapter;
+	uint16_t adapter_id;
+	int ret;
+
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -1;
+
+	adapter_id = atoi(params);
+
+	if (adapter_id >= RTE_EVENT_TIMER_ADAPTER_NUM_MAX) {
+		EVTIM_LOG_ERR("Invalid timer adapter id %u", adapter_id);
+		return -EINVAL;
+	}
+
+	adapter = &adapters[adapter_id];
+
+	ret = rte_event_timer_adapter_stats_get(adapter, &stats);
+	if (ret < 0) {
+		EVTIM_LOG_ERR("Failed to get stats for timer adapter id %u", adapter_id);
+		return ret;
+	}
+
+	rte_tel_data_start_dict(d);
+	rte_tel_data_add_dict_u64(d, "timer_adapter_id", adapter_id);
+	rte_tel_data_add_dict_u64(d, "evtim_exp_count", stats.evtim_exp_count);
+	rte_tel_data_add_dict_u64(d, "ev_enq_count", stats.ev_enq_count);
+	rte_tel_data_add_dict_u64(d, "ev_inv_count", stats.ev_inv_count);
+	rte_tel_data_add_dict_u64(d, "evtim_retry_count", stats.evtim_retry_count);
+	rte_tel_data_add_dict_u64(d, "adapter_tick_count", stats.adapter_tick_count);
+
+	return 0;
+}
+
+RTE_INIT(ta_init_telemetry)
+{
+	rte_telemetry_register_cmd("/eventdev/ta_info",
+		handle_ta_info,
+		"Returns Timer adapter info. Parameter: Timer adapter id");
+
+	rte_telemetry_register_cmd("/eventdev/ta_stats",
+		handle_ta_stats,
+		"Returns Timer adapter stats. Parameter: Timer adapter id");
+}
-- 
2.28.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] eventdev/timer_adapter: add telemetry support
  2022-04-26  3:59 [PATCH] eventdev/timer_adapter: add telemetry support Ankur Dwivedi
@ 2022-05-16  9:58 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2022-05-16  9:58 UTC (permalink / raw)
  To: Ankur Dwivedi
  Cc: dpdk-dev, Jerin Jacob, Erik Gabriel Carrillo, Pavan Nikhilesh,
	Gowrishankar Muthukrishnan

On Tue, Apr 26, 2022 at 9:31 AM Ankur Dwivedi <adwivedi@marvell.com> wrote:
>
> Adds telemetry support to get timer adapter info and timer adapter
> statistics.
>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>

Updated the git commit as follows and applied to
dpdk-next-net-eventdev/for-main. Thanks


commit 915f3a93a7711129818f453be2278cc5d0b0029b (HEAD -> for-main,
origin/for-main, origin/HEAD)
Author: Ankur Dwivedi <adwivedi@marvell.com>
Date:   Tue Apr 26 09:29:45 2022 +0530

    eventdev/timer: add telemetry support

    Adds telemetry support to get timer adapter info and timer adapter
    statistics.

    Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
    Reviewed-by: Jerin Jacob <jerinj@marvell.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-16  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  3:59 [PATCH] eventdev/timer_adapter: add telemetry support Ankur Dwivedi
2022-05-16  9:58 ` Jerin Jacob

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