/*********************************************************
- * Copyright (c) 1998-2024 Broadcom. All rights reserved.
+ * Copyright (c) 1998-2024 Broadcom. All Rights Reserved.
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
*
* This program is free software; you can redistribute it and/or modify it
return FALSE;
}
- *mHz = hz / 1000000;
+ *mHz = (hz + 500000) / 1000000;
return TRUE;
# else
#else
#if defined(VMX86_SERVER)
if (HostType_OSIsVMK()) {
- uint32 tscKhzEstimate;
- VMK_ReturnStatus status = VMKernel_GetTSCkhzEstimate(&tscKhzEstimate);
+ uint64 cpuHzEstimate;
+ VMK_ReturnStatus status = VMKPrivate_GetProcessorHzEstimate(&cpuHzEstimate);
/*
- * The TSC frequency matches the CPU frequency in all modern CPUs.
- * Regardless, the TSC frequency is a much better estimate of
- * reality than failing or returning zero.
+ * TSC and CPU frequencies match on the modern x86 processors but
+ * not on the Arm processors. Therefore, use the processor frequency
+ * estimate directly.
*/
- *mHz = tscKhzEstimate / 1000;
+ *mHz = (cpuHzEstimate + 500000) / 1000000;
return (status == VMK_OK);
}