event/dsw: add port busy cycles xstats
DSW keeps an internal port load estimate, used by the load balancing mechanism. As a side effect, it keeps track of the total number of busy cycles since startup. This metric is indirectly exposed in the form of DSW xstats' "port_<n>_event_proc_latency", which is the total number of busy cycles divided by the total number of events processed on a particular port. An external application can take (event_latency * dequeued) to go back to busy_cycles. One reason for doing this is to measure the port's load during a longer time period, without resorting to sampling "port_<n>_load". However, as the number dequeued events grows, a rounding error in event_latency renders the application-calculated busy_cycles inaccurate. Thus, it makes sense to directly expose the number of busy cycles as a DSW xstats, even though it might seem redundant. Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
This commit is contained in:
parent
cea7bc6713
commit
b97d3a9cbc
@ -109,6 +109,13 @@ dsw_xstats_port_get_event_proc_latency(struct dsw_evdev *dsw, uint8_t port_id,
|
||||
return dequeued > 0 ? total_busy_cycles / dequeued : 0;
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
dsw_xstats_port_get_busy_cycles(struct dsw_evdev *dsw, uint8_t port_id,
|
||||
uint8_t queue_id __rte_unused)
|
||||
{
|
||||
return dsw->ports[port_id].total_busy_cycles;
|
||||
}
|
||||
|
||||
DSW_GEN_PORT_ACCESS_FN(inflight_credits)
|
||||
|
||||
DSW_GEN_PORT_ACCESS_FN(pending_releases)
|
||||
@ -147,6 +154,8 @@ static struct dsw_xstats_port dsw_port_xstats[] = {
|
||||
false },
|
||||
{ "port_%u_event_proc_latency", dsw_xstats_port_get_event_proc_latency,
|
||||
false },
|
||||
{ "port_%u_busy_cycles", dsw_xstats_port_get_busy_cycles,
|
||||
false },
|
||||
{ "port_%u_inflight_credits", dsw_xstats_port_get_inflight_credits,
|
||||
false },
|
||||
{ "port_%u_pending_releases", dsw_xstats_port_get_pending_releases,
|
||||
|
Loading…
Reference in New Issue
Block a user