CMS 3D CMS Logo

Functions | Variables

cmsPerfHarvest Namespace Reference

Functions

def harvest
 Harvest all data from a perfsuite directory (if cpu subdirectories exist, it will examine them)
def optionParse
 Parse options.
def visit
 Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment.
def visit_timesize_steps
 Harvest information from a timesize directory, currently only retrieves TimingReport information.

Variables

tuple _PROG_NAME = os.path.basename(sys.argv[0])

Function Documentation

def cmsPerfHarvest::harvest (   perfdir)

Harvest all data from a perfsuite directory (if cpu subdirectories exist, it will examine them)

Definition at line 99 of file cmsPerfHarvest.py.

Referenced by HLTTauPostProcessor::endJob(), and HLTTauPostProcessor::endRun().

00100                     :
00101     cpureg = re.compile("cpu_([0-9][0-9]*)")
00102     out = {}
00103     globpath = os.path.join(perfdir, "cpu_*")
00104     globs = glob.glob(globpath)
00105     if len(globs) > 0:
00106         for globule in globs:
00107             base  = os.path.basename(globule)
00108             found = cpureg.search(base)
00109             if found:
00110                 cpuid = found.groups()[0]
00111                 if out.has_key(cpuid):
00112                     print "Error: we already have a cpu run with this id %s ! Skipping..." % cpuid
00113                 else:
00114                     if cpuid == None:
00115                         print "Error: could not resolve cpuid something is wrong"
00116                         cpuid = "None"
00117                     out[cpuid] = visit(globule)                
00118             else:
00119                 print "Error: could not determine valid cpu id from %s ! Skipping..." % base
00120 
00121     else:
00122         out["None"] = visit(perfdir)
00123         
00124     return out  

def cmsPerfHarvest::optionParse ( )

Parse options.

Definition at line 12 of file cmsPerfHarvest.py.

00013                  :
00014     parser = opt.OptionParser(usage="""./%s [perf dir] [options]""" % _PROG_NAME)
00015 
00016     (options, args) = parser.parse_args()
00017 
00018     if not len(args) == 1:
00019         parser.error("You have not supplied a perfsuite directory.")
00020         sys.exit()
00021 
00022     args[0] = os.path.abspath(args[0])
00023 
00024     ###########
00025     # Check existance of the directory supplied
00026     #
00027     if not os.path.isdir(args[0]):
00028         parser.error("You have not provided a valid perfsuite output directory")
00029         sys.exit()
00030 
00031     perfdir = args[0]
00032 
00033     return (perfdir)

def cmsPerfHarvest::visit (   visitdir)

Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment.

Definition at line 67 of file cmsPerfHarvest.py.

Referenced by BlockWipedPool::visit().

00068                    :
00069     out = {}
00070     for candle in Candles:
00071         globpath = os.path.join(visitdir,"%s_*" % (candle))
00072         globs = glob.glob(globpath)
00073         if len(globs) > 0:
00074             profsetreg = re.compile("%s_(.*)" % candle)
00075             for globule in globs:
00076                 base = os.path.basename(globule)
00077                 found = profsetreg.search(base)
00078                 if found:
00079                     profset = found.groups()[0]
00080                     if profset == "TimeSize": # Just do timesize for now!
00081                         if candle == None:
00082                             print "Error: could not resolve candle something is wrong"
00083                             candle = "None"
00084                         if profset == None:
00085                             print "Error: could not resolve profset something is wrong"
00086                             profset = "None"
00087                         if not out.has_key(candle):
00088                             out[candle] = {}
00089                         candledict = out[candle]
00090                         if candledict.has_key(profset):
00091                             print "Error: we already have a profset that matches %s" % str(profset)
00092                         else:
00093                             candledict[profset] = visit_timesize_steps(candle,globule)
00094                             out[candle] = candledict
00095     return out
        
def cmsPerfHarvest::visit_timesize_steps (   candle,
  profsetdir 
)

Harvest information from a timesize directory, currently only retrieves TimingReport information.

Definition at line 37 of file cmsPerfHarvest.py.

00038                                            :
00039     out = {}
00040     # Just do timing report for now
00041     globpath = os.path.join(profsetdir,"%s_*_TimingReport.log" % CandFname[candle])
00042     globs = glob.glob(globpath)
00043     if len(globs) > 0:
00044         stepreg = re.compile("%s_([^_]*)_TimingReport.log" % CandFname[candle])
00045         for globule in globs:
00046             base = os.path.basename(globule)
00047             found = stepreg.search(base)
00048             if found:
00049                 step = found.groups()[0]
00050                 try:
00051                     if step == None:
00052                         print "Error: could not resolve step something is wrong"
00053                         step = "None"
00054                     if not out.has_key("TimingReport"):
00055                         out["TimingReport"] = {}
00056                     stepdict = out["TimingReport"]
00057                     stepdict[step] = cpr.getTimingLogData(globule)
00058                     out["TimingReport"] = stepdict
00059                 except (OSError, IOError), detail:
00060                     print detail
00061             else:
00062                 print "Error: Could not determine step from %s" % base
00063     return out


Variable Documentation

tuple cmsPerfHarvest::_PROG_NAME = os.path.basename(sys.argv[0])

Definition at line 7 of file cmsPerfHarvest.py.