Get Clock Cycles Per Millisecond
Description
The get_clock_cycles_per_millisecond
function calculates the number of clock cycles per millisecond based on the CPU frequency. It retrieves the CPU frequency using the get_cpu_frequency
function and converts it to cycles per millisecond.
Function Signature:
def get_clock_cycles_per_millisecond() -> float:
Parameters
- None
Returns
- float: The number of clock cycles per millisecond.
Example Usage
cycles_per_millisecond = get_clock_cycles_per_millisecond()
print(f"Clock cycles per millisecond: {cycles_per_millisecond}")
Notes
- This function uses the
get_cpu_frequency
function to retrieve the CPU frequency in MHz and converts it to Hz. - It calculates the number of cycles per millisecond by dividing the frequency in Hz by 1,000.
Error Handling
- This function depends on the successful execution of the
get_cpu_frequency
function. Ifget_cpu_frequency
raises an error (such as being unable to find the CPU frequency), it will propagate that error.