Hi Stephen,
On Thu, Nov 29, 2018 at 01:21:52PM -0800, Stephen Hemminger wrote:
> On Thu, 29 Nov 2018 08:32:03 +0000
> Pavan Nikhilesh <[email protected]> wrote:
>
> > When estimating tsc frequency using sleep/gettime round it up to the
> > nearest multiple of 10Mhz for more accuracy.
> >
> > Signed-off-by: Pavan Nikhilesh <[email protected]>
>
> Rounding reduces accuracy.
>
> Why is this code being used? Shouldn't get_tsc_freq_arch return a
> correct value?
This patch doesn't modify get_tsc_freq_arch(), it basically gives a more
accurate freq reading when we rely on sleep(1) i.e. only when
get_tsc_freq_arch() returns 0.
example:
static uint64_t
estimate_tsc_freq(void)
{
RTE_LOG(WARNING, EAL, "WARNING: TSC frequency estimated roughly"
" - clock timings may be less accurate.\n");
/* assume that the sleep(1) will sleep for 1 second */
uint64_t start = rte_rdtsc();
sleep(1);
return rte_rdtsc() - start;
}
This will not give the accurate cyc/sec in most cases, rounding it to 10Mhz wil
do the job.
In case of ARM64 if we enable RTE_ARM_EAL_RDTSC_USE_PMU, get_tsc_freq_arch()
will return 0 as there is no instruction to determine the clk of PMU.
>
> How well does the rdmsr() logic work in VM?
> It looks like Hyper-V has special MSR's for TSC frequency determination.
Maybe bruce can give a more accurate answer to this as it is x86 specific.
Thanks,
Pavan.