The CPU usage of packet_dispatcher() is modified to usr.

This commit is contained in:
fengbojiang 2021-09-02 12:04:32 +08:00
parent 8beba0628d
commit 215f56e7e8
1 changed files with 7 additions and 2 deletions

View File

@ -77,6 +77,7 @@ static int numa_on;
static unsigned idle_sleep;
static unsigned pkt_tx_delay;
static uint64_t usr_cb_tsc;
static struct rte_timer freebsd_clock;
@ -1286,7 +1287,9 @@ process_packets(uint16_t port_id, uint16_t queue_id, struct rte_mbuf **bufs,
}
if (!pkts_from_ring && packet_dispatcher) {
uint64_t cur_tsc = rte_rdtsc();
int ret = (*packet_dispatcher)(data, &len, queue_id, nb_queues);
usr_cb_tsc += rte_rdtsc() - cur_tsc;
if (ret == FF_DISPATCH_RESPONSE) {
rte_pktmbuf_pkt_len(rtem) = rte_pktmbuf_data_len(rtem) = len;
@ -1844,6 +1847,7 @@ main_loop(void *arg)
idle = 1;
sys_tsc = 0;
usr_tsc = 0;
usr_cb_tsc = 0;
/*
* TX burst queue drain
@ -1925,12 +1929,13 @@ main_loop(void *arg)
end_tsc = idle_sleep_tsc;
}
usr_tsc = usr_cb_tsc;
if (usch_tsc == cur_tsc) {
usr_tsc = idle_sleep_tsc - div_tsc;
usr_tsc += idle_sleep_tsc - div_tsc;
}
if (!idle) {
sys_tsc = div_tsc - cur_tsc;
sys_tsc = div_tsc - cur_tsc - usr_cb_tsc;
ff_top_status.sys_tsc += sys_tsc;
}