32 logfile=open(logfile_name,
'r')
33 logfile_lines=logfile.readlines()
38 while i < len(logfile_lines):
40 if 'TimeEvent>' in line:
42 line_content_list=line.split(
' ')
43 event_number=int(line_content_list[1])
44 seconds=float(line_content_list[3])
45 data.append((event_number,seconds))
53 ROOT.gROOT.SetStyle(
"Plain")
58 ROOT.gROOT.SetBatch(1)
61 rootfilename=
'%s/graphs.root' %outdir
62 myfile=ROOT.TFile(rootfilename,
'RECREATE')
68 interval=max_val-min_val
70 min_val=min_val-interval*0.2
71 max_val=max_val+interval*0.2
72 interval=max_val-min_val
74 nbins=int(interval/secsperbin)
76 print 'Minval=',min_val,
' maxval=',max_val,
' interval=',interval
78 histo=ROOT.TH1F(
'Seconds per event',
'Seconds per event',nbins,min_val,max_val)
79 histo.GetXaxis().SetTitle(
"s")
83 graph=ROOT.TGraph(npoints)
84 graph.SetMarkerStyle(8)
85 graph.SetMarkerSize(.7)
86 graph.SetMarkerColor(1)
89 graph.SetTitle(
'Seconds per event')
90 graph.SetName(
'SecondsPerEvent')
91 graph.GetXaxis().SetTitle(
"Event")
93 last_event=data[-1][0]
94 print 'last event =',last_event
95 graph.GetXaxis().SetLimits(0,last_event)
97 graph.GetYaxis().SetTitleOffset(1.3)
98 graph.GetYaxis().SetTitle(
"s")
99 graph.GetYaxis().SetRangeUser(0,max_val)
107 for evt_num,secs
in data:
108 graph.SetPoint(evt_counter,evt_num,secs)
113 print 'Total Time=', total
117 avg_line=ROOT.TLine(1,avg,last_event,avg)
118 avg_line.SetLineColor(4)
119 avg_line.SetLineWidth(2)
122 graph_canvas=ROOT.TCanvas(
'graph_canvas')
125 avg_line.Draw(
"Same")
127 graph_canvas.Print(
"%s/graph.gif" %outdir,
"gif")
133 histo_canvas=ROOT.TCanvas(
'histo_canvas')
137 histo_canvas.Print(
"%s/histo.gif" %outdir,
"gif")
147 titlestring=
'<b>Report executed with release %s on %s.</b>\n<br>\n<hr>\n'\
148 %(os.environ[
'CMSSW_VERSION'],time.asctime())
150 html_file_name=
'%s/%s.html' %(outdir,logfile_name[:-4])
151 html_file=open(html_file_name,
'w')
152 html_file.write(
'<html>\n<body>\n'+\
154 html_file.write(
'<table>\n'+\
155 '<tr><td><img src=graph.gif></img></td></tr>'+\
156 '<tr><td><img src=histo.gif></img></td></tr>'+\
158 html_file.write(
'\n</body>\n</html>')