00081 :
00082
00083 profSets = ["Callgrind",
00084
00085 "IgProf",
00086 "TimeSize",
00087
00088 "PU_Callgrind",
00089 "PU_IgProf",
00090 "PU_TimeSize"
00091 ]
00092 for candle in Candles:
00093
00094 for profset in profSets:
00095
00096 adir = os.path.join(newdir,"%s_%s" % (candle,profset))
00097 if os.path.exists(adir):
00098
00099 print "Found directory %s"%adir
00100
00101
00102 Profs = []
00103 if profset == "Callgrind" or profset == "PU_Callgrind":
00104 Profs = ["valgrind"]
00105 elif profset == "TimeSize" or profset == "PU_TimeSize":
00106 Profs = [ "TimingReport",
00107
00108 "SimpleMemoryCheck",
00109 "EdmSize"]
00110 elif profset == "IgProf" or profset == "PU_IgProf" :
00111 Profs = [ "IgProfperf",
00112 "IgProfMemTotal",
00113 "IgProfMemLive"]
00114
00115
00116 for prof in Profs:
00117 print "Checking %s profile(s)"%prof
00118 if prof == "EdmSize" or prof == "valgrind":
00119 stepLogs = glob.glob("%s/%s_*_%s" % (adir,CandFname[candle],prof))
00120 elif prof == "IgProfMemLive" or prof == "IgProfMemTotal":
00121 stepLogs = glob.glob("%s/%s_*_%s.gz" % (adir,CandFname[candle],"IgProfMemTotal"))
00122 elif prof == "IgProfperf":
00123 stepLogs = glob.glob("%s/%s_*_%s.gz" % (adir,CandFname[candle],prof))
00124 elif prof == "SimpleMemoryCheck":
00125
00126
00127
00128 stepLogs = glob.glob("%s/%s_*_%s.log" % (adir,CandFname[candle],'TimingReport'))
00129 elif prof == "TimingReport":
00130 stepLogs = glob.glob("%s/%s_*_%s.log" % (adir,CandFname[candle],prof))
00131
00132
00133 print "Found the following step logs: %s"%stepLogs
00134
00135 profdir = os.path.basename(adir)
00136
00137
00138
00139 if prof == "TimingReport" or prof == "EdmSize" or prof == "valgrind" or prof == "IgProfMemTotal" or prof == "IgProfMemLive" or prof == "IgProfperf":
00140
00141
00142 if prof == "IgProfMemLive":
00143 stepreg = re.compile("%s_([^_]*(_PILEUP)?)_%s((.log)|(.gz))?" % (CandFname[candle],"IgProfMemTotal"))
00144 else:
00145 stepreg = re.compile("%s_([^_]*(_PILEUP)?)_%s((.log)|(.gz))?" % (CandFname[candle],prof))
00146
00147
00148 for log in stepLogs:
00149 base = os.path.basename(log)
00150
00151 if prof == "IgProfMemTotal" or prof == "IgProfMemLive" or prof == "IgProfperf":
00152 base = base.split(".gz")[0]
00153
00154 searchob = stepreg.search(base)
00155
00156
00157 if searchob:
00158
00159 step = searchob.groups()[0]
00160
00161 outpath = os.path.join(adir,"%s_%s_%s_regression" % (CandFname[candle],step,prof))
00162 oldlog = os.path.join(olddir,"%s_%s" % (candle,profset),base)
00163
00164 if prof == "IgProfMemTotal" or prof == "IgProfMemLive" or prof == "IgProfperf":
00165 oldlog = os.path.join(olddir,"%s_%s" % (candle,profset),base + ".gz")
00166 if not os.path.exists(outpath):
00167 os.mkdir(outpath)
00168 if os.path.exists(oldlog):
00169 try:
00170 print ""
00171 print "** "
00172 if not prof == "TimingReport":
00173 print "** Comparing", candle, step, prof, "previous release: %s, latest release %s" % (oldlog,log)
00174 print "**"
00175
00176 if prof == "EdmSize":
00177 cpr.cmpEdmSizeReport(outpath,oldlog,log)
00178 elif prof == "TimingReport":
00179 logdir = "%s_%s_%s" % (CandFname[candle],step,prof)
00180 outd = os.path.join(adir,logdir)
00181 rootf = "timing-regress.root"
00182 oldlog = os.path.join(olddir,profdir,base)
00183 if os.path.exists(log) and os.path.exists(oldlog) and os.path.exists(outd):
00184 print "** Comparing", candle, step, prof, "previous release: %s and latest release: %s" % (oldlog,log)
00185 print "**"
00186 oldRelName = getOldRelName("",oldlog)
00187
00188 cpr.cmpTimingReport(rootf, outd, oldlog, log, 1, batch = True, prevrev = oldRelName)
00189 else:
00190 print "WARNING: While comparing", candle, step, prof, " at least one of the logfiles/directories: old (%s) or new (%s) was not found!!!" % (oldlog,log)
00191 break
00192 elif prof == "valgrind":
00193 cpr.cmpCallgrindReport(outpath,oldlog,log)
00194 elif prof == "IgProfperf":
00195 IgProfMemOpt=""
00196 cpr.cmpIgProfReport(outpath,oldlog,log,IgProfMemOpt)
00197 elif prof == "IgProfMemTotal":
00198 IgProfMemOpt="-y MEM_TOTAL"
00199 cpr.cmpIgProfReport(outpath,oldlog,log,IgProfMemOpt)
00200 elif prof == "IgProfMemLive":
00201 IgProfMemOpt="-y MEM_LIVE"
00202 cpr.cmpIgProfReport(outpath,oldlog,log,IgProfMemOpt)
00203 except cpr.PerfReportErr,detail:
00204 print "WARNING: Perfreport return non-zero exit status when comparing %s and %s. Perfreport output follows" % (oldlog,log)
00205 print detail.message
00206 except cpr.TimingParseErr,detail:
00207 print "WARNING: Could not parse data from log file %s; not performing regression" % detail.message
00208 except OSError, detail:
00209 print "WARNING: The OS returned the following error when comparing %s and %s" % (oldlog,log), detail
00210 except IOError, detail:
00211 print "IOError:", detail
00212 else:
00213 print "Successfully compared %s and %s" % (oldlog,log)
00214 else:
00215 print "WARNING: Could not find an equivalent logfile for %s in the previous release dir %s " % (log,oldlog)
00216
00217
00218 else:
00219 continue
00220 elif prof == "SimpleMemoryCheck":
00221
00222 for log in stepLogs:
00223
00224 stepreg = re.compile("%s_([^_]*(_PILEUP)?)_%s((.log)|(.gz))?" % (CandFname[candle],"TimingReport"))
00225 base = os.path.basename(log)
00226
00227 searchob = stepreg.search(base)
00228
00229
00230 if searchob:
00231
00232 step = searchob.groups()[0]
00233 print "and the step taken is %s"%step
00234
00235 oldlog = os.path.join(olddir,"%s_%s" % (candle,profset),base)
00236 if os.path.exists(oldlog):
00237 print ""
00238 print "** "
00239 print "** Comparing for SimpleMemoryCheck", candle, step, prof, "previous release: %s, latest release %s" % (oldlog,log)
00240 print "**"
00241
00242 compareSimMemPair(log,candle,profdir,adir,oldlog,oldRelName="")
00243
00244 if newRelName == "":
00245 newRelName = getVerFromLog(newdir)
00246 regress = open("%s/REGRESSION.%s.vs.%s" % (newdir,getVerFromLog(olddir),newRelName),"w")
00247 regress.write(olddir)
00248 regress.close()