#NEWLINE# @ command #NEWLINE# def timer( env ) : #NEWLINE# #INDENT# 'Time how long it takes to run another unparametric command' #NEWLINE# if ( not env . arg ) : #NEWLINE# #INDENT# return env . reply ( timer . __doc__ ) #NEWLINE# #UNINDENT# if ( ' ' in env . arg ) : #NEWLINE# #INDENT# return env . reply ( 'Command must not be parametric' ) #NEWLINE# #UNINDENT# if ( env . arg == 'timer' ) : #NEWLINE# #INDENT# return env . reply ( 'That would take too long' ) #NEWLINE# #UNINDENT# cmd = duxlot . commands . get ( env . arg ) #NEWLINE# if ( not cmd ) : #NEWLINE# #INDENT# return env . reply ( ( 'No such command: "%s"' % env . arg [ : 32 ] ) ) #NEWLINE# #UNINDENT# before = time . time ( ) #NEWLINE# cmd ( env ) #NEWLINE# after = ( time . time ( ) - before ) #NEWLINE# env . reply ( ( 'Took %s seconds' % round ( after , 3 ) ) )