#NEWLINE# def profiler( ) : #NEWLINE# #INDENT# '\n    to use the profiler start web2py with -F profiler.log\n    ' #NEWLINE# KEY = 'web2py_profiler_size' #NEWLINE# filename = global_settings . cmd_options . profiler_filename #NEWLINE# data = 'profiler disabled' #NEWLINE# if filename : #NEWLINE# #INDENT# if ( KEY in request . cookies ) : #NEWLINE# #INDENT# size = int ( request . cookies [ KEY ] . value ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# size = 0 #NEWLINE# #UNINDENT# if os . path . exists ( filename ) : #NEWLINE# #INDENT# data = read_file ( 'profiler.log' , 'rb' ) #NEWLINE# if ( size < len ( data ) ) : #NEWLINE# #INDENT# data = data [ size : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# size = 0 #NEWLINE# #UNINDENT# size += len ( filename ) #NEWLINE# response . cookies [ KEY ] = size #NEWLINE# #UNINDENT# #UNINDENT# return data