CMS 3D CMS Logo

Classes | Functions | Variables
edmTracerCompactLogViewer Namespace Reference

Classes

class  Activity
 
class  Containers
 
class  Counter
 
class  DummyFile
 
class  EDModuleTransitionParser
 
class  ESModuleTransitionParser
 
class  FrameworkTransitionParser
 
class  ModuleCentricContainers
 
class  Phase
 
class  PostEDModuleAcquireParser
 
class  PostEDModuleEventDelayedGetParser
 
class  PostEDModulePrefetchingParser
 
class  PostEDModuleTransitionParser
 
class  PostESModuleAcquireParser
 
class  PostESModulePrefetchingParser
 
class  PostESModuleTransitionParser
 
class  PostEventReadFromSourceParser
 
class  PostFrameworkTransitionParser
 
class  PostSourceTransitionParser
 
class  PreEDModuleAcquireParser
 
class  PreEDModuleEventDelayedGetParser
 
class  PreEDModulePrefetchingParser
 
class  PreEDModuleTransitionParser
 
class  PreESModuleAcquireParser
 
class  PreESModulePrefetchingParser
 
class  PreESModuleTransitionParser
 
class  PreEventReadFromSourceParser
 
class  PreFrameworkTransitionParser
 
class  PreSourceTransitionParser
 
class  QueuingFrameworkTransitionParser
 
class  SourceTransitionParser
 
class  TestModuleCommand
 
class  TracerCompactFileParser
 

Functions

def findMatchingTransition (sync, containers)
 
def jsonInfo (parser)
 
def jsonModuleTransition (type, id, modID, callID, activity, start, finish=0)
 
def jsonTransition (type, id, sync, start, finish, isSrc=False)
 
def lineParserFactory (step, payload, moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric)
 
def popQueuedTransitions (sync, container)
 
def printHelp ()
 
def processingStepsFromFile (f, moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric)
 
def runTests ()
 
def startTime (x)
 
def textOutput (parser)
 
def textPrefix_ (time, indentLevel)
 
def transitionIndentLevel (transition)
 
def transitionIsGlobal (transition)
 
def transitionName (transition)
 

Variables

 action
 
 args
 
 description
 
 epilog
 
 f
 
 formatter_class
 
 globalTransitions_
 
 help
 
 j
 
 kLargestLumiNumber
 
 kMicroToSec
 
 kSourceDelayedRead
 
 kSourceFindEvent
 
 parser
 
 transitionsToFindMatch_
 
 transitionToIndent_
 
 transitionToNames_
 
 type
 

Function Documentation

◆ findMatchingTransition()

def edmTracerCompactLogViewer.findMatchingTransition (   sync,
  containers 
)

Definition at line 224 of file edmTracerCompactLogViewer.py.

References print(), and isotrackApplyRegressor.range.

Referenced by edmTracerCompactLogViewer.QueuingFrameworkTransitionParser.jsonInfo().

224 def findMatchingTransition(sync, containers):
225  for i in range(len(containers)):
226  if containers[i][-1]["sync"] == sync:
227  return i
228  #need more exhausting search
229  for i in range(len(containers)):
230  for t in containers[i]:
231  if t["sync"] == sync:
232  return i
233 
234  print("find failed",sync, containers)
235  return None
236 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def findMatchingTransition(sync, containers)

◆ jsonInfo()

def edmTracerCompactLogViewer.jsonInfo (   parser)

Definition at line 991 of file edmTracerCompactLogViewer.py.

References mps_setup.append.

Referenced by edmTracerCompactLogViewer.TestModuleCommand.testFrameworkOnly(), edmTracerCompactLogViewer.TestModuleCommand.testFull(), and edmTracerCompactLogViewer.TestModuleCommand.testModuleCentric().

991 def jsonInfo(parser):
992  counter = Counter()
993  if parser._moduleCentric:
994  data = ModuleCentricContainers()
995  else:
996  data = Containers()
997  for p in parser.processingSteps():
998  p.jsonInfo(counter, data)
999  #make sure everything is sorted
1000  for g in data.allGlobals():
1001  g.sort(key=startTime)
1002  final = {"transitions" : [] , "modules": [], "esModules": []}
1003  final["transitions"].append({ "name":"Global", "slots": []})
1004  globals = final["transitions"][-1]["slots"]
1005  for i, g in enumerate(data.allGlobals()):
1006  globals.append(g)
1007  if not parser._moduleCentric and not parser._frameworkOnly:
1008  if len(data._modGlobals) < i+1:
1009  break
1010  for mod in data._modGlobals[i]:
1011  globals.append(mod)
1012  for i,s in enumerate(data.allStreams()):
1013  final["transitions"].append({"name": f"Stream {i}", "slots":[]})
1014  stream = final["transitions"][-1]["slots"]
1015  stream.append(s)
1016  if not parser._moduleCentric and not parser._frameworkOnly:
1017  for mod in data._modStreams[i]:
1018  stream.append(mod)
1019  if parser._moduleCentric:
1020  sourceSlot = data._modules[data._moduleID2Index(0)]
1021  modules = []
1022  for i,m in parser._moduleNames.items():
1023  modules.append({"name": f"{m}", "slots":[]})
1024  slots = modules[-1]["slots"]
1025  foundSlots = data._modules[data._moduleID2Index(i)]
1026  time = 0
1027  for s in foundSlots:
1028  slots.append(s)
1029  for t in s:
1030  if t["act"] !=Activity.prefetch:
1031  time += t["finish"]-t["start"]
1032  modules[-1]['time']=time
1033  for i,m in parser._esModuleNames.items():
1034  modules.append({"name": f"{m}", "slots":[]})
1035  slots = modules[-1]["slots"]
1036  foundSlots = data._modules[data._moduleID2Index(-1*i)]
1037  time = 0
1038  for s in foundSlots:
1039  slots.append(s)
1040  for t in s:
1041  if t["act"] !=Activity.prefetch:
1042  time += t["finish"]-t["start"]
1043  modules[-1]['time']=time
1044  modules.sort(key= lambda x : x['time'], reverse=True)
1045  final['transitions'].append({"name": "source", "slots":sourceSlot})
1046  for m in modules:
1047  final['transitions'].append(m)
1048 
1049  if not parser._frameworkOnly:
1050  max = 0
1051  for k in parser._moduleNames.keys():
1052  if k > max:
1053  max = k
1054 
1055  final["modules"] =['']*(max+1)
1056  final["modules"][0] = 'source'
1057  for k,v in parser._moduleNames.items():
1058  final["modules"][k]=v
1059 
1060  max = 0
1061  for k in parser._esModuleNames.keys():
1062  if k > max:
1063  max = k
1064  final["esModules"] = ['']*(max+1)
1065  for k,v in parser._esModuleNames.items():
1066  final["esModules"][k] = v
1067  return final
1068 
1069 #=======================================
std::function< unsigned int(align::ID)> Counter

◆ jsonModuleTransition()

def edmTracerCompactLogViewer.jsonModuleTransition (   type,
  id,
  modID,
  callID,
  activity,
  start,
  finish = 0 
)

Definition at line 986 of file edmTracerCompactLogViewer.py.

Referenced by edmTracerCompactLogViewer.EDModuleTransitionParser._preJson(), edmTracerCompactLogViewer.ESModuleTransitionParser._preJson(), edmTracerCompactLogViewer.PostEDModulePrefetchingParser.jsonInfo(), and edmTracerCompactLogViewer.PostEDModuleAcquireParser.jsonInfo().

986 def jsonModuleTransition(type, id, modID, callID, activity, start, finish=0):
987  return {"type": type, "id": id, "mod": modID, "call": callID, "act": activity, "start": start*kMicroToSec, "finish": finish*kMicroToSec}
988 
def jsonModuleTransition(type, id, modID, callID, activity, start, finish=0)

◆ jsonTransition()

def edmTracerCompactLogViewer.jsonTransition (   type,
  id,
  sync,
  start,
  finish,
  isSrc = False 
)

Definition at line 983 of file edmTracerCompactLogViewer.py.

Referenced by edmTracerCompactLogViewer.QueuingFrameworkTransitionParser.jsonInfo().

983 def jsonTransition(type, id, sync, start, finish, isSrc=False):
984  return {"type": type, "id": id, "sync": sync, "start": start*kMicroToSec, "finish": finish*kMicroToSec, "isSrc":isSrc}
985 
def jsonTransition(type, id, sync, start, finish, isSrc=False)

◆ lineParserFactory()

def edmTracerCompactLogViewer.lineParserFactory (   step,
  payload,
  moduleNames,
  esModuleNames,
  recordNames,
  frameworkOnly,
  moduleCentric 
)

Definition at line 724 of file edmTracerCompactLogViewer.py.

Referenced by processingStepsFromFile().

724 def lineParserFactory (step, payload, moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric):
725  if step == 'F':
726  parser = PreFrameworkTransitionParser(payload)
727  if parser.transition == Phase.esSyncEnqueue:
728  return QueuingFrameworkTransitionParser(payload)
729  return parser
730  if step == 'f':
731  return PostFrameworkTransitionParser(payload)
732  if step == 'S':
733  return PreSourceTransitionParser(payload, moduleCentric)
734  if step == 's':
735  return PostSourceTransitionParser(payload, moduleCentric)
736  if frameworkOnly:
737  return None
738  if step == 'M':
739  return PreEDModuleTransitionParser(payload, moduleNames, moduleCentric)
740  if step == 'm':
741  return PostEDModuleTransitionParser(payload, moduleNames)
742  if step == 'P':
743  return PreEDModulePrefetchingParser(payload, moduleNames, moduleCentric)
744  if step == 'p':
745  return PostEDModulePrefetchingParser(payload, moduleNames, moduleCentric)
746  if step == 'A':
747  return PreEDModuleAcquireParser(payload, moduleNames, moduleCentric)
748  if step == 'a':
749  return PostEDModuleAcquireParser(payload, moduleNames, moduleCentric)
750  if step == 'D':
751  return PreEDModuleEventDelayedGetParser(payload, moduleNames)
752  if step == 'd':
753  return PostEDModuleEventDelayedGetParser(payload, moduleNames)
754  if step == 'R':
755  return PreEventReadFromSourceParser(payload, moduleNames)
756  if step == 'r':
757  return PostEventReadFromSourceParser(payload, moduleNames)
758  if step == 'N':
759  return PreESModuleTransitionParser(payload, moduleNames, esModuleNames, recordNames)
760  if step == 'n':
761  return PostESModuleTransitionParser(payload, moduleNames, esModuleNames, recordNames)
762  if step == 'Q':
763  return PreESModulePrefetchingParser(payload, moduleNames, esModuleNames, recordNames, moduleCentric)
764  if step == 'q':
765  return PostESModulePrefetchingParser(payload, moduleNames, esModuleNames, recordNames, moduleCentric)
766  if step == 'B':
767  return PreESModuleAcquireParser(payload, moduleNames, esModuleNames, recordNames)
768  if step == 'b':
769  return PostESModuleAcquireParser(payload, moduleNames, esModuleNames, recordNames)
770 
771 
772 #----------------------------------------------
def lineParserFactory(step, payload, moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric)

◆ popQueuedTransitions()

def edmTracerCompactLogViewer.popQueuedTransitions (   sync,
  container 
)

Definition at line 237 of file edmTracerCompactLogViewer.py.

References isotrackApplyRegressor.range.

237 def popQueuedTransitions(sync, container):
238  results = []
239  for i in range(len(container)):
240  if sync == container[i]["sync"]:
241  results.append(container[i])
242  results.append(container[i+1])
243  del container[i]
244  del container[i]
245  break
246  return results
247 
def popQueuedTransitions(sync, container)

◆ printHelp()

def edmTracerCompactLogViewer.printHelp ( )

Definition at line 10 of file edmTracerCompactLogViewer.py.

10 def printHelp():
11  s = '''
12 To Use: Add the Tracer Service to the cmsRun job use something like this
13  in the configuration:
14 
15  process.add_(cms.Service("Tracer", fileName = cms.untracked.string("tracer.log")))
16 
17  After running the job, execute this script and pass the name of the
18  Tracer log file to the script.
19 
20  This script will output a more human readable form of the data in the Tracer log file.'''
21  return s
22 
23 #these values come from tracer_setupFile.cc
24 #enum class Step : char {
25 # preSourceTransition = 'S',
26 # postSourceTransition = 's',
27 # preModulePrefetching = 'P',
28 # postModulePrefetching = 'p',
29 # preModuleEventAcquire = 'A',
30 # postModuleEventAcquire = 'a',
31 # preModuleTransition = 'M',
32 # preEventReadFromSource = 'R',
33 # postEventReadFromSource = 'r',
34 # preModuleEventDelayedGet = 'D',
35 # postModuleEventDelayedGet = 'd',
36 # postModuleTransition = 'm',
37 # preESModulePrefetching = 'Q',
38 # postESModulePrefetching = 'q',
39 # preESModule = 'N',
40 # postESModule = 'n',
41 # preESModuleAcquire = 'B',
42 # postESModuleAcquire = 'b',
43 # preFrameworkTransition = 'F',
44 # postFrameworkTransition = 'f'
45 #};
46 
47 

◆ processingStepsFromFile()

def edmTracerCompactLogViewer.processingStepsFromFile (   f,
  moduleNames,
  esModuleNames,
  recordNames,
  frameworkOnly,
  moduleCentric 
)

Definition at line 773 of file edmTracerCompactLogViewer.py.

References lineParserFactory(), and mkLumiAveragedPlots.tuple.

Referenced by edmTracerCompactLogViewer.TracerCompactFileParser.processingSteps().

773 def processingStepsFromFile(f,moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric):
774  for rawl in f:
775  l = rawl.strip()
776  if not l or l[0] == '#':
777  continue
778  (step,payload) = tuple(l.split(None,1))
779  payload=payload.split()
780 
781  parser = lineParserFactory(step, payload, moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric)
782  if parser:
783  yield parser
784  return
785 
def processingStepsFromFile(f, moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric)
def lineParserFactory(step, payload, moduleNames, esModuleNames, recordNames, frameworkOnly, moduleCentric)

◆ runTests()

def edmTracerCompactLogViewer.runTests ( )

Definition at line 1250 of file edmTracerCompactLogViewer.py.

1250 def runTests():
1251  return unittest.main(argv=sys.argv[:1])
1252 
1253 #=======================================

◆ startTime()

def edmTracerCompactLogViewer.startTime (   x)

Definition at line 989 of file edmTracerCompactLogViewer.py.

989 def startTime(x):
990  return x["start"]

◆ textOutput()

def edmTracerCompactLogViewer.textOutput (   parser)

Definition at line 843 of file edmTracerCompactLogViewer.py.

References print().

843 def textOutput( parser ):
844  context = {}
845  for p in parser.processingSteps():
846  print(p.text(context))
847 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ textPrefix_()

def edmTracerCompactLogViewer.textPrefix_ (   time,
  indentLevel 
)

Definition at line 180 of file edmTracerCompactLogViewer.py.

Referenced by edmTracerCompactLogViewer.FrameworkTransitionParser.textPrefix(), edmTracerCompactLogViewer.SourceTransitionParser.textPrefix(), edmTracerCompactLogViewer.EDModuleTransitionParser.textPrefix(), and edmTracerCompactLogViewer.ESModuleTransitionParser.textPrefix().

180 def textPrefix_(time, indentLevel):
181  #using 11 spaces for time should accomodate a job that runs 24 hrs
182  return f'{time:>11} '+"++"*indentLevel
183 
def textPrefix_(time, indentLevel)

◆ transitionIndentLevel()

def edmTracerCompactLogViewer.transitionIndentLevel (   transition)

◆ transitionIsGlobal()

def edmTracerCompactLogViewer.transitionIsGlobal (   transition)

◆ transitionName()

def edmTracerCompactLogViewer.transitionName (   transition)

Definition at line 123 of file edmTracerCompactLogViewer.py.

123 def transitionName(transition):
124  return transitionToNames_[transition]
125 

Variable Documentation

◆ action

edmTracerCompactLogViewer.action

Definition at line 1267 of file edmTracerCompactLogViewer.py.

◆ args

edmTracerCompactLogViewer.args

Definition at line 1282 of file edmTracerCompactLogViewer.py.

◆ description

edmTracerCompactLogViewer.description

Definition at line 1260 of file edmTracerCompactLogViewer.py.

◆ epilog

edmTracerCompactLogViewer.epilog

Definition at line 1262 of file edmTracerCompactLogViewer.py.

◆ f

edmTracerCompactLogViewer.f

Definition at line 1292 of file edmTracerCompactLogViewer.py.

◆ formatter_class

edmTracerCompactLogViewer.formatter_class

Definition at line 1261 of file edmTracerCompactLogViewer.py.

◆ globalTransitions_

edmTracerCompactLogViewer.globalTransitions_

Definition at line 157 of file edmTracerCompactLogViewer.py.

◆ help

edmTracerCompactLogViewer.help

Definition at line 1265 of file edmTracerCompactLogViewer.py.

◆ j

edmTracerCompactLogViewer.j

Definition at line 1288 of file edmTracerCompactLogViewer.py.

◆ kLargestLumiNumber

edmTracerCompactLogViewer.kLargestLumiNumber

Definition at line 53 of file edmTracerCompactLogViewer.py.

◆ kMicroToSec

edmTracerCompactLogViewer.kMicroToSec

Definition at line 48 of file edmTracerCompactLogViewer.py.

◆ kSourceDelayedRead

edmTracerCompactLogViewer.kSourceDelayedRead

Definition at line 51 of file edmTracerCompactLogViewer.py.

◆ kSourceFindEvent

edmTracerCompactLogViewer.kSourceFindEvent

Definition at line 50 of file edmTracerCompactLogViewer.py.

◆ parser

edmTracerCompactLogViewer.parser

Definition at line 1260 of file edmTracerCompactLogViewer.py.

◆ transitionsToFindMatch_

edmTracerCompactLogViewer.transitionsToFindMatch_

Definition at line 248 of file edmTracerCompactLogViewer.py.

◆ transitionToIndent_

edmTracerCompactLogViewer.transitionToIndent_

Definition at line 126 of file edmTracerCompactLogViewer.py.

◆ transitionToNames_

edmTracerCompactLogViewer.transitionToNames_

Definition at line 94 of file edmTracerCompactLogViewer.py.

◆ type

edmTracerCompactLogViewer.type

Definition at line 1264 of file edmTracerCompactLogViewer.py.