Function inside_vm::inside_vm_custom [−][src]
pub fn inside_vm_custom(
low: usize,
samples: usize,
high: usize,
threshold: u64
) -> bool
Expand description
Detect if inside vm by computing cpuid cpu cycles average and compare to threshold
.
Perform low + samples + high
measurements,
discard low
and high
(outliers),
compute average using the remaining samples
measurements.
Compare average to threshold
, if above return true else false.
Example
use inside_vm::inside_vm_custom; let inside: bool = inside_vm::inside_vm_custom(5, 100, 5, 1_000);