16 values_set=(
'vsize',
'delta_vsize',
'rss',
'delta_rss')
19 logfile=open(logfile_name,
'r')
20 logfile_lines=logfile.readlines()
25 while i < len(logfile_lines):
27 if '%MSG-w MemoryCheck:' in line:
29 line_content_list=line.split(
' ')
30 event_number=int(line_content_list[-1])
31 if event_number<startevt:
37 line_content_list=line.split(
' ')
38 vsize=float(line_content_list[4])
39 delta_vsize=float(line_content_list[5])
40 rss=float(line_content_list[7])
41 delta_rss=float(line_content_list[8])
43 data.append((event_number,{
'vsize':vsize,
44 'delta_vsize':delta_vsize,
46 'delta_rss':delta_rss}))
53 if data[0][0]==data[1][0]:
54 print 'Two modules seem to have some output.\nCollapsing ...'
60 new_eventnumber=dataline1[0]
61 new_vsize=dataline2[1][
'vsize']
62 new_delta_vsize=dataline1[1][
'delta_vsize']+dataline2[1][
'delta_vsize']
63 new_rss=dataline2[1][
'rss']
64 new_delta_rss=dataline1[1][
'delta_rss']+dataline2[1][
'delta_rss']
66 new_data.append((new_eventnumber,{
'vsize':new_vsize,
67 'delta_vsize':new_delta_vsize,
69 'delta_rss':new_delta_rss}))
71 if i==len(data):
break
74 print 'Collapsing: Done!'
78 print '%s values read and stored ...' %npoints
84 ROOT.gROOT.SetStyle(
"Plain")
90 ROOT.gROOT.SetBatch(1)
93 rootfilename=
'%s/graphs.root' %outdir
94 myfile=ROOT.TFile(rootfilename,
'RECREATE')
98 for value
in values_set:
100 graph=ROOT.TGraph(npoints)
101 graph.SetMarkerStyle(8)
102 graph.SetMarkerSize(.7)
103 graph.SetMarkerColor(1)
104 graph.SetLineWidth(3)
105 graph.SetLineColor(2)
106 graph.SetTitle(value)
107 graph.SetName(
'%s_graph' %value)
112 for event_number,vals_dict
in data:
113 graph.SetPoint(point_counter,
118 graph.GetXaxis().SetTitle(
"Event")
119 last_event=data[-1][0]
120 graph.GetXaxis().SetRangeUser(0,last_event+1)
121 graph.GetYaxis().SetTitleOffset(1.3)
122 graph.GetYaxis().SetTitle(
"MB")
127 mycanvas=ROOT.TCanvas(
'%s_canvas' %value)
131 mycanvas.Print(
"%s/%s_graph.gif"%(outdir,value),
"gif")
143 titlestring=
'<b>Report executed with release %s on %s.</b>\n<br>\n<hr>\n'\
144 %(os.environ[
'CMSSW_VERSION'],time.asctime())
148 if len(logfile_name)>16
and 'TimingReport.log' in logfile_name[-16:]:
149 file_name=logfile_name[:-16]+
"_SimpleMemReport"
151 file_name=logfile_name[:-4]+
"_SimpleMemReport"
152 html_file_name=
'%s/%s.html' %(outdir,file_name)
153 html_file=open(html_file_name,
'w')
154 html_file.write(
'<html>\n<body>\n'+\
156 html_file.write(
'<table>\n'+\
157 '<tr><td><img src=vsize_graph.gif></img></td>'+\
158 '<td><img src=rss_graph.gif></img></td></tr>'+\
159 '<tr><td><img src=delta_vsize_graph.gif></img></td>'+\
160 '<td><img src=delta_rss_graph.gif></img></td></tr>' +\
163 html_file.write(
'\n</body>\n</html>')