00021 :
00022
00023 import time
00024 import sys
00025 import ROOT
00026
00027
00028
00029 data=[]
00030
00031
00032 logfile=open(logfile_name,'r')
00033 logfile_lines=logfile.readlines()
00034 if not logfile_lines:
00035 print "The logfile %s is empty! Exiting now."%logfile_name
00036 sys.exit()
00037 logfile.close()
00038
00039
00040 i=0
00041 bench_number=0;
00042 while i < len(logfile_lines):
00043 line=logfile_lines[i]
00044
00045 if 'Composite Score:' in line:
00046 line=line[:-1]
00047 line_content_list=line.split()
00048
00049
00050 composite_score=float(line_content_list[2])
00051
00052 bench_number+=1
00053 data.append((bench_number,composite_score))
00054 i+=1
00055
00056
00057
00058
00059 __argv=sys.argv
00060 sys.argv=sys.argv[:1]
00061 ROOT.gROOT.SetStyle("Plain")
00062 sys.argv=__argv
00063
00064
00065
00066
00067
00068
00069 rootfilename='%s/graphs.root' %outdir
00070 myfile=ROOT.TFile(rootfilename,'RECREATE')
00071
00072
00073
00074 min_val=get_min(data,1)
00075 max_val=get_max(data,1)
00076 interval=int(max_val-min_val)
00077
00078 min_val=min_val-interval*0.2
00079 max_val=max_val+interval*0.2
00080 interval=int(max_val-min_val)
00081
00082 nbins=int(interval/secsperbin)
00083
00084 print 'Minval=',min_val,' maxval=',max_val, ' interval=',interval
00085
00086 histo=ROOT.TH1F('Composite Score(Mflops)','Composite Score (Mflops)',nbins,min_val,max_val)
00087 histo.GetXaxis().SetTitle("Mflops")
00088
00089 npoints=len(data)
00090
00091 graph=ROOT.TGraph(npoints)
00092 graph.SetMarkerStyle(8)
00093 graph.SetMarkerSize(.7)
00094 graph.SetMarkerColor(1)
00095 graph.SetLineWidth(3)
00096 graph.SetLineColor(2)
00097 graph.SetTitle('Composite Score')
00098 graph.SetName('Composite Score')
00099 graph.GetXaxis().SetTitle("Benchmark sequential number")
00100
00101 last_event=data[-1][0]
00102 print 'last event =',last_event
00103 graph.GetXaxis().SetLimits(0,last_event)
00104
00105 graph.GetYaxis().SetTitleOffset(1.3)
00106 graph.GetYaxis().SetTitle("Mflops")
00107 graph.GetYaxis().SetRangeUser(min_val,max_val)
00108
00109
00110
00111
00112
00113 evt_counter=0
00114 for bench_number,composite_score in data:
00115 graph.SetPoint(evt_counter,bench_number,composite_score)
00116 histo.Fill(composite_score)
00117 evt_counter+=1
00118
00119
00120 avg=histo.GetMean()
00121 avg_line=ROOT.TLine(1,avg,last_event,avg)
00122 avg_line.SetLineColor(4)
00123 avg_line.SetLineWidth(2)
00124
00125
00126 graph_canvas=ROOT.TCanvas('graph_canvas')
00127 graph_canvas.cd()
00128 graph.Draw("ALP")
00129 avg_line.Draw("Same")
00130
00131 graph_canvas.Print("%s/graph.gif" %outdir,"gif")
00132
00133
00134 graph.Write()
00135 graph_canvas.Write()
00136
00137 histo_canvas=ROOT.TCanvas('histo_canvas')
00138 histo_canvas.cd()
00139 histo.Draw('')
00140
00141 histo_canvas.Print("%s/histo.gif" %outdir,"gif")
00142
00143
00144 histo.Write()
00145 histo_canvas.Write()
00146
00147 myfile.Close()
00148
00149
00150
00151 titlestring='<b>Report executed with release %s on %s.</b>\n<br>\n<hr>\n'\
00152 %(os.environ['CMSSW_VERSION'],time.asctime())
00153
00154 html_file_name='%s/%s.html' %(outdir,logfile_name[:-4])
00155 html_file=open(html_file_name,'w')
00156 html_file.write('<html>\n<body>\n'+\
00157 titlestring)
00158 html_file.write('<table>\n'+\
00159 '<tr><td><img src=graph.gif></img></td></tr>'+\
00160 '<tr><td><img src=histo.gif></img></td></tr>'+\
00161 '</table>\n')
00162 html_file.write('\n</body>\n</html>')
00163 html_file.close()
00164