CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.

References execute(), python.rootplot.root2matplotlib.replace(), and split.

79 
80 def diff_igprof_analysis(profile_name,regression_profile_name,AnalysisType):
81 
82  """
83  This function takes as arguments:
84  -a compressed (.gz) igprof output profile
85  -a second compressed (.gz) igprof output profile against which a regression analysis is intended to be done
86  -the output directory where to store the output of the regression analysis
87  Based on this information it automatically selects the igprof counter (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use
88  with igprof-analyse and it performs the regression analysis with SQLite3 output.
89  """
90  #Following Giulio's filename convention:
91  outfile=profile_name.split(".")[0].replace(IgProfProfile[AnalysisType],AnalysisType)+"_diff_"+regression_profile_name.split(".")[0].split("___")[-1]+".sql3"
92  command='igprof-analyse --sqlite -d -v -g --diff-mode -b %s -r %s %s |sqlite3 %s'%(regression_profile_name, AnalysisType,profile_name,outfile)
93  exit=execute(command)
94 
return exit
double split
Definition: MVATrainer.cc:139
def cmsIgProf_Analysis.execute (   command)

Definition at line 17 of file cmsIgProf_Analysis.py.

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

17 
18 def execute(command):
19  print '[IgAnalysis] %s ...' %command
20  sys.stdout.flush()
21  exitstate=os.system(command)
22  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.

References execute(), and python.rootplot.root2matplotlib.replace().

95 
96 def library_igprof_analysis(profile_name,AnalysisType):
97 
98  """
99  This function takes as arguments:
100  -a compressed (.gz) igprof output profile
101  -the output directory where to store the output of the igprof-analysis merging the results by library
102  Based on this information it automatically selects the igprof counter (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use
103  with igprof-analyse and it performs the igprof-analyse analysis merging the results by library and saving the results
104  in the usual igprof-navigator browseable SQLite3 format.
105  """
106  #Following Giulio's filename convention:
107  outfile=profile_name.split(".")[0].replace(IgProfProfile[AnalysisType],AnalysisType)+"_merged"+".sql3"
108  #Regular Expression supplied by Giulio:
109  command="igprof-analyse --sqlite -d -v -g -r %s -ml -mr 's|.*/(.*)$|\\1|' %s |sqlite3 %s"%(AnalysisType,profile_name,outfile)
110  exit=execute(command)
111 
112  return exit
113 #-------------------------------------------------------------------------------
114 
115 # 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.

References execute(), and python.rootplot.root2matplotlib.replace().

23 
24 def simple_igprof_analysis(profile_name,AnalysisType,output_type):
25 
26  """This function takes as arguments:
27  -a compressed (.gz) igprof output profile
28  -the output directory where to store the output
29  -the type of output wanted
30  Based on this information it automatically selects the igprof counter
31  (PERF_TICKS, MEM_TOTAL or MEM_LIVE) to use with igprof-analyse and it
32  performs the analysis.
33  If ASCII output_type is given, it keeps only the first seven lines of
34  the output file (the report) allowing quick access to the totals for
35  the counters in order to put together summary tables.
36  If SQLite3 output_type is given, it simply dumps the full reports in
37  sqlite3 format, ready to be browsed by igprof-navigator GUI (standalone
38  or cgi-bin).
39  """
40  #Use profile input file to determine the name of the output file adding the counter to it:
41  #outfile=profile_name[:-3]+"___"+AnalysisType+".res"
42  outfile=profile_name.split(".")[0].replace(IgProfProfile[AnalysisType],AnalysisType)+".res"
43  #Launch the 1 command:
44 
45  #command='igprof-analyse -d -v -g -r %s %s|tee -a \%s'%(AnalysisType,profile_name,outfile)
46  #Replacing tee: it is polluting the log files...
47 
48  #igprof-analyse command depends on the output type desired:
49  if output_type =="SQLite3":
50  #Case of dumping the igprof-analyse report in sqlite format to be igprof-navigator browseable
51  outfile= outfile[:-3]+"sql3" #NEED TO USE sql3 to be compatible with CGI-BIN igprof-navigator
52  command='igprof-analyse --sqlite -d -v -g -r %s %s |sqlite3 %s'%(AnalysisType,profile_name,outfile)
53  #Execute the igprof-analyse command
54  exit=execute(command)
55  elif output_type =="ASCII":
56  #We can keep this part of the igprof-analysis, to create the html table with the totals at each dump
57  command='igprof-analyse -d -v -g -r %s %s > %s'%(AnalysisType,profile_name,outfile)
58  #Execute the igprof-analyse command
59  exit=execute(command)
60  #Let's manipulate the ASCII output to only keep the top 7 lines:
61  # we open and read the txt ascii file
62  print "Reading the res file"
63  txt_file=open(outfile,'r')
64  txt_file_content=txt_file.readlines()#again:everything is an object
65  print "res file has %s lines!"%len(txt_file_content)
66  txt_file.close()
67  #overwrite the file to only save the first 7 lines:
68  print "Overwriting the res file, to reduce it to 7 lines"
69  out_file=open(outfile,'w')
70  line_num=0
71  for line in txt_file_content:
72  out_file.write(line)
73  line_num+=1
74  if line_num == 7:
75  break
76  out_file.close()
77 
78  return exit

Variable Documentation

string cmsIgProf_Analysis.action = 'store_true'

Definition at line 142 of file cmsIgProf_Analysis.py.

cmsIgProf_Analysis.AnalysisType = options.counter

Definition at line 154 of file cmsIgProf_Analysis.py.

string cmsIgProf_Analysis.default = ''

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.

dictionary cmsIgProf_Analysis.IgProfProfile
Initial value:
1 = {'PERF_TICKS':'IgProfPerf',
2  'MEM_TOTAL':'IgProfMem',
3  'MEM_LIVE':'IgProfMem',
4  'MEM_MAX':'IgProfMem'
5  }

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.