在 2023/2/8 3:37, Robin Jarry 写道:
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 <[email protected]>
Acked-by: Morten Brørup <[email protected]>
Acked-by: Konstantin Ananyev <[email protected]>
Reviewed-by: Kevin Laatz <[email protected]>
---
...
static inline void
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 021624952daa..c4e1c2aa2af1 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -331,7 +331,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
struct rte_mbuf *pkt;
struct rte_mempool *mbp;
struct rte_ether_hdr eth_hdr;
- uint16_t nb_tx;
+ uint16_t nb_tx = 0;
useless modify?
uint16_t nb_pkt;
uint16_t vlan_tci, vlan_tci_outer;
uint32_t retry;