If you want to count things in data plane nodes, use a per-node counter and the “show error” debug CLI to inspect it.
To count every packet fed to the node dispatch function, you can bump a node counter once per frame: vlib_node_increment_counter (vm, myplugin_node.index, MYPLUGIN_ERROR_WHATEVER, frame->n_vectors); A single printf call costs roughly the same number of clock cycles as processing O(10) packets from start to finish. It’s really expensive. Dave From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Nguy?n Th? Hi?u Sent: Wednesday, May 6, 2020 5:26 AM To: vpp-dev@lists.fd.io Subject: [vpp-dev] Why VPP performance down very much when I use print() function. Hi VPP team. I create a simple VPP node name "swap_mac". "swap_mac" node just swap between source and destination MAC address and send packet back. Then, I use Pktgen tool to send packet to VPP. In VPP, the packet will go to swap_mac->interface-output node and finally send back Pktgen tool. I found out with this test model, VPP throughput can go up 7Gbps in my lab. But VPP throughput just is 300Mbps when I add a counter variable to count number of received packet and a printf() to print value of counter in "swap_mac" node function. My code: counter ++ if((counter % 600.000.000) == 0) { printf("Receive packets: %ld", counter ); } So, why VPP throughput change from 7Gbps to 300Mbps when I just call printf() function every 600.000.000 packets? ( I have tried to comment out printf() , VPP throughput go up 7Gb again. ) Please help me to see it. I'm sorry for my bad English.
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#16246): https://lists.fd.io/g/vpp-dev/message/16246 Mute This Topic: https://lists.fd.io/mt/74025182/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-