Skip to content

How to get CPU load when using DPDK polling?

Tom Barbette edited this page Sep 8, 2021 · 1 revision

When one use DPDK, the CPU is polling all the time, and therefore the CPU usage will appear to be 100% in htop, preventing the comparison of performance of this and that, something often needed in the literature.

To alleviate the problem, one can compile FastClick with --enable-cpu-load. This will make each click thread account the number of useful cycles and useless cycles every 100ms. Useless cycles are the ones where some click tasks (probably the one of DPDK) returned without doing any useful action, such as reading a packet.

The data can be accessed with 3 handy handlers, which all provide a serie of space-separated value, one per thread :

  • load : floating point between 0 and 1, indicating the usage of every Click threads as the amount of useful cycles spent divided by the total amount of cycles spent in tasks for the last 100ms shot. This is what is closest to the usual CPU load.
  • load_cycles: integer summing up all useful cycles spent since the last tick, proportional to a second to avoid different time-scales according to the time of the last tick (i.e. 10 cycles in 10ms will be reported as 1000cycles per second).
  • useful_kcycles: integer summing up the total amount of useful cycles x1000 since FastClick was started

The corresponding values can be accessed programmatically in code with eg router()->master()->thread(i)->useful_kcycles().

Clone this wiki locally