#NEWLINE# def generateReport( project , trace , traceFileName , path , format ) : #NEWLINE# #INDENT# if traceFileName : #NEWLINE# #INDENT# title = ( 'OpenVG performance report for %s' % os . path . basename ( traceFileName ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# title = 'OpenVG performance report' #NEWLINE# #UNINDENT# g = ReportGenerator . ReportGenerator ( project , trace , title , path , frameSection ) #NEWLINE# g . calculateStatistics ( ) #NEWLINE# section = g . report . create ( Report . Section , 'General statistics' ) #NEWLINE# table = g . createGeneralStatisticsTable ( ) #NEWLINE# if traceFileName : #NEWLINE# #INDENT# table . addRow ( 'File name' , traceFileName ) #NEWLINE# #UNINDENT# section . add ( table ) #NEWLINE# g . report . add ( g . createEventPlot ( 'Event distribution' , trace . events ) ) #NEWLINE# g . report . add ( g . createEventFrequencyPlot ( 'Operation distribution' , trace . events ) ) #NEWLINE# overviewSection = g . report . create ( Report . Section , 'Overview' ) #NEWLINE# thumbnailSection = overviewSection . create ( Report . Section , 'Selected frames' ) #NEWLINE# thumbnails = g . createEventThumbnails ( [ f . swapEvent for f in g . interestingFrames ] ) #NEWLINE# for ( frame , thumbnail ) in zip ( g . interestingFrames , thumbnails ) : #NEWLINE# #INDENT# thumbnailSection . create ( Report . Link , ( '#frame%d' % ( frame . number + 1 ) ) , thumbnail ) #NEWLINE# #UNINDENT# imageLoaders = VgTraceOperations . getImageLoaders ( project , trace ) #NEWLINE# if imageLoaders : #NEWLINE# #INDENT# imageSection = overviewSection . create ( Report . Section , 'Loaded images' ) #NEWLINE# task = Task . startTask ( 'load-images' , 'Loading images' , len ( imageLoaders ) ) #NEWLINE# for ( event , func ) in imageLoaders : #NEWLINE# #INDENT# task . step ( ) #NEWLINE# image = func ( ) . convert ( 'RGBA' ) #NEWLINE# fn = os . path . join ( path , ( 'image%03d.png' % event . seq ) ) #NEWLINE# image . save ( fn ) #NEWLINE# imageSection . create ( Report . Image , fn ) #NEWLINE# #UNINDENT# #UNINDENT# data = [ ( 1.0 / f . duration ) for f in g . frames ] #NEWLINE# plot = g . createPlot ( 'Frames per second' , range ( len ( g . frames ) ) , data ) #NEWLINE# overviewSection . add ( plot ) #NEWLINE# data = [ len ( f . events ) for f in g . frames ] #NEWLINE# plot = g . createPlot ( 'Number of API calls per frame' , range ( len ( g . frames ) ) , data ) #NEWLINE# overviewSection . add ( plot ) #NEWLINE# data = [ f . swapEvent . sensorData . get ( 'rasterized_pixels' , 0 ) for f in g . frames ] #NEWLINE# plot = g . createPlot ( 'Rasterized fragments per frame' , range ( len ( g . frames ) ) , data ) #NEWLINE# overviewSection . add ( plot ) #NEWLINE# task = Task . startTask ( 'frame-report' , 'Generating report' , len ( g . interestingFrames ) ) #NEWLINE# frameDetailSection = g . report . create ( Report . Section , 'Detailed frame statistics' ) #NEWLINE# for frame in g . interestingFrames : #NEWLINE# #INDENT# task . step ( ) #NEWLINE# frameSection = g . createFrameSection ( frame ) #NEWLINE# plot = g . createSensorPlot ( frame , 'rasterized_pixels' ) #NEWLINE# frameSection . add ( plot ) #NEWLINE# for event in ( frame . renderEvents + [ frame . swapEvent ] ) : #NEWLINE# #INDENT# eventSection = g . createEventSection ( event ) #NEWLINE# frameSection . add ( eventSection ) #NEWLINE# #UNINDENT# frameDetailSection . add ( frameSection ) #NEWLINE# #UNINDENT# task . finish ( ) #NEWLINE# g . generate ( )