Teach schedgraph how to parse KTR_CRITICAL records. critical_enter/exit

events are now plotted as a counting graph, similar to CPU load, so that
their duration and critnest values can be visualized.
This commit is contained in:
scottl 2005-11-21 21:27:40 +00:00
parent 80adaaedab
commit 01fb37711b

View File

@ -815,6 +815,7 @@ def __init__(self, file):
self.sources = []
self.ticks = {}
self.load = {}
self.crit = {}
self.parse(file)
self.fixup()
@ -830,6 +831,7 @@ def parse(self, file):
ktrhdr = "\s+\d+\s+(\d+)\s+(\d+)\s+"
tdname = "(\S+)\(([^)]*)\)"
crittdname = "(\S+)\s+\(\d+,\s+([^)]*)\)"
ktrstr = "mi_switch: " + tdname
ktrstr += " prio (\d+) inhibit (\d+) wmesg (\S+) lock (\S+)"
@ -868,6 +870,9 @@ def parse(self, file):
cpuload_re = re.compile(ktrhdr + "load: (\d+)")
loadglobal_re = re.compile(ktrhdr + "global load: (\d+)")
ktrstr = "critical_\S+ by thread " + crittdname + " to (\d+)"
critsec_re = re.compile(ktrhdr + ktrstr)
parsers = [[cpuload_re, self.cpuload],
[loadglobal_re, self.loadglobal],
[switchin_re, self.switchin],
@ -879,6 +884,7 @@ def parse(self, file):
[sched_rem_re, self.sched_rem],
[sched_exit_re, self.sched_exit],
[sched_clock_re, self.sched_clock],
[critsec_re, self.critsec],
[idled_re, self.idled]]
for line in ifp.readlines():
@ -1024,6 +1030,18 @@ def loadglobal(self, cpu, timestamp, count):
self.sources.insert(0, load)
Count(load, cpu, timestamp, count)
def critsec(self, cpu, timestamp, td, pcomm, to):
if (self.checkstamp(timestamp) == 0):
return
cpu = int(cpu)
try:
crit = self.crit[cpu]
except:
crit = Counter("Critical Section")
self.crit[cpu] = crit
self.sources.insert(0, crit)
Count(crit, cpu, timestamp, to)
def findtd(self, td, pcomm):
for thread in self.threads:
if (thread.str == td and thread.name == pcomm):