CMS 3D CMS Logo

cmsIgProf_Analysis Namespace Reference


Functions

def analyse_prof_sim
def execute

Variables

string default = ''
string dest = 'profile'
string help = 'The profile to manipulate'
tuple parser = optparse.OptionParser(usage)
string usage = 'IgProf_Analysis.py <options>'


Function Documentation

def cmsIgProf_Analysis::analyse_prof_sim (   profile_name,
  outdir 
)

Definition at line 16 of file cmsIgProf_Analysis.py.

00016                                          :
00017     
00018     # A way of formatting strings similar to the c++ one                 
00019     outfile1='%s/mem_live_peak.res' %outdir
00020     outfile2='%s/doEvent_output.txt' %outdir
00021     outfile3='%s/doBeginJob_output.txt' %outdir    
00022     outfile4='%s/mem_live.res' %outdir
00023     outfile5='%s/mem_total.res' %outdir    
00024     
00025     #A first manipulation of the profile
00026     command='igprof-analyse -d -v -g --value peak -r MEM_LIVE %s > %s'\
00027                                     %(profile_name,outfile1)
00028     execute(command) #we use the method system of the object os to run a command
00029     
00030     # now let's execute the segment and analyse commands                                                                
00031     commands_list=(\
00032     'igprof-segment edm::EDProducer::doEvent < %s |tee  -a %s' %(outfile1,outfile2),
00033     
00034     'igprof-segment edm::EDProducer::doBeginJob < %s |tee -a %s' %(outfile1,outfile3),
00035     
00036     'igprof-analyse -d -v -g -r MEM_LIVE %s |tee -a \%s'\
00037                                     %(profile_name,outfile4),
00038     
00039     'igprof-analyse -d -v -g -r MEM_TOTAL %s |tee -a \%s'\
00040                                     %(profile_name,outfile5)
00041                   )
00042     
00043     for command in commands_list: #no iterator can be clearer than this one
00044         #print command
00045         execute(command)
00046         
00047     # Now for every plain ascii file we make an html:
00048     titlestring='<b>Report executed with release %s on %s.</b>\n<br>\n<hr>\n'\
00049                                    %(os.environ['CMSSW_VERSION'],time.asctime())
00050     
00051     for command,filename in map(None,commands_list,[outfile2,outfile3,outfile4,outfile5]):
00052         command_info='Command executed: <em>%s</em><br><br>\n' %command 
00053         
00054         # we open and read the txt ascii file
00055         txt_file=open(filename,'r')
00056         txt_file_content=txt_file.readlines()#again:everything is an object
00057         txt_file.close()
00058         
00059         html_file_name='%s.html' %filename[:-4]# a way to say the string until its last but 4th char
00060         html_file=open(html_file_name,'w')
00061         html_file.write('<html>\n<body>\n'+\
00062                         titlestring+\
00063                         command_info)
00064         for line in txt_file_content:
00065             html_file.write(line+'<br>\n')
00066         html_file.write('\n</body>\n</html>')
00067         html_file.close()
00068 
00069     # compress all the plain txt files!
00070     execute('pushd %s;gzip *txt;popd' %outdir)
00071                 
00072 #-------------------------------------------------------------------------------
00073 
00074 # A procedure used for importing the function above with the import statement
00075 # or to run it if the script is called: power python..
if __name__ == '__main__':

def cmsIgProf_Analysis::execute (   command  ) 

Definition at line 11 of file cmsIgProf_Analysis.py.

00011                     :
00012     print '[IgAnalysis] %s ...' %command
00013     exitstate=os.system(command)
00014     return exitstate
00015     
def analyse_prof_sim(profile_name,outdir):


Variable Documentation

string cmsIgProf_Analysis::default = '' [static]

Definition at line 85 of file cmsIgProf_Analysis.py.

string cmsIgProf_Analysis::dest = 'profile' [static]

Definition at line 86 of file cmsIgProf_Analysis.py.

string cmsIgProf_Analysis::help = 'The profile to manipulate' [static]

Definition at line 84 of file cmsIgProf_Analysis.py.

tuple cmsIgProf_Analysis::parser = optparse.OptionParser(usage) [static]

Definition at line 82 of file cmsIgProf_Analysis.py.

string cmsIgProf_Analysis::usage = 'IgProf_Analysis.py <options>' [static]

Definition at line 81 of file cmsIgProf_Analysis.py.


Generated on Tue Jun 9 18:36:41 2009 for CMSSW by  doxygen 1.5.4