#NEWLINE# @ contract #NEWLINE# def vm_mhz_to_percentage( vm_mhz_history , host_mhz_history , physical_cpu_mhz ) : #NEWLINE# #INDENT# " Convert VM CPU utilization to the host's CPU utilization.\n\n    :param vm_mhz_history: A list of CPU utilization histories of VMs in MHz.\n     :type vm_mhz_history: list(list(int))\n\n    :param host_mhz_history: A history if the CPU usage by the host in MHz.\n     :type host_mhz_history: list(int)\n\n    :param physical_cpu_mhz: The total frequency of the physical CPU in MHz.\n     :type physical_cpu_mhz: int,>0\n\n    :return: The history of the host's CPU utilization in percentages.\n     :rtype: list(float)\n    " #NEWLINE# max_len = max ( ( len ( x ) for x in vm_mhz_history ) ) #NEWLINE# if ( len ( host_mhz_history ) > max_len ) : #NEWLINE# #INDENT# host_mhz_history = host_mhz_history [ ( - max_len ) : ] #NEWLINE# #UNINDENT# mhz_history = [ ( ( [ 0 ] * ( max_len - len ( x ) ) ) + x ) for x in ( vm_mhz_history + [ host_mhz_history ] ) ] #NEWLINE# return [ ( float ( sum ( x ) ) / physical_cpu_mhz ) for x in zip ( * mhz_history ) ]