4 from __future__
import print_function
32 logfile=open(logfile_name,
'r') 33 logfile_lines=logfile.readlines() 35 print(
"The logfile %s is empty! Exiting now."%logfile_name)
42 while i < len(logfile_lines):
45 if 'Composite Score:' in line:
47 line_content_list=line.split()
50 composite_score=
float(line_content_list[2])
53 data.append((bench_number,composite_score))
61 ROOT.gROOT.SetStyle(
"Plain")
69 rootfilename=
'%s/graphs.root' %outdir
70 myfile=ROOT.TFile(rootfilename,
'RECREATE')
76 interval=
int(max_val-min_val)
78 min_val=min_val-interval*0.2
79 max_val=max_val+interval*0.2
80 interval=
int(max_val-min_val)
82 nbins=
int(interval/secsperbin)
84 print(
'Minval=',min_val,
' maxval=',max_val,
' interval=',interval)
86 histo=ROOT.TH1F(
'Composite Score(Mflops)',
'Composite Score (Mflops)',nbins,min_val,max_val)
87 histo.GetXaxis().SetTitle(
"Mflops")
91 graph=ROOT.TGraph(npoints)
92 graph.SetMarkerStyle(8)
93 graph.SetMarkerSize(.7)
94 graph.SetMarkerColor(1)
97 graph.SetTitle(
'Composite Score')
98 graph.SetName(
'Composite Score')
99 graph.GetXaxis().SetTitle(
"Benchmark sequential number")
101 last_event=data[-1][0]
102 print(
'last event =',last_event)
103 graph.GetXaxis().SetLimits(0,last_event)
105 graph.GetYaxis().SetTitleOffset(1.3)
106 graph.GetYaxis().SetTitle(
"Mflops")
107 graph.GetYaxis().SetRangeUser(min_val,max_val)
114 for bench_number,composite_score
in data:
115 graph.SetPoint(evt_counter,bench_number,composite_score)
116 histo.Fill(composite_score)
121 avg_line=ROOT.TLine(1,avg,last_event,avg)
122 avg_line.SetLineColor(4)
123 avg_line.SetLineWidth(2)
126 graph_canvas=ROOT.TCanvas(
'graph_canvas')
129 avg_line.Draw(
"Same")
131 graph_canvas.Print(
"%s/graph.png" %outdir,
"png")
137 histo_canvas=ROOT.TCanvas(
'histo_canvas')
141 histo_canvas.Print(
"%s/histo.png" %outdir,
"png")
151 titlestring=
'<b>Report executed with release %s on %s.</b>\n<br>\n<hr>\n'\
152 %(os.environ[
'CMSSW_VERSION'],time.asctime())
154 html_file_name=
'%s/%s.html' %(outdir,logfile_name[:-4])
155 html_file=open(html_file_name,
'w')
156 html_file.write(
'<html>\n<body>\n'+\
158 html_file.write(
'<table>\n'+\
159 '<tr><td><img src=graph.png></img></td></tr>'+\
160 '<tr><td><img src=histo.png></img></td></tr>'+\
162 html_file.write(
'\n</body>\n</html>')
168 if __name__ ==
'__main__':
174 usage=
'cmsScimarkParser.py <options>' 175 parser = optparse.OptionParser(usage)
176 parser.add_option(
'-i',
'--in_ profile',
177 help=
'The profile to manipulate' ,
181 parser.add_option(
'-o',
'--outdir',
182 help=
'The directory of the output' ,
186 parser.add_option(
'-n',
187 help=
'Number of secs per bin. Default is 1.' ,
191 (options,args) = parser.parse_args()
194 if options.profile==
'' or\
196 raise(
'Please select a profile and an output dir!')
198 if not os.path.exists(options.profile)
or\
199 not os.path.exists(options.outdir):
200 raise (
'Outdir or input profile not present!')
205 print(
'Problems in convertng starting event value!')
def get_max(data, index=1)
S & print(S &os, JobReport::InputFile const &f)
def get_min(data, index=1)
def manipulate_log(outdir, logfile_name, secsperbin)