31 logfile=open(logfile_name,
'r') 32 logfile_lines=logfile.readlines() 34 print "The logfile %s is empty! Exiting now."%logfile_name
41 while i < len(logfile_lines):
44 if 'Composite Score:' in line:
46 line_content_list=line.split()
49 composite_score=
float(line_content_list[2])
52 data.append((bench_number,composite_score))
60 ROOT.gROOT.SetStyle(
"Plain")
68 rootfilename=
'%s/graphs.root' %outdir
69 myfile=ROOT.TFile(rootfilename,
'RECREATE')
75 interval=
int(max_val-min_val)
77 min_val=min_val-interval*0.2
78 max_val=max_val+interval*0.2
79 interval=
int(max_val-min_val)
81 nbins=
int(interval/secsperbin)
83 print 'Minval=',min_val,
' maxval=',max_val,
' interval=',interval
85 histo=ROOT.TH1F(
'Composite Score(Mflops)',
'Composite Score (Mflops)',nbins,min_val,max_val)
86 histo.GetXaxis().SetTitle(
"Mflops")
90 graph=ROOT.TGraph(npoints)
91 graph.SetMarkerStyle(8)
92 graph.SetMarkerSize(.7)
93 graph.SetMarkerColor(1)
96 graph.SetTitle(
'Composite Score')
97 graph.SetName(
'Composite Score')
98 graph.GetXaxis().SetTitle(
"Benchmark sequential number")
100 last_event=data[-1][0]
101 print 'last event =',last_event
102 graph.GetXaxis().SetLimits(0,last_event)
104 graph.GetYaxis().SetTitleOffset(1.3)
105 graph.GetYaxis().SetTitle(
"Mflops")
106 graph.GetYaxis().SetRangeUser(min_val,max_val)
113 for bench_number,composite_score
in data:
114 graph.SetPoint(evt_counter,bench_number,composite_score)
115 histo.Fill(composite_score)
120 avg_line=ROOT.TLine(1,avg,last_event,avg)
121 avg_line.SetLineColor(4)
122 avg_line.SetLineWidth(2)
125 graph_canvas=ROOT.TCanvas(
'graph_canvas')
128 avg_line.Draw(
"Same")
130 graph_canvas.Print(
"%s/graph.png" %outdir,
"png")
136 histo_canvas=ROOT.TCanvas(
'histo_canvas')
140 histo_canvas.Print(
"%s/histo.png" %outdir,
"png")
150 titlestring=
'<b>Report executed with release %s on %s.</b>\n<br>\n<hr>\n'\
151 %(os.environ[
'CMSSW_VERSION'],time.asctime())
153 html_file_name=
'%s/%s.html' %(outdir,logfile_name[:-4])
154 html_file=open(html_file_name,
'w')
155 html_file.write(
'<html>\n<body>\n'+\
157 html_file.write(
'<table>\n'+\
158 '<tr><td><img src=graph.png></img></td></tr>'+\
159 '<tr><td><img src=histo.png></img></td></tr>'+\
161 html_file.write(
'\n</body>\n</html>')
167 if __name__ ==
'__main__':
173 usage=
'cmsScimarkParser.py <options>' 174 parser = optparse.OptionParser(usage)
175 parser.add_option(
'-i',
'--in_ profile',
176 help=
'The profile to manipulate' ,
180 parser.add_option(
'-o',
'--outdir',
181 help=
'The directory of the output' ,
185 parser.add_option(
'-n',
186 help=
'Number of secs per bin. Default is 1.' ,
190 (options,args) = parser.parse_args()
193 if options.profile==
'' or\
195 raise(
'Please select a profile and an output dir!')
197 if not os.path.exists(options.profile)
or\
198 not os.path.exists(options.outdir):
199 raise (
'Outdir or input profile not present!')
204 print 'Problems in convertng starting event value!' def get_max(data, index=1)
def get_min(data, index=1)
def manipulate_log(outdir, logfile_name, secsperbin)