def cpu_usage_for_process(results, process):
 process_results = [r for r in results if ((r['metric']['type'] == 'cputime') and (r['process'] == process))]
 cpu_values = sum((r['value'] for r in process_results))
 wallclock_values = sum((r['wallclock'] for r in process_results))
 if (wallclock_values > 0):
  return (float(cpu_values) / wallclock_values)
 return None

def cpu_usage_for_process ( results , process ) : process_results = [ r for r in results if ( ( r [ 'metric' ] [ 'type' ] == 'cputime' ) and ( r [ 'process' ] == process ) ) ] cpu_values = sum ( ( r [ 'value' ] for r in process_results ) ) wallclock_values = sum ( ( r [ 'wallclock' ] for r in process_results ) ) if ( wallclock_values > 0 ) : return ( float ( cpu_values ) / wallclock_values ) return None
calculate the cpu percentage for a process running in a particular scenario .