def runctx(statement, globals, locals, filename=None, sort=(-1)):
 prof = Profile()
 result = None
 try:
  prof = prof.runctx(statement, globals, locals)
 except SystemExit:
  pass
 finally:
  if (filename is not None):
   prof.dump_stats(filename)
  else:
   result = prof.print_stats(sort)
 return result

def runctx ( statement , globals , locals , filename = None , sort = ( - 1 ) ) : prof = Profile ( ) result = None try : prof = prof . runctx ( statement , globals , locals ) except SystemExit : pass finally : if ( filename is not None ) : prof . dump_stats ( filename ) else : result = prof . print_stats ( sort ) return result
run statement under profiler .