#NEWLINE# def report( self ) : #NEWLINE# #INDENT# if ( self . last_timestamp is None ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# total_time = ( self . last_timestamp - self . first_timestamp ) #NEWLINE# state_stats = defaultdict ( ( lambda : ( [ None ] * len ( self . core_names ) ) ) ) #NEWLINE# for ( cpu , states ) in self . cpu_states . iteritems ( ) : #NEWLINE# #INDENT# for state in states : #NEWLINE# #INDENT# time = states [ state ] #NEWLINE# time_pc = ( time / total_time ) #NEWLINE# if ( not self . use_ratios ) : #NEWLINE# #INDENT# time_pc *= 100 #NEWLINE# #UNINDENT# state_stats [ state ] [ cpu ] = time_pc #NEWLINE# #UNINDENT# #UNINDENT# precision = ( ( self . use_ratios and 3 ) or 1 ) #NEWLINE# return PowerStateStatsReport ( state_stats , time . core_names , precision )