<s> """<STR_LIT>""" <EOL> import Report <EOL> import ReportGenerator <EOL> from common import Task <EOL> import Trace <EOL> import GlesTraceOperations <EOL> import GlesChecklist <EOL> import Common <EOL> from common import Log <EOL> import os <EOL> def addRenderTargetSection ( g ) : <EOL> s = g . report . create ( Report . Section , "<STR_LIT>" ) <EOL> configs = set ( ) <EOL> for event in g . trace . events : <EOL> for key , value in event . values . items ( ) : <EOL> if isinstance ( value , Trace . Object ) : <EOL> if value . cls . name == "<STR_LIT>" : <EOL> id = value . attrs . get ( "<STR_LIT>" ) <EOL> if not id or id in configs : <EOL> continue <EOL> configs . add ( id ) <EOL> s2 = s . create ( Report . Section , "<STR_LIT>" % id ) <EOL> t = s2 . create ( Report . Table , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> for cfgKey , cfgValue in value . attrs . items ( ) : <EOL> cfgKey = cfgKey . replace ( "<STR_LIT:_>" , "<STR_LIT:U+0020>" ) . capitalize ( ) <EOL> t . addRow ( cfgKey , cfgValue ) <EOL> if event . name == "<STR_LIT>" : <EOL> window = event . values . get ( "<STR_LIT>" ) <EOL> if not window : <EOL> continue <EOL> s2 = s . create ( Report . Section , "<STR_LIT>" % event . values [ None ] . id ) <EOL> t = s2 . create ( Report . Table , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> t . addRow ( "<STR_LIT>" , window . attrs [ "<STR_LIT:width>" ] ) <EOL> t . addRow ( "<STR_LIT>" , window . attrs [ "<STR_LIT>" ] ) <EOL> t . addRow ( "<STR_LIT>" , event . values [ "<STR_LIT>" ] . id ) <EOL> elif event . name == "<STR_LIT>" : <EOL> pixmap = event . values . get ( "<STR_LIT>" ) <EOL> if not pixmap : <EOL> continue <EOL> s2 = s . create ( Report . Section , "<STR_LIT>" % event . values [ None ] . id ) <EOL> t = s2 . create ( Report . Table , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> t . addRow ( "<STR_LIT>" , pixmap . attrs [ "<STR_LIT:width>" ] ) <EOL> t . addRow ( "<STR_LIT>" , pixmap . attrs [ "<STR_LIT>" ] ) <EOL> t . addRow ( "<STR_LIT>" , event . values [ "<STR_LIT>" ] . id ) <EOL> elif event . name == "<STR_LIT>" : <EOL> attrs = event . values . get ( "<STR_LIT>" ) <EOL> if not attrs : <EOL> continue <EOL> try : <EOL> width = attrs [ attrs . index ( g . constants . EGL_WIDTH ) + <NUM_LIT:1> ] <EOL> height = attrs [ attrs . index ( g . constants . EGL_HEIGHT ) + <NUM_LIT:1> ] <EOL> except ValueError : <EOL> continue <EOL> s2 = s . create ( Report . Section , "<STR_LIT>" % event . values [ None ] . id ) <EOL> t = s2 . create ( Report . Table , [ "<STR_LIT>" , "<STR_LIT>" ] ) <EOL> t . addRow ( "<STR_LIT>" , width ) <EOL> t . addRow ( "<STR_LIT>" , height ) <EOL> t . addRow ( "<STR_LIT>" , event . values [ "<STR_LIT>" ] . id ) <EOL> def generateReport ( project , trace , traceFileName , path , format ) : <EOL> if traceFileName : <EOL> title = "<STR_LIT>" % os . path . basename ( traceFileName ) <EOL> else : <EOL> title = "<STR_LIT>" <EOL> g = ReportGenerator . ReportGenerator ( project , trace , title , path , format ) <EOL> GlesTraceOperations . calculateStatistics ( project , trace ) <EOL> g . calculateStatistics ( ) <EOL> section = g . report . create ( Report . Section , "<STR_LIT>" ) <EOL> table = g . createGeneralStatisticsTable ( ) <EOL> if traceFileName : <EOL> table . addRow ( "<STR_LIT>" , traceFileName ) <EOL> section . add ( table ) <EOL> addRenderTargetSection ( g ) <EOL> g . report . add ( g . createEventPlot ( "<STR_LIT>" , trace . events ) ) <EOL> g . report . add ( g . createEventFrequencyPlot ( "<STR_LIT>" , trace . events ) ) <EOL> overviewSection = g . report . create ( Report . Section , "<STR_LIT>" ) <EOL> thumbnailSection = overviewSection . create ( Report . Section , "<STR_LIT>" ) <EOL> thumbnails = g . createEventThumbnails ( [ f . swapEvent for f in g . interestingFrames ] ) <EOL> for frame , thumbnail in zip ( g . interestingFrames , thumbnails ) : <EOL> thumbnailSection . create ( Report . Link , "<STR_LIT>" % ( frame . number + <NUM_LIT:1> ) , thumbnail ) <EOL> textureLoaders = GlesTraceOperations . getTextureLoaders ( project , trace ) <EOL> if textureLoaders : <EOL> textureSection = overviewSection . create ( Report . Section , "<STR_LIT>" ) <EOL> task = Task . startTask ( "<STR_LIT>" , "<STR_LIT>" , len ( textureLoaders ) ) <EOL> for event , func in textureLoaders : <EOL> task . step ( ) <EOL> image = func ( ) . convert ( "<STR_LIT>" ) <EOL> fn = os . path . join ( path , "<STR_LIT>" % event . seq ) <EOL> image . save ( fn ) <EOL> textureSection . create ( Report . Image , fn ) <EOL> data = [ <NUM_LIT:1.0> / f . duration for f in g . frames ] <EOL> plot = g . createPlot ( "<STR_LIT>" , range ( len ( g . frames ) ) , data ) <EOL> overviewSection . add ( plot ) <EOL> data = [ len ( f . events ) for f in g . frames ] <EOL> plot = g . createPlot ( "<STR_LIT>" , range ( len ( g . frames ) ) , data ) <EOL> overviewSection . add ( plot ) <EOL> data = [ f . swapEvent . sensorData . get ( "<STR_LIT>" , <NUM_LIT:0> ) for f in g . frames ] <EOL> plot = g . createPlot ( "<STR_LIT>" , range ( len ( g . frames ) ) , data ) <EOL> overviewSection . add ( plot ) <EOL> data = [ f . swapEvent . sensorData . get ( "<STR_LIT>" , <NUM_LIT:0> ) for f in g . frames ] <EOL> plot = g . createPlot ( "<STR_LIT>" , range ( len ( g . frames ) ) , data ) <EOL> overviewSection . add ( plot ) <EOL> data = [ f . swapEvent . sensorData . get ( "<STR_LIT>" , <NUM_LIT:0> ) for f in g . frames ] <EOL> plot = g . createPlot ( "<STR_LIT>" , range ( len ( g . frames ) ) , data ) <EOL> overviewSection . add ( plot ) <EOL> data = [ f . swapEvent . sensorData . get ( "<STR_LIT>" , <NUM_LIT:0> ) for f in g . frames ] <EOL> plot = g . createPlot ( "<STR_LIT>" , range ( len ( g . frames ) ) , data ) <EOL> overviewSection . add ( plot ) <EOL> task = Task . startTask ( "<STR_LIT>" , "<STR_LIT>" , len ( g . interestingFrames ) ) <EOL> frameDetailSection = g . report . create ( Report . Section , "<STR_LIT>" ) <EOL> for frame in g . interestingFrames : <EOL> task . step ( ) <EOL> frameSection = g . createFrameSection ( frame ) <EOL> plot = g . createSensorPlot ( frame , "<STR_LIT>" ) <EOL> frameSection . add ( plot ) <EOL> plot = g . createSensorPlot ( frame , "<STR_LIT>" ) <EOL> frameSection . add ( plot ) <EOL> plot = g . createSensorPlot ( frame , "<STR_LIT>" ) <EOL> frameSection . add ( plot ) <EOL> for event in frame . renderEvents + [ frame . swapEvent ] : <EOL> eventSection = g . createEventSection ( event ) <EOL> frameSection . add ( eventSection ) <EOL> frameDetailSection . add ( frameSection ) <EOL> g . report . add ( g . createChecklistSection ( "<STR_LIT>" , GlesChecklist . checklistItems ) ) <EOL> task . finish ( ) <EOL> g . generate ( ) </s>
