CMS 3D CMS Logo

Functions | Variables

cmsIgProf_Analysis Namespace Reference

Functions

def diff_igprof_analysis
def execute
def library_igprof_analysis
def simple_igprof_analysis

Variables

string action = 'store_true'
 AnalysisType = options.counter
string default = ''
string dest = 'profile'
string help = 'The profile to manipulate'
dictionary IgProfProfile
tuple parser = optparse.OptionParser(usage)
string usage = 'IgProf_Analysis.py <options>'

Function Documentation

def cmsIgProf_Analysis::diff_igprof_analysis (   profile_name,
  regression_profile_name,
  AnalysisType 
)
This function takes as arguments:
-a compressed (.gz) igprof output profile
-a second compressed (.gz) igprof output profile against which a regression analysis is intended to be done
-the output directory where to store the output of the regression analysis
Based on this information it automatically selects the igprof counter (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use
with igprof-analyse and it performs the regression analysis with SQLite3 output.

Definition at line 79 of file cmsIgProf_Analysis.py.

00080                                                                            :
00081     
00082     """
00083     This function takes as arguments:
00084     -a compressed (.gz) igprof output profile
00085     -a second compressed (.gz) igprof output profile against which a regression analysis is intended to be done
00086     -the output directory where to store the output of the regression analysis
00087     Based on this information it automatically selects the igprof counter (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use
00088     with igprof-analyse and it performs the regression analysis with SQLite3 output.
00089     """
00090     #Following Giulio's filename convention:
00091     outfile=profile_name.split(".")[0].replace(IgProfProfile[AnalysisType],AnalysisType)+"_diff_"+regression_profile_name.split(".")[0].split("___")[-1]+".sql3"
00092     command='igprof-analyse --sqlite -d -v -g --diff-mode -b %s -r %s %s |sqlite3 %s'%(regression_profile_name, AnalysisType,profile_name,outfile)
00093     exit=execute(command)
00094 
    return exit
def cmsIgProf_Analysis::execute (   command)

Definition at line 17 of file cmsIgProf_Analysis.py.

Referenced by ora::RelationalBuffer::flush(), and cond::Utilities::run().

00018                     :
00019     print '[IgAnalysis] %s ...' %command
00020     sys.stdout.flush()
00021     exitstate=os.system(command)
00022     return exitstate
    
def cmsIgProf_Analysis::library_igprof_analysis (   profile_name,
  AnalysisType 
)
This function takes as arguments:
-a compressed (.gz) igprof output profile
-the output directory where to store the output of the igprof-analysis merging the results by library
Based on this information it automatically selects the igprof counter (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use
with igprof-analyse and it performs the igprof-analyse analysis merging the results by library and saving the results
in the usual igprof-navigator browseable SQLite3 format.

Definition at line 95 of file cmsIgProf_Analysis.py.

00096                                                       :
00097 
00098     """
00099     This function takes as arguments:
00100     -a compressed (.gz) igprof output profile
00101     -the output directory where to store the output of the igprof-analysis merging the results by library
00102     Based on this information it automatically selects the igprof counter (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use
00103     with igprof-analyse and it performs the igprof-analyse analysis merging the results by library and saving the results
00104     in the usual igprof-navigator browseable SQLite3 format.
00105     """
00106     #Following Giulio's filename convention:
00107     outfile=profile_name.split(".")[0].replace(IgProfProfile[AnalysisType],AnalysisType)+"_merged"+".sql3"
00108     #Regular Expression supplied by Giulio:
00109     command="igprof-analyse --sqlite -d -v -g -r %s -ml -mr 's|.*/(.*)$|\\1|' %s |sqlite3 %s"%(AnalysisType,profile_name,outfile)
00110     exit=execute(command)
00111     
00112     return exit
00113 #-------------------------------------------------------------------------------
00114 
00115 # A procedure used for importing the function above with the import statement
# or to run it if the script is called: power python..
def cmsIgProf_Analysis::simple_igprof_analysis (   profile_name,
  AnalysisType,
  output_type 
)
This function takes as arguments:
-a compressed (.gz) igprof output profile
-the output directory where to store the output
-the type of output wanted
Based on this information it automatically selects the igprof counter
(PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use with igprof-analyse and it
performs the analysis.
If ASCII output_type is given, it keeps only the first seven lines of
the output file (the report) allowing quick access to the totals for
the counters in order to put together summary tables.
If SQLite3 output_type is given, it simply dumps the full reports in
sqlite3 format, ready to be browsed by igprof-navigator GUI (standalone
or cgi-bin).

Definition at line 23 of file cmsIgProf_Analysis.py.

00024                                                                  :
00025     
00026     """This function takes as arguments:
00027     -a compressed (.gz) igprof output profile
00028     -the output directory where to store the output
00029     -the type of output wanted
00030     Based on this information it automatically selects the igprof counter
00031     (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use with igprof-analyse and it
00032     performs the analysis.
00033     If ASCII output_type is given, it keeps only the first seven lines of
00034     the output file (the report) allowing quick access to the totals for
00035     the counters in order to put together summary tables.
00036     If SQLite3 output_type is given, it simply dumps the full reports in
00037     sqlite3 format, ready to be browsed by igprof-navigator GUI (standalone
00038     or cgi-bin).
00039     """
00040     #Use profile input file to determine the name of the output file adding the counter to it:
00041     #outfile=profile_name[:-3]+"___"+AnalysisType+".res"
00042     outfile=profile_name.split(".")[0].replace(IgProfProfile[AnalysisType],AnalysisType)+".res"
00043     #Launch the 1 command:
00044     
00045     #command='igprof-analyse -d -v -g -r %s %s|tee -a \%s'%(AnalysisType,profile_name,outfile)
00046     #Replacing tee: it is polluting the log files...
00047 
00048     #igprof-analyse command depends on the output type desired:
00049     if output_type =="SQLite3":
00050         #Case of dumping the igprof-analyse report in sqlite format to be igprof-navigator browseable
00051         outfile= outfile[:-3]+"sql3" #NEED TO USE sql3 to be compatible with CGI-BIN igprof-navigator
00052         command='igprof-analyse --sqlite -d -v -g -r %s %s |sqlite3 %s'%(AnalysisType,profile_name,outfile)
00053         #Execute the igprof-analyse command
00054         exit=execute(command)
00055     elif output_type =="ASCII":
00056         #We can keep this part of the igprof-analysis, to create the html table with the totals at each dump
00057         command='igprof-analyse -d -v -g -r %s %s > %s'%(AnalysisType,profile_name,outfile)
00058         #Execute the igprof-analyse command
00059         exit=execute(command)
00060         #Let's manipulate the ASCII output to only keep the top 7 lines:
00061         # we open and read the txt ascii file
00062         print "Reading the res file"
00063         txt_file=open(outfile,'r')
00064         txt_file_content=txt_file.readlines()#again:everything is an object
00065         print "res file has %s lines!"%len(txt_file_content)
00066         txt_file.close()
00067         #overwrite the file to only save the first 7 lines:
00068         print "Overwriting the res file, to reduce it to 7 lines"
00069         out_file=open(outfile,'w')
00070         line_num=0
00071         for line in txt_file_content:
00072             out_file.write(line)
00073             line_num+=1
00074             if line_num == 7:
00075                 break
00076         out_file.close()
00077     
00078     return exit
    

Variable Documentation

string cmsIgProf_Analysis::action = 'store_true'

Definition at line 142 of file cmsIgProf_Analysis.py.

Definition at line 154 of file cmsIgProf_Analysis.py.

Definition at line 125 of file cmsIgProf_Analysis.py.

string cmsIgProf_Analysis::dest = 'profile'

Definition at line 126 of file cmsIgProf_Analysis.py.

string cmsIgProf_Analysis::help = 'The profile to manipulate'

Definition at line 124 of file cmsIgProf_Analysis.py.

Initial value:
00001 {'PERF_TICKS':'IgProfPerf',
00002                'MEM_TOTAL':'IgProfMem',
00003                'MEM_LIVE':'IgProfMem',
00004                'MEM_MAX':'IgProfMem'
00005                }

Definition at line 11 of file cmsIgProf_Analysis.py.

tuple cmsIgProf_Analysis::parser = optparse.OptionParser(usage)

Definition at line 122 of file cmsIgProf_Analysis.py.

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

Definition at line 121 of file cmsIgProf_Analysis.py.