Commit Message

Simplify the historically grown TSC cycle counting in PMD threads.
Cycles are currently counted for the following purposes:
1. Measure PMD ustilization
PMD utilization is defined as ratio of cycles spent in busy iterations
(at least one packet received or sent) over the total number of cycles.
This is already done in pmd_perf_start_iteration() and
pmd_perf_end_iteration() based on a TSC timestamp saved in current
iteration at start_iteration() and the actual TSC at end_iteration().
No dependency on intermediate cycle accounting.
2. Measure the processing load per RX queue
This comprises cycles spend on polling and processing packets received
from the rx queue and the cycles spent on delayed sending of these packets
to tx queues (with time-based batching).
The previous scheme using cycles_count_start(), cycles_count_intermediate()
and cycles-count_end() originally introduced to simplify cycle counting
and saving calls to rte_get_tsc_cycles() was rather obscuring things.
Replace by a nestable cycle_timer with with start and stop functions to
embrace a code segment to be timed. The timed code may contain arbitrary
nested cycle_timers. The duration of nested timers is excluded from the
outer timer.
The caller must ensure that each call to cycle_timer_start() is
followed by a call to cycle_timer_end(). Failure to do so will lead to
assertion failure or a memory leak.
The new cycle_timer is used to measure the processing cycles per rx queue.
This is not yet strictly necessary but will be made use of in a subsequent
commit.
All cycle count functions and data are relocated to module
dpif-netdev-perf.
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
---
lib/dpif-netdev-perf.h | 110 ++++++++++++++++++++++++++++++++++++++++----
lib/dpif-netdev.c | 122 ++++++++++++++-----------------------------------
2 files changed, 135 insertions(+), 97 deletions(-)