#! /usr/bin/env python # ______________________________________________________________________ # # Filename: recoanalstats # # Created: 26-AUG-2001, unknown # # ______________________________________________________________________ """Summarizes the results from running a RecoAnalyze_x job. USAGE: recoanalstats [-h] OPTIONS: -h, --help -- Print help text and exit. Execute this script in the directory containing the results of running RecoAnalyze_x. """ # ______________________________________________________________________ import sys, os, glob, string # ______________________________________________________________________ __author__ = 'Harry Melanson, melanson@fnal.gov' __version__ = '01.00.00' __filename__ = 'recoanalstats.py' __doc__ = __doc__ % vars() # ______________________________________________________________________ # ______________________________________________________________________ def process_command(): """Process the command.""" from scriptutil import getOptions optlist, args = getOptions('', [], __doc__) print '\nAnalyzing results... please wait.\n' exename = 'RecoAnalyze_x' # Get number of events processed command = 'grep "Total events:" events.read' results = os.popen(command,'r').readlines() nevent = string.split(results[0])[-1] # Get total CPU time used file = exename + '.out' command = 'grep -1 "Controller::/->" ' + file results = os.popen(command,'r').readlines() cputime = string.atof(string.split(results[-1],':')[-1]) # Get total memory used file = exename + '.log' command = 'cat ' + file + ' | grep --text "mem:"' results = os.popen(command,'r').readlines() memory = string.atof(string.split(results[-1])[-2]) # Get size of root file command = 'ls -l RecoAnalyze.root' results = os.popen(command,'r').readlines() filesize = string.split(results[0])[4] print 'Number of events: ', ('%s' % nevent) print 'CPU time:', ('%.1f' % cputime), 'sec/event' print 'Memory:', ('%.1f' % memory), 'Mb' print 'File size:', ('%s' % filesize), 'bytes' # # Self-test if __name__ == '__main__': process_command() sys.exit(0)