-.. code-block:: c
-
- for (;;) {
- rte_spinlock_lock(&qconf->lock);
-
- do {
- rte_jobstats_context_start(&qconf->jobs_context);
-
- /* Do the Idle job:
- * - Read stats_read_pending flag
- * - check if some real job need to be executed
- */
- rte_jobstats_start(&qconf->jobs_context, &qconf->idle_job);
-
- do {
- uint8_t i;
- uint64_t now = rte_get_timer_cycles();
-
- need_manage = qconf->flush_timer.expire < now;
- /* Check if we was esked to give a stats. */
- stats_read_pending =
- rte_atomic16_read(&qconf->stats_read_pending);
- need_manage |= stats_read_pending;
-
- for (i = 0; i < qconf->n_rx_port && !need_manage; i++)
- need_manage = qconf->rx_timers[i].expire < now;
-
- } while (!need_manage);
- rte_jobstats_finish(&qconf->idle_job, qconf->idle_job.target);
-
- rte_timer_manage();
- rte_jobstats_context_finish(&qconf->jobs_context);
- } while (likely(stats_read_pending == 0));
-
- rte_spinlock_unlock(&qconf->lock);
- rte_pause();
- }
+.. literalinclude:: ../../../examples/l2fwd-jobstats/main.c
+ :language: c
+ :start-after: Minimize impact of stats reading. 8<
+ :end-before: >8 End of minimize impact of stats reading.
+ :dedent: 1