Function devices::tsc::calibrate::calibrate_tsc_frequency   
source · fn calibrate_tsc_frequency(
    rdtsc: fn() -> u64,
    core: usize,
    num_samples: usize,
    calibration_duration: Duration,
    stdev_limit: f64,
) -> Result<(i128, Vec<TscMoment>), TscCalibrationError>Expand description
Calibrate the TSC frequency of core.
This function first pins itself to core, generates num_samples start TscMoments, sleeps
for calibration_duration, and then generates num_samples end TscMoments. For each pair
of start and end moments, a TSC frequency value is calculated. Any frequencies that are
outside of stddev_limit standard deviations from the median offset are discarded, because
they may represent an interrupt that occurred while a TscMoment was generated. The remaining
non-discarded frequencies are then averaged. The function returns the TSC frequency average, as
well as a Vec of TscMoments, which are all of the end moments that were associated with at
least one non-discarded frequency.
§Arguments
core- Core that this function should run on.rdtsc- Function for reading the TSC value, usually just runs RDTSC instruction.num_samples- Number of start and endTscMoments to generate.calibration_duration- How long to sleep in between gathering start and end moments.stdev_limit- Number of standard deviations outside of which frequencies are discarded.