CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
edmStreamStallGrapher.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import sys
4 
5 if len(sys.argv) == 1:
6  s = """Purpose: Convert a cmsRun log with Tracer info into a stream stall graph.
7 
8 To Use: Add the Tracer Service to the cmsRun job you want to check for stream stalls.
9  Make sure to use the 'printTimstamps' option
10  cms.Service("Tracer", printTimestamps = cms.untracked.bool(True))
11  After running the job, execute this script and pass the name of the log file to the
12  script as the only command line argument.
13 
14 To Read: The script will then print an 'ASCII art' stall graph which consists of the name of
15  the module which either started or stopped running on a stream, and the state of each
16  stream at that moment in time and if the module just started, you will also see the
17  amount of time on that stream between the previous module finishing and this module starting.
18  The state of a stream is represented by a symbol:
19  blank (" ") the stream is currently running a module
20  line ("|") the stream is waiting to run a module
21  star ("*") the stream has just finished waiting and is starting a module
22  If a module had to wait more than 0.1 seconds, the end of the line will have "STALLED".
23  Once the first 4 events have finished processing, the program prints "FINISH INIT".
24  This is useful if one wants to ignore stalled caused by startup actions, e.g. reading
25  conditions.
26 
27  Once the graph is completed, the program outputs the list of modules which had
28  the greatest total stall times. The list is sorted by total stall time and
29  written in descending order. In addition, the list of all stall times for the
30  module is given.
31 """
32  print s
33  exit(0)
34 
35 fileName = sys.argv[1]
36 
37 f = open(fileName,"r")
38 
39 def getTime(line):
40  time = line.split(" ")[1]
41  time = time.split(":")
42  time = int(time[0])*60*60+int(time[1])*60+float(time[2])
43  return time
44 
45 processingSteps = list()
46 numStreams = 0
47 maxNameSize = 0
48 startTime = 0
49 foundEventToStartFrom = False
50 for l in f:
51  if not foundEventToStartFrom:
52  if l.find("event = 5") != -1:
53  foundEventToStartFrom = True
54  stream = int( l[l.find("stream = ")+9])
55  processingSteps.append(("FINISH INIT",1,stream,getTime(l)-startTime))
56  if l.find("processing event for module") != -1:
57  time = getTime(l)
58  if startTime == 0:
59  startTime = time
60  time = time - startTime
61  trans = 0
62  stream = 0
63  if l.find("finished:") != -1:
64  trans = 1
65  stream = int( l[l.find("stream = ")+9])
66  name = l.split("'")[1]
67  if len(name) > maxNameSize:
68  maxNameSize = len(name)
69  processingSteps.append((name,trans,stream,time))
70  if stream > numStreams:
71  numStreams = stream
72 f.close()
73 
74 
75 #print processingSteps
76 #exit(1)
77 streamState = [1]*(numStreams+1)
78 streamTime = [0]*(numStreams+1)
79 #lastTime = 0
80 seenInit = False
81 stalledModules = {}
82 for n,trans,s,time in processingSteps:
83  if n == "FINISH INIT":
84  seenInit = True
85  oldState = streamState[s]
86  streamState[s]=trans
87  waitTime = None
88  if not trans:
89  waitTime = time - streamTime[s]
90  streamState[s]=2
91  else:
92  if oldState != trans:
93  streamState[s]=3
94  streamTime[s] = time
95  states = "%-*s: " % (maxNameSize,n)
96  for state in streamState:
97  if state == 0:
98  states +=" "
99  elif state == 1:
100  states +="|"
101  elif state == 2:
102  states +="-"
103  elif state == 3:
104  states +="+"
105  if waitTime is not None:
106  states += " %.2f"% waitTime
107  if waitTime > 0.1 and seenInit:
108  t = stalledModules.setdefault(n,[])
109  t.append(waitTime)
110  states += " STALLED"
111 
112  print states
113  streamState[s]=trans
114 
115 priorities = list()
116 for n,t in stalledModules.iteritems():
117  t.sort(reverse=True)
118  priorities.append((n,sum(t),t))
119 
120 def sumSort(i,j):
121  return cmp(i[1],j[1])
122 priorities.sort(cmp=sumSort, reverse=True)
123 
124 for n,s,t in priorities:
125  print n, "%.2f"%s, [ "%.2f"%x for x in t]
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run