Hi Dave &  Joe.
Thanks for your both answers. I'm glad to see them.
I will try to use vlib_node_increment_counter() function instead.

But I still wonder. I know printf() can be bottleneck of performance,
that's why I just call printf() every 600.000.000 packets.
Even if  thoughput is 7Gbps, 600.000.000 packets mean VPP just call
printf() function 1 time per minute.
So, I think at least VPP throughput should be 7Gbps at start testing point
and just down after 1 minute.
But in my case, the throughput is 300Mbps from start testing point.

I have increased  600.000.000 to 1.200.000.000 and got the same result.

Best regards!
HieuNT

Vào Th 4, 6 thg 5, 2020 vào lúc 19:08 Dave Barach (dbarach) <
dbar...@cisco.com> đã viết:

> 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 (#16248): https://lists.fd.io/g/vpp-dev/message/16248
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]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to