#NEWLINE# def report_power_stats( trace_file , idle_state_names , core_names , core_clusters , num_idle_states , first_cluster_state = sys . maxint , first_system_state = sys . maxint , use_ratios = False , timeline_csv_file = None , filter_trace = False , cpu_utilisation = None , max_freq_list = None ) : #NEWLINE# #INDENT# trace = TraceCmdTrace ( filter_markers = filter_trace ) #NEWLINE# ps_processor = PowerStateProcessor ( core_clusters , num_idle_states = num_idle_states , first_cluster_state = first_cluster_state , first_system_state = first_system_state , wait_for_start_marker = ( not filter_trace ) ) #NEWLINE# reporters = [ ParallelStats ( core_clusters , use_ratios ) , PowerStateStats ( core_names , idle_state_names , use_ratios ) ] #NEWLINE# if timeline_csv_file : #NEWLINE# #INDENT# reporters . append ( PowerStateTimeline ( timeline_csv_file , core_names , idle_state_names ) ) #NEWLINE# #UNINDENT# if cpu_utilisation : #NEWLINE# #INDENT# if max_freq_list : #NEWLINE# #INDENT# reporters . append ( CpuUtilisationTimeline ( cpu_utilisation , core_names , max_freq_list ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . warning ( 'Maximum frequencies not found. Cannot normalise. Skipping CPU Utilisation Timeline' ) #NEWLINE# #UNINDENT# #UNINDENT# event_stream = trace . parse ( trace_file , names = [ 'cpu_idle' , 'cpu_frequency' , 'print' ] ) #NEWLINE# transition_stream = stream_cpu_power_transitions ( event_stream ) #NEWLINE# power_state_stream = ps_processor . process ( transition_stream ) #NEWLINE# core_state_stream = gather_core_states ( power_state_stream ) #NEWLINE# for ( timestamp , states ) in core_state_stream : #NEWLINE# #INDENT# for reporter in reporters : #NEWLINE# #INDENT# reporter . update ( timestamp , states ) #NEWLINE# #UNINDENT# #UNINDENT# reports = [ ] #NEWLINE# for reporter in reporters : #NEWLINE# #INDENT# report = reporter . report ( ) #NEWLINE# if report : #NEWLINE# #INDENT# reports . append ( report ) #NEWLINE# #UNINDENT# #UNINDENT# return reports