Skip to content

Commit

Permalink
dpif-netdev-perf: Fix millisecond stats precision with slower TSC.
Browse files Browse the repository at this point in the history
Unlike x86 where TSC frequency usually matches with CPU frequency,
another architectures could have much slower TSCs.
For example, it's common for Arm SoCs to have 100 MHz TSC by default.
In this case perf module will check for end of current millisecond
each 10K cycles, i.e 10 times per millisecond. This could be not
enough to collect precise statistics.
Fix that by taking current TSC frequency into account instead of
hardcoding the number of cycles.

CC: Jan Scheurich <jan.scheurich@ericsson.com>
Fixes: 79f3687 ("dpif-netdev: Detailed performance stats for PMDs")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
  • Loading branch information
igsilya authored and istokes committed Mar 22, 2019
1 parent 8352f3a commit 7f26e41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dpif-netdev-perf.c
Expand Up @@ -554,8 +554,8 @@ pmd_perf_end_iteration(struct pmd_perf_stats *s, int rx_packets,
cum_ms = history_next(&s->milliseconds);
cum_ms->timestamp = now;
}
/* Do the next check after 10K cycles (4 us at 2.5 GHz TSC clock). */
s->next_check_tsc = cycles_counter_update(s) + 10000;
/* Do the next check after 4 us (10K cycles at 2.5 GHz TSC clock). */
s->next_check_tsc = cycles_counter_update(s) + get_tsc_hz() / 250000;
}
}

Expand Down

0 comments on commit 7f26e41

Please sign in to comment.