Changeset View
Changeset View
Standalone View
Standalone View
sys/x86/x86/tsc.c
Context not available. | |||||
uint64_t tsc_freq; | uint64_t tsc_freq; | ||||
int tsc_is_invariant; | int tsc_is_invariant; | ||||
int tsc_perf_stat; | int tsc_perf_stat; | ||||
int tsc_early_calib_exact; | |||||
markj: This can be qualified with `static`. | |||||
static eventhandler_tag tsc_levels_tag, tsc_pre_tag, tsc_post_tag; | static eventhandler_tag tsc_levels_tag, tsc_pre_tag, tsc_post_tag; | ||||
Context not available. | |||||
if (vm_guest == VM_GUEST_VMWARE) { | if (vm_guest == VM_GUEST_VMWARE) { | ||||
tsc_freq_vmware(); | tsc_freq_vmware(); | ||||
tsc_early_calib_exact = 1; | |||||
markjUnsubmitted Not Done Inline ActionsI think it'd be a bit neater to set this flag in tsc_freq_vmware(). markj: I think it'd be a bit neater to set this flag in tsc_freq_vmware(). | |||||
return; | return; | ||||
} | } | ||||
Context not available. | |||||
if (tsc_disabled) | if (tsc_disabled) | ||||
return; | return; | ||||
if (tsc_early_calib_exact) | |||||
goto calibrated; | |||||
tc = atomic_load_ptr(&timecounter); | tc = atomic_load_ptr(&timecounter); | ||||
Context not available. | |||||
freq_khz = tc->tc_frequency * (tsc_end - tsc_start) / (t_end - t_start); | freq_khz = tc->tc_frequency * (tsc_end - tsc_start) / (t_end - t_start); | ||||
tsc_update_freq(freq_khz); | tsc_update_freq(freq_khz); | ||||
calibrated: | |||||
tc_init(&tsc_timecounter); | tc_init(&tsc_timecounter); | ||||
set_cputicker(rdtsc, tsc_freq, !tsc_is_invariant); | set_cputicker(rdtsc, tsc_freq, !tsc_is_invariant); | ||||
} | } | ||||
Context not available. |
This can be qualified with static.