Commit 8b2f0cb6 authored by Todd Brandt's avatar Todd Brandt Committed by Rafael J. Wysocki

pm-graph: v5.12, code revamp for python3.12

sleepgraph/bootgraph function correctly in python3.12 but include a slew
of deprecation warnings for unsupported regexes. This patch fixes up all
the strings in the code so that it comforms with python3.12 standards.
Signed-off-by: default avatarTodd Brandt <todd.e.brandt@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent c9d197ec
...@@ -77,12 +77,12 @@ class SystemValues(aslib.SystemValues): ...@@ -77,12 +77,12 @@ class SystemValues(aslib.SystemValues):
fp.close() fp.close()
self.testdir = datetime.now().strftime('boot-%y%m%d-%H%M%S') self.testdir = datetime.now().strftime('boot-%y%m%d-%H%M%S')
def kernelVersion(self, msg): def kernelVersion(self, msg):
m = re.match('^[Ll]inux *[Vv]ersion *(?P<v>\S*) .*', msg) m = re.match(r'^[Ll]inux *[Vv]ersion *(?P<v>\S*) .*', msg)
if m: if m:
return m.group('v') return m.group('v')
return 'unknown' return 'unknown'
def checkFtraceKernelVersion(self): def checkFtraceKernelVersion(self):
m = re.match('^(?P<x>[0-9]*)\.(?P<y>[0-9]*)\.(?P<z>[0-9]*).*', self.kernel) m = re.match(r'^(?P<x>[0-9]*)\.(?P<y>[0-9]*)\.(?P<z>[0-9]*).*', self.kernel)
if m: if m:
val = tuple(map(int, m.groups())) val = tuple(map(int, m.groups()))
if val >= (4, 10, 0): if val >= (4, 10, 0):
...@@ -324,7 +324,7 @@ def parseKernelLog(): ...@@ -324,7 +324,7 @@ def parseKernelLog():
idx = line.find('[') idx = line.find('[')
if idx > 1: if idx > 1:
line = line[idx:] line = line[idx:]
m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line) m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
if(not m): if(not m):
continue continue
ktime = float(m.group('ktime')) ktime = float(m.group('ktime'))
...@@ -332,24 +332,24 @@ def parseKernelLog(): ...@@ -332,24 +332,24 @@ def parseKernelLog():
break break
msg = m.group('msg') msg = m.group('msg')
data.dmesgtext.append(line) data.dmesgtext.append(line)
if(ktime == 0.0 and re.match('^Linux version .*', msg)): if(ktime == 0.0 and re.match(r'^Linux version .*', msg)):
if(not sysvals.stamp['kernel']): if(not sysvals.stamp['kernel']):
sysvals.stamp['kernel'] = sysvals.kernelVersion(msg) sysvals.stamp['kernel'] = sysvals.kernelVersion(msg)
continue continue
m = re.match('.* setting system clock to (?P<d>[0-9\-]*)[ A-Z](?P<t>[0-9:]*) UTC.*', msg) m = re.match(r'.* setting system clock to (?P<d>[0-9\-]*)[ A-Z](?P<t>[0-9:]*) UTC.*', msg)
if(m): if(m):
bt = datetime.strptime(m.group('d')+' '+m.group('t'), '%Y-%m-%d %H:%M:%S') bt = datetime.strptime(m.group('d')+' '+m.group('t'), '%Y-%m-%d %H:%M:%S')
bt = bt - timedelta(seconds=int(ktime)) bt = bt - timedelta(seconds=int(ktime))
data.boottime = bt.strftime('%Y-%m-%d_%H:%M:%S') data.boottime = bt.strftime('%Y-%m-%d_%H:%M:%S')
sysvals.stamp['time'] = bt.strftime('%B %d %Y, %I:%M:%S %p') sysvals.stamp['time'] = bt.strftime('%B %d %Y, %I:%M:%S %p')
continue continue
m = re.match('^calling *(?P<f>.*)\+.* @ (?P<p>[0-9]*)', msg) m = re.match(r'^calling *(?P<f>.*)\+.* @ (?P<p>[0-9]*)', msg)
if(m): if(m):
func = m.group('f') func = m.group('f')
pid = int(m.group('p')) pid = int(m.group('p'))
devtemp[func] = (ktime, pid) devtemp[func] = (ktime, pid)
continue continue
m = re.match('^initcall *(?P<f>.*)\+.* returned (?P<r>.*) after (?P<t>.*) usecs', msg) m = re.match(r'^initcall *(?P<f>.*)\+.* returned (?P<r>.*) after (?P<t>.*) usecs', msg)
if(m): if(m):
data.valid = True data.valid = True
data.end = ktime data.end = ktime
...@@ -359,7 +359,7 @@ def parseKernelLog(): ...@@ -359,7 +359,7 @@ def parseKernelLog():
data.newAction(phase, f, pid, start, ktime, int(r), int(t)) data.newAction(phase, f, pid, start, ktime, int(r), int(t))
del devtemp[f] del devtemp[f]
continue continue
if(re.match('^Freeing unused kernel .*', msg)): if(re.match(r'^Freeing unused kernel .*', msg)):
data.tUserMode = ktime data.tUserMode = ktime
data.dmesg['kernel']['end'] = ktime data.dmesg['kernel']['end'] = ktime
data.dmesg['user']['start'] = ktime data.dmesg['user']['start'] = ktime
......
...@@ -420,11 +420,11 @@ class SystemValues: ...@@ -420,11 +420,11 @@ class SystemValues:
return value.format(**args) return value.format(**args)
def setOutputFile(self): def setOutputFile(self):
if self.dmesgfile != '': if self.dmesgfile != '':
m = re.match('(?P<name>.*)_dmesg\.txt.*', self.dmesgfile) m = re.match(r'(?P<name>.*)_dmesg\.txt.*', self.dmesgfile)
if(m): if(m):
self.htmlfile = m.group('name')+'.html' self.htmlfile = m.group('name')+'.html'
if self.ftracefile != '': if self.ftracefile != '':
m = re.match('(?P<name>.*)_ftrace\.txt.*', self.ftracefile) m = re.match(r'(?P<name>.*)_ftrace\.txt.*', self.ftracefile)
if(m): if(m):
self.htmlfile = m.group('name')+'.html' self.htmlfile = m.group('name')+'.html'
def systemInfo(self, info): def systemInfo(self, info):
...@@ -464,15 +464,15 @@ class SystemValues: ...@@ -464,15 +464,15 @@ class SystemValues:
if os.path.exists('/proc/cpuinfo'): if os.path.exists('/proc/cpuinfo'):
with open('/proc/cpuinfo', 'r') as fp: with open('/proc/cpuinfo', 'r') as fp:
for line in fp: for line in fp:
if re.match('^processor[ \t]*:[ \t]*[0-9]*', line): if re.match(r'^processor[ \t]*:[ \t]*[0-9]*', line):
self.cpucount += 1 self.cpucount += 1
if os.path.exists('/proc/meminfo'): if os.path.exists('/proc/meminfo'):
with open('/proc/meminfo', 'r') as fp: with open('/proc/meminfo', 'r') as fp:
for line in fp: for line in fp:
m = re.match('^MemTotal:[ \t]*(?P<sz>[0-9]*) *kB', line) m = re.match(r'^MemTotal:[ \t]*(?P<sz>[0-9]*) *kB', line)
if m: if m:
self.memtotal = int(m.group('sz')) self.memtotal = int(m.group('sz'))
m = re.match('^MemFree:[ \t]*(?P<sz>[0-9]*) *kB', line) m = re.match(r'^MemFree:[ \t]*(?P<sz>[0-9]*) *kB', line)
if m: if m:
self.memfree = int(m.group('sz')) self.memfree = int(m.group('sz'))
if os.path.exists('/etc/os-release'): if os.path.exists('/etc/os-release'):
...@@ -539,7 +539,7 @@ class SystemValues: ...@@ -539,7 +539,7 @@ class SystemValues:
idx = line.find('[') idx = line.find('[')
if idx > 1: if idx > 1:
line = line[idx:] line = line[idx:]
m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line) m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
if(m): if(m):
ktime = m.group('ktime') ktime = m.group('ktime')
break break
...@@ -553,7 +553,7 @@ class SystemValues: ...@@ -553,7 +553,7 @@ class SystemValues:
idx = line.find('[') idx = line.find('[')
if idx > 1: if idx > 1:
line = line[idx:] line = line[idx:]
m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line) m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
if(not m): if(not m):
continue continue
ktime = float(m.group('ktime')) ktime = float(m.group('ktime'))
...@@ -636,11 +636,11 @@ class SystemValues: ...@@ -636,11 +636,11 @@ class SystemValues:
# now process the args # now process the args
for arg in sorted(args): for arg in sorted(args):
arglist[arg] = '' arglist[arg] = ''
m = re.match('.* '+arg+'=(?P<arg>.*) ', data); m = re.match(r'.* '+arg+'=(?P<arg>.*) ', data);
if m: if m:
arglist[arg] = m.group('arg') arglist[arg] = m.group('arg')
else: else:
m = re.match('.* '+arg+'=(?P<arg>.*)', data); m = re.match(r'.* '+arg+'=(?P<arg>.*)', data);
if m: if m:
arglist[arg] = m.group('arg') arglist[arg] = m.group('arg')
out = fmt.format(**arglist) out = fmt.format(**arglist)
...@@ -989,7 +989,7 @@ class SystemValues: ...@@ -989,7 +989,7 @@ class SystemValues:
m = re.match(tp.ftrace_line_fmt, line) m = re.match(tp.ftrace_line_fmt, line)
if(not m or 'device_pm_callback_start' not in line): if(not m or 'device_pm_callback_start' not in line):
continue continue
m = re.match('.*: (?P<drv>.*) (?P<d>.*), parent: *(?P<p>.*), .*', m.group('msg')); m = re.match(r'.*: (?P<drv>.*) (?P<d>.*), parent: *(?P<p>.*), .*', m.group('msg'));
if(not m): if(not m):
continue continue
dev = m.group('d') dev = m.group('d')
...@@ -999,7 +999,7 @@ class SystemValues: ...@@ -999,7 +999,7 @@ class SystemValues:
# now get the syspath for each target device # now get the syspath for each target device
for dirname, dirnames, filenames in os.walk('/sys/devices'): for dirname, dirnames, filenames in os.walk('/sys/devices'):
if(re.match('.*/power', dirname) and 'async' in filenames): if(re.match(r'.*/power', dirname) and 'async' in filenames):
dev = dirname.split('/')[-2] dev = dirname.split('/')[-2]
if dev in props and (not props[dev].syspath or len(dirname) < len(props[dev].syspath)): if dev in props and (not props[dev].syspath or len(dirname) < len(props[dev].syspath)):
props[dev].syspath = dirname[:-6] props[dev].syspath = dirname[:-6]
...@@ -1143,12 +1143,12 @@ class SystemValues: ...@@ -1143,12 +1143,12 @@ class SystemValues:
elif value and os.path.exists(file): elif value and os.path.exists(file):
fp = open(file, 'r+') fp = open(file, 'r+')
if fmt == 'radio': if fmt == 'radio':
m = re.match('.*\[(?P<v>.*)\].*', fp.read()) m = re.match(r'.*\[(?P<v>.*)\].*', fp.read())
if m: if m:
self.cfgdef[file] = m.group('v') self.cfgdef[file] = m.group('v')
elif fmt == 'acpi': elif fmt == 'acpi':
line = fp.read().strip().split('\n')[-1] line = fp.read().strip().split('\n')[-1]
m = re.match('.* (?P<v>[0-9A-Fx]*) .*', line) m = re.match(r'.* (?P<v>[0-9A-Fx]*) .*', line)
if m: if m:
self.cfgdef[file] = m.group('v') self.cfgdef[file] = m.group('v')
else: else:
...@@ -1173,7 +1173,7 @@ class SystemValues: ...@@ -1173,7 +1173,7 @@ class SystemValues:
fp = Popen([cmd, '-v'], stdout=PIPE, stderr=PIPE).stderr fp = Popen([cmd, '-v'], stdout=PIPE, stderr=PIPE).stderr
out = ascii(fp.read()).strip() out = ascii(fp.read()).strip()
fp.close() fp.close()
if re.match('turbostat version .*', out): if re.match(r'turbostat version .*', out):
self.vprint(out) self.vprint(out)
return True return True
return False return False
...@@ -1187,7 +1187,7 @@ class SystemValues: ...@@ -1187,7 +1187,7 @@ class SystemValues:
rawout += line rawout += line
if keyline and valline: if keyline and valline:
continue continue
if re.match('(?i)Avg_MHz.*', line): if re.match(r'(?i)Avg_MHz.*', line):
keyline = line.strip().split() keyline = line.strip().split()
elif keyline: elif keyline:
valline = line.strip().split() valline = line.strip().split()
...@@ -1204,7 +1204,7 @@ class SystemValues: ...@@ -1204,7 +1204,7 @@ class SystemValues:
for key in keyline: for key in keyline:
idx = keyline.index(key) idx = keyline.index(key)
val = valline[idx] val = valline[idx]
if key == 'SYS%LPI' and not s0ixready and re.match('^[0\.]*$', val): if key == 'SYS%LPI' and not s0ixready and re.match(r'^[0\.]*$', val):
continue continue
out.append('%s=%s' % (key, val)) out.append('%s=%s' % (key, val))
return (fp.returncode, '|'.join(out)) return (fp.returncode, '|'.join(out))
...@@ -1232,7 +1232,7 @@ class SystemValues: ...@@ -1232,7 +1232,7 @@ class SystemValues:
except: except:
return '' return ''
for line in reversed(w.split('\n')): for line in reversed(w.split('\n')):
m = re.match(' *(?P<dev>.*): (?P<stat>[0-9a-f]*) .*', line) m = re.match(r' *(?P<dev>.*): (?P<stat>[0-9a-f]*) .*', line)
if not m or (dev and dev != m.group('dev')): if not m or (dev and dev != m.group('dev')):
continue continue
return m.group('dev') return m.group('dev')
...@@ -1261,14 +1261,14 @@ class SystemValues: ...@@ -1261,14 +1261,14 @@ class SystemValues:
return return
arr = msg.split() arr = msg.split()
for j in range(len(arr)): for j in range(len(arr)):
if re.match('^[0-9,\-\.]*$', arr[j]): if re.match(r'^[0-9,\-\.]*$', arr[j]):
arr[j] = '[0-9,\-\.]*' arr[j] = r'[0-9,\-\.]*'
else: else:
arr[j] = arr[j]\ arr[j] = arr[j]\
.replace('\\', '\\\\').replace(']', '\]').replace('[', '\[')\ .replace('\\', r'\\\\').replace(']', r'\]').replace('[', r'\[')\
.replace('.', '\.').replace('+', '\+').replace('*', '\*')\ .replace('.', r'\.').replace('+', r'\+').replace('*', r'\*')\
.replace('(', '\(').replace(')', '\)').replace('}', '\}')\ .replace('(', r'\(').replace(')', r'\)').replace('}', r'\}')\
.replace('{', '\{') .replace('{', r'\{')
mstr = ' *'.join(arr) mstr = ' *'.join(arr)
entry = { entry = {
'line': msg, 'line': msg,
...@@ -1340,7 +1340,7 @@ class SystemValues: ...@@ -1340,7 +1340,7 @@ class SystemValues:
fp = Popen(xset.format('q').split(' '), stdout=PIPE).stdout fp = Popen(xset.format('q').split(' '), stdout=PIPE).stdout
ret = 'unknown' ret = 'unknown'
for line in fp: for line in fp:
m = re.match('[\s]*Monitor is (?P<m>.*)', ascii(line)) m = re.match(r'[\s]*Monitor is (?P<m>.*)', ascii(line))
if(m and len(m.group('m')) >= 2): if(m and len(m.group('m')) >= 2):
out = m.group('m').lower() out = m.group('m').lower()
ret = out[3:] if out[0:2] == 'in' else out ret = out[3:] if out[0:2] == 'in' else out
...@@ -1566,7 +1566,7 @@ class Data: ...@@ -1566,7 +1566,7 @@ class Data:
i += 1 i += 1
if tp.stampInfo(line, sysvals): if tp.stampInfo(line, sysvals):
continue continue
m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line) m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
if not m: if not m:
continue continue
t = float(m.group('ktime')) t = float(m.group('ktime'))
...@@ -1574,7 +1574,7 @@ class Data: ...@@ -1574,7 +1574,7 @@ class Data:
continue continue
dir = 'suspend' if t < self.tSuspended else 'resume' dir = 'suspend' if t < self.tSuspended else 'resume'
msg = m.group('msg') msg = m.group('msg')
if re.match('capability: warning: .*', msg): if re.match(r'capability: warning: .*', msg):
continue continue
for err in self.errlist: for err in self.errlist:
if re.match(self.errlist[err], msg): if re.match(self.errlist[err], msg):
...@@ -1679,8 +1679,8 @@ class Data: ...@@ -1679,8 +1679,8 @@ class Data:
ubiquitous = False ubiquitous = False
if kprobename in dtf and 'ub' in dtf[kprobename]: if kprobename in dtf and 'ub' in dtf[kprobename]:
ubiquitous = True ubiquitous = True
mc = re.match('\(.*\) *(?P<args>.*)', cdata) mc = re.match(r'\(.*\) *(?P<args>.*)', cdata)
mr = re.match('\((?P<caller>\S*).* arg1=(?P<ret>.*)', rdata) mr = re.match(r'\((?P<caller>\S*).* arg1=(?P<ret>.*)', rdata)
if mc and mr: if mc and mr:
c = mr.group('caller').split('+')[0] c = mr.group('caller').split('+')[0]
a = mc.group('args').strip() a = mc.group('args').strip()
...@@ -1997,7 +1997,7 @@ class Data: ...@@ -1997,7 +1997,7 @@ class Data:
list = self.dmesg[phase]['list'] list = self.dmesg[phase]['list']
mydev = '' mydev = ''
for devname in sorted(list): for devname in sorted(list):
if name == devname or re.match('^%s\[(?P<num>[0-9]*)\]$' % name, devname): if name == devname or re.match(r'^%s\[(?P<num>[0-9]*)\]$' % name, devname):
mydev = devname mydev = devname
if mydev: if mydev:
return list[mydev] return list[mydev]
...@@ -2099,7 +2099,7 @@ class Data: ...@@ -2099,7 +2099,7 @@ class Data:
for dev in sorted(list): for dev in sorted(list):
pdev = list[dev]['par'] pdev = list[dev]['par']
pid = list[dev]['pid'] pid = list[dev]['pid']
if(pid < 0 or re.match('[0-9]*-[0-9]*\.[0-9]*[\.0-9]*\:[\.0-9]*$', pdev)): if(pid < 0 or re.match(r'[0-9]*-[0-9]*\.[0-9]*[\.0-9]*\:[\.0-9]*$', pdev)):
continue continue
if pdev and pdev not in real and pdev not in rootlist: if pdev and pdev not in real and pdev not in rootlist:
rootlist.append(pdev) rootlist.append(pdev)
...@@ -2190,26 +2190,26 @@ class Data: ...@@ -2190,26 +2190,26 @@ class Data:
if 'resume_complete' in dm: if 'resume_complete' in dm:
dm['resume_complete']['end'] = time dm['resume_complete']['end'] = time
def initcall_debug_call(self, line, quick=False): def initcall_debug_call(self, line, quick=False):
m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\ m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
'PM: *calling .* @ (?P<n>.*), parent: (?P<p>.*)', line) r'PM: *calling .* @ (?P<n>.*), parent: (?P<p>.*)', line)
if not m: if not m:
m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\ m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
'calling .* @ (?P<n>.*), parent: (?P<p>.*)', line) r'calling .* @ (?P<n>.*), parent: (?P<p>.*)', line)
if not m: if not m:
m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) calling '+\ m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) calling '+\
'(?P<f>.*)\+ @ (?P<n>.*), parent: (?P<p>.*)', line) r'(?P<f>.*)\+ @ (?P<n>.*), parent: (?P<p>.*)', line)
if m: if m:
return True if quick else m.group('t', 'f', 'n', 'p') return True if quick else m.group('t', 'f', 'n', 'p')
return False if quick else ('', '', '', '') return False if quick else ('', '', '', '')
def initcall_debug_return(self, line, quick=False): def initcall_debug_return(self, line, quick=False):
m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: PM: '+\ m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: PM: '+\
'.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line) r'.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line)
if not m: if not m:
m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\ m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
'.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line) r'.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line)
if not m: if not m:
m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) call '+\ m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) call '+\
'(?P<f>.*)\+ returned .* after (?P<dt>.*) usecs', line) r'(?P<f>.*)\+ returned .* after (?P<dt>.*) usecs', line)
if m: if m:
return True if quick else m.group('t', 'f', 'dt') return True if quick else m.group('t', 'f', 'dt')
return False if quick else ('', '', '') return False if quick else ('', '', '')
...@@ -2294,28 +2294,28 @@ class FTraceLine: ...@@ -2294,28 +2294,28 @@ class FTraceLine:
if not m and not d: if not m and not d:
return return
# is this a trace event # is this a trace event
if(d == 'traceevent' or re.match('^ *\/\* *(?P<msg>.*) \*\/ *$', m)): if(d == 'traceevent' or re.match(r'^ *\/\* *(?P<msg>.*) \*\/ *$', m)):
if(d == 'traceevent'): if(d == 'traceevent'):
# nop format trace event # nop format trace event
msg = m msg = m
else: else:
# function_graph format trace event # function_graph format trace event
em = re.match('^ *\/\* *(?P<msg>.*) \*\/ *$', m) em = re.match(r'^ *\/\* *(?P<msg>.*) \*\/ *$', m)
msg = em.group('msg') msg = em.group('msg')
emm = re.match('^(?P<call>.*?): (?P<msg>.*)', msg) emm = re.match(r'^(?P<call>.*?): (?P<msg>.*)', msg)
if(emm): if(emm):
self.name = emm.group('msg') self.name = emm.group('msg')
self.type = emm.group('call') self.type = emm.group('call')
else: else:
self.name = msg self.name = msg
km = re.match('^(?P<n>.*)_cal$', self.type) km = re.match(r'^(?P<n>.*)_cal$', self.type)
if km: if km:
self.fcall = True self.fcall = True
self.fkprobe = True self.fkprobe = True
self.type = km.group('n') self.type = km.group('n')
return return
km = re.match('^(?P<n>.*)_ret$', self.type) km = re.match(r'^(?P<n>.*)_ret$', self.type)
if km: if km:
self.freturn = True self.freturn = True
self.fkprobe = True self.fkprobe = True
...@@ -2327,7 +2327,7 @@ class FTraceLine: ...@@ -2327,7 +2327,7 @@ class FTraceLine:
if(d): if(d):
self.length = float(d)/1000000 self.length = float(d)/1000000
# the indentation determines the depth # the indentation determines the depth
match = re.match('^(?P<d> *)(?P<o>.*)$', m) match = re.match(r'^(?P<d> *)(?P<o>.*)$', m)
if(not match): if(not match):
return return
self.depth = self.getDepth(match.group('d')) self.depth = self.getDepth(match.group('d'))
...@@ -2337,7 +2337,7 @@ class FTraceLine: ...@@ -2337,7 +2337,7 @@ class FTraceLine:
self.freturn = True self.freturn = True
if(len(m) > 1): if(len(m) > 1):
# includes comment with function name # includes comment with function name
match = re.match('^} *\/\* *(?P<n>.*) *\*\/$', m) match = re.match(r'^} *\/\* *(?P<n>.*) *\*\/$', m)
if(match): if(match):
self.name = match.group('n').strip() self.name = match.group('n').strip()
# function call # function call
...@@ -2345,13 +2345,13 @@ class FTraceLine: ...@@ -2345,13 +2345,13 @@ class FTraceLine:
self.fcall = True self.fcall = True
# function call with children # function call with children
if(m[-1] == '{'): if(m[-1] == '{'):
match = re.match('^(?P<n>.*) *\(.*', m) match = re.match(r'^(?P<n>.*) *\(.*', m)
if(match): if(match):
self.name = match.group('n').strip() self.name = match.group('n').strip()
# function call with no children (leaf) # function call with no children (leaf)
elif(m[-1] == ';'): elif(m[-1] == ';'):
self.freturn = True self.freturn = True
match = re.match('^(?P<n>.*) *\(.*', m) match = re.match(r'^(?P<n>.*) *\(.*', m)
if(match): if(match):
self.name = match.group('n').strip() self.name = match.group('n').strip()
# something else (possibly a trace marker) # something else (possibly a trace marker)
...@@ -2385,7 +2385,7 @@ class FTraceLine: ...@@ -2385,7 +2385,7 @@ class FTraceLine:
return False return False
else: else:
if(self.type == 'suspend_resume' and if(self.type == 'suspend_resume' and
re.match('suspend_enter\[.*\] begin', self.name)): re.match(r'suspend_enter\[.*\] begin', self.name)):
return True return True
return False return False
def endMarker(self): def endMarker(self):
...@@ -2398,7 +2398,7 @@ class FTraceLine: ...@@ -2398,7 +2398,7 @@ class FTraceLine:
return False return False
else: else:
if(self.type == 'suspend_resume' and if(self.type == 'suspend_resume' and
re.match('thaw_processes\[.*\] end', self.name)): re.match(r'thaw_processes\[.*\] end', self.name)):
return True return True
return False return False
...@@ -2976,30 +2976,30 @@ class Timeline: ...@@ -2976,30 +2976,30 @@ class Timeline:
# Description: # Description:
# A list of values describing the properties of these test runs # A list of values describing the properties of these test runs
class TestProps: class TestProps:
stampfmt = '# [a-z]*-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\ stampfmt = r'# [a-z]*-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\
'(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\ r'(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\
' (?P<host>.*) (?P<mode>.*) (?P<kernel>.*)$' r' (?P<host>.*) (?P<mode>.*) (?P<kernel>.*)$'
wififmt = '^# wifi *(?P<d>\S*) *(?P<s>\S*) *(?P<t>[0-9\.]+).*' wififmt = r'^# wifi *(?P<d>\S*) *(?P<s>\S*) *(?P<t>[0-9\.]+).*'
tstatfmt = '^# turbostat (?P<t>\S*)' tstatfmt = r'^# turbostat (?P<t>\S*)'
testerrfmt = '^# enter_sleep_error (?P<e>.*)' testerrfmt = r'^# enter_sleep_error (?P<e>.*)'
sysinfofmt = '^# sysinfo .*' sysinfofmt = r'^# sysinfo .*'
cmdlinefmt = '^# command \| (?P<cmd>.*)' cmdlinefmt = r'^# command \| (?P<cmd>.*)'
kparamsfmt = '^# kparams \| (?P<kp>.*)' kparamsfmt = r'^# kparams \| (?P<kp>.*)'
devpropfmt = '# Device Properties: .*' devpropfmt = r'# Device Properties: .*'
pinfofmt = '# platform-(?P<val>[a-z,A-Z,0-9,_]*): (?P<info>.*)' pinfofmt = r'# platform-(?P<val>[a-z,A-Z,0-9,_]*): (?P<info>.*)'
tracertypefmt = '# tracer: (?P<t>.*)' tracertypefmt = r'# tracer: (?P<t>.*)'
firmwarefmt = '# fwsuspend (?P<s>[0-9]*) fwresume (?P<r>[0-9]*)$' firmwarefmt = r'# fwsuspend (?P<s>[0-9]*) fwresume (?P<r>[0-9]*)$'
procexecfmt = 'ps - (?P<ps>.*)$' procexecfmt = r'ps - (?P<ps>.*)$'
procmultifmt = '@(?P<n>[0-9]*)\|(?P<ps>.*)$' procmultifmt = r'@(?P<n>[0-9]*)\|(?P<ps>.*)$'
ftrace_line_fmt_fg = \ ftrace_line_fmt_fg = \
'^ *(?P<time>[0-9\.]*) *\| *(?P<cpu>[0-9]*)\)'+\ r'^ *(?P<time>[0-9\.]*) *\| *(?P<cpu>[0-9]*)\)'+\
' *(?P<proc>.*)-(?P<pid>[0-9]*) *\|'+\ r' *(?P<proc>.*)-(?P<pid>[0-9]*) *\|'+\
'[ +!#\*@$]*(?P<dur>[0-9\.]*) .*\| (?P<msg>.*)' r'[ +!#\*@$]*(?P<dur>[0-9\.]*) .*\| (?P<msg>.*)'
ftrace_line_fmt_nop = \ ftrace_line_fmt_nop = \
' *(?P<proc>.*)-(?P<pid>[0-9]*) *\[(?P<cpu>[0-9]*)\] *'+\ r' *(?P<proc>.*)-(?P<pid>[0-9]*) *\[(?P<cpu>[0-9]*)\] *'+\
'(?P<flags>\S*) *(?P<time>[0-9\.]*): *'+\ r'(?P<flags>\S*) *(?P<time>[0-9\.]*): *'+\
'(?P<msg>.*)' r'(?P<msg>.*)'
machinesuspend = 'machine_suspend\[.*' machinesuspend = r'machine_suspend\[.*'
multiproclist = dict() multiproclist = dict()
multiproctime = 0.0 multiproctime = 0.0
multiproccnt = 0 multiproccnt = 0
...@@ -3081,14 +3081,14 @@ class TestProps: ...@@ -3081,14 +3081,14 @@ class TestProps:
sv.hostname = data.stamp['host'] sv.hostname = data.stamp['host']
sv.suspendmode = data.stamp['mode'] sv.suspendmode = data.stamp['mode']
if sv.suspendmode == 'freeze': if sv.suspendmode == 'freeze':
self.machinesuspend = 'timekeeping_freeze\[.*' self.machinesuspend = r'timekeeping_freeze\[.*'
else: else:
self.machinesuspend = 'machine_suspend\[.*' self.machinesuspend = r'machine_suspend\[.*'
if sv.suspendmode == 'command' and sv.ftracefile != '': if sv.suspendmode == 'command' and sv.ftracefile != '':
modes = ['on', 'freeze', 'standby', 'mem', 'disk'] modes = ['on', 'freeze', 'standby', 'mem', 'disk']
fp = sv.openlog(sv.ftracefile, 'r') fp = sv.openlog(sv.ftracefile, 'r')
for line in fp: for line in fp:
m = re.match('.* machine_suspend\[(?P<mode>.*)\]', line) m = re.match(r'.* machine_suspend\[(?P<mode>.*)\]', line)
if m and m.group('mode') in ['1', '2', '3', '4']: if m and m.group('mode') in ['1', '2', '3', '4']:
sv.suspendmode = modes[int(m.group('mode'))] sv.suspendmode = modes[int(m.group('mode'))]
data.stamp['mode'] = sv.suspendmode data.stamp['mode'] = sv.suspendmode
...@@ -3401,9 +3401,9 @@ def loadTraceLog(): ...@@ -3401,9 +3401,9 @@ def loadTraceLog():
for i in range(len(blk)): for i in range(len(blk)):
if 'SUSPEND START' in blk[i][3]: if 'SUSPEND START' in blk[i][3]:
first.append(i) first.append(i)
elif re.match('.* timekeeping_freeze.*begin', blk[i][3]): elif re.match(r'.* timekeeping_freeze.*begin', blk[i][3]):
last.append(i) last.append(i)
elif re.match('.* timekeeping_freeze.*end', blk[i][3]): elif re.match(r'.* timekeeping_freeze.*end', blk[i][3]):
first.append(i) first.append(i)
elif 'RESUME COMPLETE' in blk[i][3]: elif 'RESUME COMPLETE' in blk[i][3]:
last.append(i) last.append(i)
...@@ -3514,28 +3514,28 @@ def parseTraceLog(live=False): ...@@ -3514,28 +3514,28 @@ def parseTraceLog(live=False):
if(t.fevent): if(t.fevent):
if(t.type == 'suspend_resume'): if(t.type == 'suspend_resume'):
# suspend_resume trace events have two types, begin and end # suspend_resume trace events have two types, begin and end
if(re.match('(?P<name>.*) begin$', t.name)): if(re.match(r'(?P<name>.*) begin$', t.name)):
isbegin = True isbegin = True
elif(re.match('(?P<name>.*) end$', t.name)): elif(re.match(r'(?P<name>.*) end$', t.name)):
isbegin = False isbegin = False
else: else:
continue continue
if '[' in t.name: if '[' in t.name:
m = re.match('(?P<name>.*)\[.*', t.name) m = re.match(r'(?P<name>.*)\[.*', t.name)
else: else:
m = re.match('(?P<name>.*) .*', t.name) m = re.match(r'(?P<name>.*) .*', t.name)
name = m.group('name') name = m.group('name')
# ignore these events # ignore these events
if(name.split('[')[0] in tracewatch): if(name.split('[')[0] in tracewatch):
continue continue
# -- phase changes -- # -- phase changes --
# start of kernel suspend # start of kernel suspend
if(re.match('suspend_enter\[.*', t.name)): if(re.match(r'suspend_enter\[.*', t.name)):
if(isbegin and data.tKernSus == 0): if(isbegin and data.tKernSus == 0):
data.tKernSus = t.time data.tKernSus = t.time
continue continue
# suspend_prepare start # suspend_prepare start
elif(re.match('dpm_prepare\[.*', t.name)): elif(re.match(r'dpm_prepare\[.*', t.name)):
if isbegin and data.first_suspend_prepare: if isbegin and data.first_suspend_prepare:
data.first_suspend_prepare = False data.first_suspend_prepare = False
if data.tKernSus == 0: if data.tKernSus == 0:
...@@ -3544,15 +3544,15 @@ def parseTraceLog(live=False): ...@@ -3544,15 +3544,15 @@ def parseTraceLog(live=False):
phase = data.setPhase('suspend_prepare', t.time, isbegin) phase = data.setPhase('suspend_prepare', t.time, isbegin)
continue continue
# suspend start # suspend start
elif(re.match('dpm_suspend\[.*', t.name)): elif(re.match(r'dpm_suspend\[.*', t.name)):
phase = data.setPhase('suspend', t.time, isbegin) phase = data.setPhase('suspend', t.time, isbegin)
continue continue
# suspend_late start # suspend_late start
elif(re.match('dpm_suspend_late\[.*', t.name)): elif(re.match(r'dpm_suspend_late\[.*', t.name)):
phase = data.setPhase('suspend_late', t.time, isbegin) phase = data.setPhase('suspend_late', t.time, isbegin)
continue continue
# suspend_noirq start # suspend_noirq start
elif(re.match('dpm_suspend_noirq\[.*', t.name)): elif(re.match(r'dpm_suspend_noirq\[.*', t.name)):
phase = data.setPhase('suspend_noirq', t.time, isbegin) phase = data.setPhase('suspend_noirq', t.time, isbegin)
continue continue
# suspend_machine/resume_machine # suspend_machine/resume_machine
...@@ -3589,19 +3589,19 @@ def parseTraceLog(live=False): ...@@ -3589,19 +3589,19 @@ def parseTraceLog(live=False):
data.tResumed = t.time data.tResumed = t.time
continue continue
# resume_noirq start # resume_noirq start
elif(re.match('dpm_resume_noirq\[.*', t.name)): elif(re.match(r'dpm_resume_noirq\[.*', t.name)):
phase = data.setPhase('resume_noirq', t.time, isbegin) phase = data.setPhase('resume_noirq', t.time, isbegin)
continue continue
# resume_early start # resume_early start
elif(re.match('dpm_resume_early\[.*', t.name)): elif(re.match(r'dpm_resume_early\[.*', t.name)):
phase = data.setPhase('resume_early', t.time, isbegin) phase = data.setPhase('resume_early', t.time, isbegin)
continue continue
# resume start # resume start
elif(re.match('dpm_resume\[.*', t.name)): elif(re.match(r'dpm_resume\[.*', t.name)):
phase = data.setPhase('resume', t.time, isbegin) phase = data.setPhase('resume', t.time, isbegin)
continue continue
# resume complete start # resume complete start
elif(re.match('dpm_complete\[.*', t.name)): elif(re.match(r'dpm_complete\[.*', t.name)):
phase = data.setPhase('resume_complete', t.time, isbegin) phase = data.setPhase('resume_complete', t.time, isbegin)
continue continue
# skip trace events inside devices calls # skip trace events inside devices calls
...@@ -3635,7 +3635,7 @@ def parseTraceLog(live=False): ...@@ -3635,7 +3635,7 @@ def parseTraceLog(live=False):
elif(t.type == 'device_pm_callback_start'): elif(t.type == 'device_pm_callback_start'):
if phase not in data.dmesg: if phase not in data.dmesg:
continue continue
m = re.match('(?P<drv>.*) (?P<d>.*), parent: *(?P<p>.*), .*',\ m = re.match(r'(?P<drv>.*) (?P<d>.*), parent: *(?P<p>.*), .*',\
t.name); t.name);
if(not m): if(not m):
continue continue
...@@ -3650,7 +3650,7 @@ def parseTraceLog(live=False): ...@@ -3650,7 +3650,7 @@ def parseTraceLog(live=False):
elif(t.type == 'device_pm_callback_end'): elif(t.type == 'device_pm_callback_end'):
if phase not in data.dmesg: if phase not in data.dmesg:
continue continue
m = re.match('(?P<drv>.*) (?P<d>.*), err.*', t.name); m = re.match(r'(?P<drv>.*) (?P<d>.*), err.*', t.name);
if(not m): if(not m):
continue continue
n = m.group('d') n = m.group('d')
...@@ -3904,24 +3904,24 @@ def loadKernelLog(): ...@@ -3904,24 +3904,24 @@ def loadKernelLog():
line = line[idx:] line = line[idx:]
if tp.stampInfo(line, sysvals): if tp.stampInfo(line, sysvals):
continue continue
m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line) m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
if(not m): if(not m):
continue continue
msg = m.group("msg") msg = m.group("msg")
if re.match('PM: Syncing filesystems.*', msg) or \ if re.match(r'PM: Syncing filesystems.*', msg) or \
re.match('PM: suspend entry.*', msg): re.match(r'PM: suspend entry.*', msg):
if(data): if(data):
testruns.append(data) testruns.append(data)
data = Data(len(testruns)) data = Data(len(testruns))
tp.parseStamp(data, sysvals) tp.parseStamp(data, sysvals)
if(not data): if(not data):
continue continue
m = re.match('.* *(?P<k>[0-9]\.[0-9]{2}\.[0-9]-.*) .*', msg) m = re.match(r'.* *(?P<k>[0-9]\.[0-9]{2}\.[0-9]-.*) .*', msg)
if(m): if(m):
sysvals.stamp['kernel'] = m.group('k') sysvals.stamp['kernel'] = m.group('k')
m = re.match('PM: Preparing system for (?P<m>.*) sleep', msg) m = re.match(r'PM: Preparing system for (?P<m>.*) sleep', msg)
if not m: if not m:
m = re.match('PM: Preparing system for sleep \((?P<m>.*)\)', msg) m = re.match(r'PM: Preparing system for sleep \((?P<m>.*)\)', msg)
if m: if m:
sysvals.stamp['mode'] = sysvals.suspendmode = m.group('m') sysvals.stamp['mode'] = sysvals.suspendmode = m.group('m')
data.dmesgtext.append(line) data.dmesgtext.append(line)
...@@ -3984,7 +3984,7 @@ def parseKernelLog(data): ...@@ -3984,7 +3984,7 @@ def parseKernelLog(data):
'resume_machine': ['[PM: ]*Timekeeping suspended for.*', 'resume_machine': ['[PM: ]*Timekeeping suspended for.*',
'ACPI: Low-level resume complete.*', 'ACPI: Low-level resume complete.*',
'ACPI: resume from mwait', 'ACPI: resume from mwait',
'Suspended for [0-9\.]* seconds'], r'Suspended for [0-9\.]* seconds'],
'resume_noirq': ['PM: resume from suspend-to-idle', 'resume_noirq': ['PM: resume from suspend-to-idle',
'ACPI: Waking up from system sleep state.*'], 'ACPI: Waking up from system sleep state.*'],
'resume_early': ['PM: noirq resume of devices complete after.*', 'resume_early': ['PM: noirq resume of devices complete after.*',
...@@ -3993,7 +3993,7 @@ def parseKernelLog(data): ...@@ -3993,7 +3993,7 @@ def parseKernelLog(data):
'PM: early restore of devices complete after.*'], 'PM: early restore of devices complete after.*'],
'resume_complete': ['PM: resume of devices complete after.*', 'resume_complete': ['PM: resume of devices complete after.*',
'PM: restore of devices complete after.*'], 'PM: restore of devices complete after.*'],
'post_resume': ['.*Restarting tasks \.\.\..*'], 'post_resume': [r'.*Restarting tasks \.\.\..*'],
} }
# action table (expected events that occur and show up in dmesg) # action table (expected events that occur and show up in dmesg)
...@@ -4021,7 +4021,7 @@ def parseKernelLog(data): ...@@ -4021,7 +4021,7 @@ def parseKernelLog(data):
actions = dict() actions = dict()
for line in data.dmesgtext: for line in data.dmesgtext:
# parse each dmesg line into the time and message # parse each dmesg line into the time and message
m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line) m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
if(m): if(m):
val = m.group('ktime') val = m.group('ktime')
try: try:
...@@ -4145,26 +4145,26 @@ def parseKernelLog(data): ...@@ -4145,26 +4145,26 @@ def parseKernelLog(data):
if(a in actions and actions[a][-1]['begin'] == actions[a][-1]['end']): if(a in actions and actions[a][-1]['begin'] == actions[a][-1]['end']):
actions[a][-1]['end'] = ktime actions[a][-1]['end'] = ktime
# now look for CPU on/off events # now look for CPU on/off events
if(re.match('Disabling non-boot CPUs .*', msg)): if(re.match(r'Disabling non-boot CPUs .*', msg)):
# start of first cpu suspend # start of first cpu suspend
cpu_start = ktime cpu_start = ktime
elif(re.match('Enabling non-boot CPUs .*', msg)): elif(re.match(r'Enabling non-boot CPUs .*', msg)):
# start of first cpu resume # start of first cpu resume
cpu_start = ktime cpu_start = ktime
elif(re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg) \ elif(re.match(r'smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg) \
or re.match('psci: CPU(?P<cpu>[0-9]*) killed.*', msg)): or re.match(r'psci: CPU(?P<cpu>[0-9]*) killed.*', msg)):
# end of a cpu suspend, start of the next # end of a cpu suspend, start of the next
m = re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg) m = re.match(r'smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)
if(not m): if(not m):
m = re.match('psci: CPU(?P<cpu>[0-9]*) killed.*', msg) m = re.match(r'psci: CPU(?P<cpu>[0-9]*) killed.*', msg)
cpu = 'CPU'+m.group('cpu') cpu = 'CPU'+m.group('cpu')
if(cpu not in actions): if(cpu not in actions):
actions[cpu] = [] actions[cpu] = []
actions[cpu].append({'begin': cpu_start, 'end': ktime}) actions[cpu].append({'begin': cpu_start, 'end': ktime})
cpu_start = ktime cpu_start = ktime
elif(re.match('CPU(?P<cpu>[0-9]*) is up', msg)): elif(re.match(r'CPU(?P<cpu>[0-9]*) is up', msg)):
# end of a cpu resume, start of the next # end of a cpu resume, start of the next
m = re.match('CPU(?P<cpu>[0-9]*) is up', msg) m = re.match(r'CPU(?P<cpu>[0-9]*) is up', msg)
cpu = 'CPU'+m.group('cpu') cpu = 'CPU'+m.group('cpu')
if(cpu not in actions): if(cpu not in actions):
actions[cpu] = [] actions[cpu] = []
...@@ -5062,6 +5062,7 @@ def addCSS(hf, sv, testcount=1, kerror=False, extra=''): ...@@ -5062,6 +5062,7 @@ def addCSS(hf, sv, testcount=1, kerror=False, extra=''):
def addScriptCode(hf, testruns): def addScriptCode(hf, testruns):
t0 = testruns[0].start * 1000 t0 = testruns[0].start * 1000
tMax = testruns[-1].end * 1000 tMax = testruns[-1].end * 1000
hf.write('<script type="text/javascript">\n');
# create an array in javascript memory with the device details # create an array in javascript memory with the device details
detail = ' var devtable = [];\n' detail = ' var devtable = [];\n'
for data in testruns: for data in testruns:
...@@ -5069,384 +5070,383 @@ def addScriptCode(hf, testruns): ...@@ -5069,384 +5070,383 @@ def addScriptCode(hf, testruns):
detail += ' devtable[%d] = "%s";\n' % (data.testnumber, topo) detail += ' devtable[%d] = "%s";\n' % (data.testnumber, topo)
detail += ' var bounds = [%f,%f];\n' % (t0, tMax) detail += ' var bounds = [%f,%f];\n' % (t0, tMax)
# add the code which will manipulate the data in the browser # add the code which will manipulate the data in the browser
script_code = \ hf.write(detail);
'<script type="text/javascript">\n'+detail+\ script_code = r""" var resolution = -1;
' var resolution = -1;\n'\ var dragval = [0, 0];
' var dragval = [0, 0];\n'\ function redrawTimescale(t0, tMax, tS) {
' function redrawTimescale(t0, tMax, tS) {\n'\ var rline = '<div class="t" style="left:0;border-left:1px solid black;border-right:0;">';
' var rline = \'<div class="t" style="left:0;border-left:1px solid black;border-right:0;">\';\n'\ var tTotal = tMax - t0;
' var tTotal = tMax - t0;\n'\ var list = document.getElementsByClassName("tblock");
' var list = document.getElementsByClassName("tblock");\n'\ for (var i = 0; i < list.length; i++) {
' for (var i = 0; i < list.length; i++) {\n'\ var timescale = list[i].getElementsByClassName("timescale")[0];
' var timescale = list[i].getElementsByClassName("timescale")[0];\n'\ var m0 = t0 + (tTotal*parseFloat(list[i].style.left)/100);
' var m0 = t0 + (tTotal*parseFloat(list[i].style.left)/100);\n'\ var mTotal = tTotal*parseFloat(list[i].style.width)/100;
' var mTotal = tTotal*parseFloat(list[i].style.width)/100;\n'\ var mMax = m0 + mTotal;
' var mMax = m0 + mTotal;\n'\ var html = "";
' var html = "";\n'\ var divTotal = Math.floor(mTotal/tS) + 1;
' var divTotal = Math.floor(mTotal/tS) + 1;\n'\ if(divTotal > 1000) continue;
' if(divTotal > 1000) continue;\n'\ var divEdge = (mTotal - tS*(divTotal-1))*100/mTotal;
' var divEdge = (mTotal - tS*(divTotal-1))*100/mTotal;\n'\ var pos = 0.0, val = 0.0;
' var pos = 0.0, val = 0.0;\n'\ for (var j = 0; j < divTotal; j++) {
' for (var j = 0; j < divTotal; j++) {\n'\ var htmlline = "";
' var htmlline = "";\n'\ var mode = list[i].id[5];
' var mode = list[i].id[5];\n'\ if(mode == "s") {
' if(mode == "s") {\n'\ pos = 100 - (((j)*tS*100)/mTotal) - divEdge;
' pos = 100 - (((j)*tS*100)/mTotal) - divEdge;\n'\ val = (j-divTotal+1)*tS;
' val = (j-divTotal+1)*tS;\n'\ if(j == divTotal - 1)
' if(j == divTotal - 1)\n'\ htmlline = '<div class="t" style="right:'+pos+'%"><cS>S&rarr;</cS></div>';
' htmlline = \'<div class="t" style="right:\'+pos+\'%"><cS>S&rarr;</cS></div>\';\n'\ else
' else\n'\ htmlline = '<div class="t" style="right:'+pos+'%">'+val+'ms</div>';
' htmlline = \'<div class="t" style="right:\'+pos+\'%">\'+val+\'ms</div>\';\n'\ } else {
' } else {\n'\ pos = 100 - (((j)*tS*100)/mTotal);
' pos = 100 - (((j)*tS*100)/mTotal);\n'\ val = (j)*tS;
' val = (j)*tS;\n'\ htmlline = '<div class="t" style="right:'+pos+'%">'+val+'ms</div>';
' htmlline = \'<div class="t" style="right:\'+pos+\'%">\'+val+\'ms</div>\';\n'\ if(j == 0)
' if(j == 0)\n'\ if(mode == "r")
' if(mode == "r")\n'\ htmlline = rline+"<cS>&larr;R</cS></div>";
' htmlline = rline+"<cS>&larr;R</cS></div>";\n'\ else
' else\n'\ htmlline = rline+"<cS>0ms</div>";
' htmlline = rline+"<cS>0ms</div>";\n'\ }
' }\n'\ html += htmlline;
' html += htmlline;\n'\ }
' }\n'\ timescale.innerHTML = html;
' timescale.innerHTML = html;\n'\ }
' }\n'\ }
' }\n'\ function zoomTimeline() {
' function zoomTimeline() {\n'\ var dmesg = document.getElementById("dmesg");
' var dmesg = document.getElementById("dmesg");\n'\ var zoombox = document.getElementById("dmesgzoombox");
' var zoombox = document.getElementById("dmesgzoombox");\n'\ var left = zoombox.scrollLeft;
' var left = zoombox.scrollLeft;\n'\ var val = parseFloat(dmesg.style.width);
' var val = parseFloat(dmesg.style.width);\n'\ var newval = 100;
' var newval = 100;\n'\ var sh = window.outerWidth / 2;
' var sh = window.outerWidth / 2;\n'\ if(this.id == "zoomin") {
' if(this.id == "zoomin") {\n'\ newval = val * 1.2;
' newval = val * 1.2;\n'\ if(newval > 910034) newval = 910034;
' if(newval > 910034) newval = 910034;\n'\ dmesg.style.width = newval+"%";
' dmesg.style.width = newval+"%";\n'\ zoombox.scrollLeft = ((left + sh) * newval / val) - sh;
' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\ } else if (this.id == "zoomout") {
' } else if (this.id == "zoomout") {\n'\ newval = val / 1.2;
' newval = val / 1.2;\n'\ if(newval < 100) newval = 100;
' if(newval < 100) newval = 100;\n'\ dmesg.style.width = newval+"%";
' dmesg.style.width = newval+"%";\n'\ zoombox.scrollLeft = ((left + sh) * newval / val) - sh;
' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\ } else {
' } else {\n'\ zoombox.scrollLeft = 0;
' zoombox.scrollLeft = 0;\n'\ dmesg.style.width = "100%";
' dmesg.style.width = "100%";\n'\ }
' }\n'\ var tS = [10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1];
' var tS = [10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1];\n'\ var t0 = bounds[0];
' var t0 = bounds[0];\n'\ var tMax = bounds[1];
' var tMax = bounds[1];\n'\ var tTotal = tMax - t0;
' var tTotal = tMax - t0;\n'\ var wTotal = tTotal * 100.0 / newval;
' var wTotal = tTotal * 100.0 / newval;\n'\ var idx = 7*window.innerWidth/1100;
' var idx = 7*window.innerWidth/1100;\n'\ for(var i = 0; (i < tS.length)&&((wTotal / tS[i]) < idx); i++);
' for(var i = 0; (i < tS.length)&&((wTotal / tS[i]) < idx); i++);\n'\ if(i >= tS.length) i = tS.length - 1;
' if(i >= tS.length) i = tS.length - 1;\n'\ if(tS[i] == resolution) return;
' if(tS[i] == resolution) return;\n'\ resolution = tS[i];
' resolution = tS[i];\n'\ redrawTimescale(t0, tMax, tS[i]);
' redrawTimescale(t0, tMax, tS[i]);\n'\ }
' }\n'\ function deviceName(title) {
' function deviceName(title) {\n'\ var name = title.slice(0, title.indexOf(" ("));
' var name = title.slice(0, title.indexOf(" ("));\n'\ return name;
' return name;\n'\ }
' }\n'\ function deviceHover() {
' function deviceHover() {\n'\ var name = deviceName(this.title);
' var name = deviceName(this.title);\n'\ var dmesg = document.getElementById("dmesg");
' var dmesg = document.getElementById("dmesg");\n'\ var dev = dmesg.getElementsByClassName("thread");
' var dev = dmesg.getElementsByClassName("thread");\n'\ var cpu = -1;
' var cpu = -1;\n'\ if(name.match("CPU_ON\[[0-9]*\]"))
' if(name.match("CPU_ON\[[0-9]*\]"))\n'\ cpu = parseInt(name.slice(7));
' cpu = parseInt(name.slice(7));\n'\ else if(name.match("CPU_OFF\[[0-9]*\]"))
' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\ cpu = parseInt(name.slice(8));
' cpu = parseInt(name.slice(8));\n'\ for (var i = 0; i < dev.length; i++) {
' for (var i = 0; i < dev.length; i++) {\n'\ dname = deviceName(dev[i].title);
' dname = deviceName(dev[i].title);\n'\ var cname = dev[i].className.slice(dev[i].className.indexOf("thread"));
' var cname = dev[i].className.slice(dev[i].className.indexOf("thread"));\n'\ if((cpu >= 0 && dname.match("CPU_O[NF]*\\[*"+cpu+"\\]")) ||
' if((cpu >= 0 && dname.match("CPU_O[NF]*\\\[*"+cpu+"\\\]")) ||\n'\ (name == dname))
' (name == dname))\n'\ {
' {\n'\ dev[i].className = "hover "+cname;
' dev[i].className = "hover "+cname;\n'\ } else {
' } else {\n'\ dev[i].className = cname;
' dev[i].className = cname;\n'\ }
' }\n'\ }
' }\n'\ }
' }\n'\ function deviceUnhover() {
' function deviceUnhover() {\n'\ var dmesg = document.getElementById("dmesg");
' var dmesg = document.getElementById("dmesg");\n'\ var dev = dmesg.getElementsByClassName("thread");
' var dev = dmesg.getElementsByClassName("thread");\n'\ for (var i = 0; i < dev.length; i++) {
' for (var i = 0; i < dev.length; i++) {\n'\ dev[i].className = dev[i].className.slice(dev[i].className.indexOf("thread"));
' dev[i].className = dev[i].className.slice(dev[i].className.indexOf("thread"));\n'\ }
' }\n'\ }
' }\n'\ function deviceTitle(title, total, cpu) {
' function deviceTitle(title, total, cpu) {\n'\ var prefix = "Total";
' var prefix = "Total";\n'\ if(total.length > 3) {
' if(total.length > 3) {\n'\ prefix = "Average";
' prefix = "Average";\n'\ total[1] = (total[1]+total[3])/2;
' total[1] = (total[1]+total[3])/2;\n'\ total[2] = (total[2]+total[4])/2;
' total[2] = (total[2]+total[4])/2;\n'\ }
' }\n'\ var devtitle = document.getElementById("devicedetailtitle");
' var devtitle = document.getElementById("devicedetailtitle");\n'\ var name = deviceName(title);
' var name = deviceName(title);\n'\ if(cpu >= 0) name = "CPU"+cpu;
' if(cpu >= 0) name = "CPU"+cpu;\n'\ var driver = "";
' var driver = "";\n'\ var tS = "<t2>(</t2>";
' var tS = "<t2>(</t2>";\n'\ var tR = "<t2>)</t2>";
' var tR = "<t2>)</t2>";\n'\ if(total[1] > 0)
' if(total[1] > 0)\n'\ tS = "<t2>("+prefix+" Suspend:</t2><t0> "+total[1].toFixed(3)+" ms</t0> ";
' tS = "<t2>("+prefix+" Suspend:</t2><t0> "+total[1].toFixed(3)+" ms</t0> ";\n'\ if(total[2] > 0)
' if(total[2] > 0)\n'\ tR = " <t2>"+prefix+" Resume:</t2><t0> "+total[2].toFixed(3)+" ms<t2>)</t2></t0>";
' tR = " <t2>"+prefix+" Resume:</t2><t0> "+total[2].toFixed(3)+" ms<t2>)</t2></t0>";\n'\ var s = title.indexOf("{");
' var s = title.indexOf("{");\n'\ var e = title.indexOf("}");
' var e = title.indexOf("}");\n'\ if((s >= 0) && (e >= 0))
' if((s >= 0) && (e >= 0))\n'\ driver = title.slice(s+1, e) + " <t1>@</t1> ";
' driver = title.slice(s+1, e) + " <t1>@</t1> ";\n'\ if(total[1] > 0 && total[2] > 0)
' if(total[1] > 0 && total[2] > 0)\n'\ devtitle.innerHTML = "<t0>"+driver+name+"</t0> "+tS+tR;
' devtitle.innerHTML = "<t0>"+driver+name+"</t0> "+tS+tR;\n'\ else
' else\n'\ devtitle.innerHTML = "<t0>"+title+"</t0>";
' devtitle.innerHTML = "<t0>"+title+"</t0>";\n'\ return name;
' return name;\n'\ }
' }\n'\ function deviceDetail() {
' function deviceDetail() {\n'\ var devinfo = document.getElementById("devicedetail");
' var devinfo = document.getElementById("devicedetail");\n'\ devinfo.style.display = "block";
' devinfo.style.display = "block";\n'\ var name = deviceName(this.title);
' var name = deviceName(this.title);\n'\ var cpu = -1;
' var cpu = -1;\n'\ if(name.match("CPU_ON\[[0-9]*\]"))
' if(name.match("CPU_ON\[[0-9]*\]"))\n'\ cpu = parseInt(name.slice(7));
' cpu = parseInt(name.slice(7));\n'\ else if(name.match("CPU_OFF\[[0-9]*\]"))
' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\ cpu = parseInt(name.slice(8));
' cpu = parseInt(name.slice(8));\n'\ var dmesg = document.getElementById("dmesg");
' var dmesg = document.getElementById("dmesg");\n'\ var dev = dmesg.getElementsByClassName("thread");
' var dev = dmesg.getElementsByClassName("thread");\n'\ var idlist = [];
' var idlist = [];\n'\ var pdata = [[]];
' var pdata = [[]];\n'\ if(document.getElementById("devicedetail1"))
' if(document.getElementById("devicedetail1"))\n'\ pdata = [[], []];
' pdata = [[], []];\n'\ var pd = pdata[0];
' var pd = pdata[0];\n'\ var total = [0.0, 0.0, 0.0];
' var total = [0.0, 0.0, 0.0];\n'\ for (var i = 0; i < dev.length; i++) {
' for (var i = 0; i < dev.length; i++) {\n'\ dname = deviceName(dev[i].title);
' dname = deviceName(dev[i].title);\n'\ if((cpu >= 0 && dname.match("CPU_O[NF]*\\[*"+cpu+"\\]")) ||
' if((cpu >= 0 && dname.match("CPU_O[NF]*\\\[*"+cpu+"\\\]")) ||\n'\ (name == dname))
' (name == dname))\n'\ {
' {\n'\ idlist[idlist.length] = dev[i].id;
' idlist[idlist.length] = dev[i].id;\n'\ var tidx = 1;
' var tidx = 1;\n'\ if(dev[i].id[0] == "a") {
' if(dev[i].id[0] == "a") {\n'\ pd = pdata[0];
' pd = pdata[0];\n'\ } else {
' } else {\n'\ if(pdata.length == 1) pdata[1] = [];
' if(pdata.length == 1) pdata[1] = [];\n'\ if(total.length == 3) total[3]=total[4]=0.0;
' if(total.length == 3) total[3]=total[4]=0.0;\n'\ pd = pdata[1];
' pd = pdata[1];\n'\ tidx = 3;
' tidx = 3;\n'\ }
' }\n'\ var info = dev[i].title.split(" ");
' var info = dev[i].title.split(" ");\n'\ var pname = info[info.length-1];
' var pname = info[info.length-1];\n'\ pd[pname] = parseFloat(info[info.length-3].slice(1));
' pd[pname] = parseFloat(info[info.length-3].slice(1));\n'\ total[0] += pd[pname];
' total[0] += pd[pname];\n'\ if(pname.indexOf("suspend") >= 0)
' if(pname.indexOf("suspend") >= 0)\n'\ total[tidx] += pd[pname];
' total[tidx] += pd[pname];\n'\ else
' else\n'\ total[tidx+1] += pd[pname];
' total[tidx+1] += pd[pname];\n'\ }
' }\n'\ }
' }\n'\ var devname = deviceTitle(this.title, total, cpu);
' var devname = deviceTitle(this.title, total, cpu);\n'\ var left = 0.0;
' var left = 0.0;\n'\ for (var t = 0; t < pdata.length; t++) {
' for (var t = 0; t < pdata.length; t++) {\n'\ pd = pdata[t];
' pd = pdata[t];\n'\ devinfo = document.getElementById("devicedetail"+t);
' devinfo = document.getElementById("devicedetail"+t);\n'\ var phases = devinfo.getElementsByClassName("phaselet");
' var phases = devinfo.getElementsByClassName("phaselet");\n'\ for (var i = 0; i < phases.length; i++) {
' for (var i = 0; i < phases.length; i++) {\n'\ if(phases[i].id in pd) {
' if(phases[i].id in pd) {\n'\ var w = 100.0*pd[phases[i].id]/total[0];
' var w = 100.0*pd[phases[i].id]/total[0];\n'\ var fs = 32;
' var fs = 32;\n'\ if(w < 8) fs = 4*w | 0;
' if(w < 8) fs = 4*w | 0;\n'\ var fs2 = fs*3/4;
' var fs2 = fs*3/4;\n'\ phases[i].style.width = w+"%";
' phases[i].style.width = w+"%";\n'\ phases[i].style.left = left+"%";
' phases[i].style.left = left+"%";\n'\ phases[i].title = phases[i].id+" "+pd[phases[i].id]+" ms";
' phases[i].title = phases[i].id+" "+pd[phases[i].id]+" ms";\n'\ left += w;
' left += w;\n'\ var time = "<t4 style=\"font-size:"+fs+"px\">"+pd[phases[i].id]+" ms<br></t4>";
' var time = "<t4 style=\\"font-size:"+fs+"px\\">"+pd[phases[i].id]+" ms<br></t4>";\n'\ var pname = "<t3 style=\"font-size:"+fs2+"px\">"+phases[i].id.replace(new RegExp("_", "g"), " ")+"</t3>";
' var pname = "<t3 style=\\"font-size:"+fs2+"px\\">"+phases[i].id.replace(new RegExp("_", "g"), " ")+"</t3>";\n'\ phases[i].innerHTML = time+pname;
' phases[i].innerHTML = time+pname;\n'\ } else {
' } else {\n'\ phases[i].style.width = "0%";
' phases[i].style.width = "0%";\n'\ phases[i].style.left = left+"%";
' phases[i].style.left = left+"%";\n'\ }
' }\n'\ }
' }\n'\ }
' }\n'\ if(typeof devstats !== 'undefined')
' if(typeof devstats !== \'undefined\')\n'\ callDetail(this.id, this.title);
' callDetail(this.id, this.title);\n'\ var cglist = document.getElementById("callgraphs");
' var cglist = document.getElementById("callgraphs");\n'\ if(!cglist) return;
' if(!cglist) return;\n'\ var cg = cglist.getElementsByClassName("atop");
' var cg = cglist.getElementsByClassName("atop");\n'\ if(cg.length < 10) return;
' if(cg.length < 10) return;\n'\ for (var i = 0; i < cg.length; i++) {
' for (var i = 0; i < cg.length; i++) {\n'\ cgid = cg[i].id.split("x")[0]
' cgid = cg[i].id.split("x")[0]\n'\ if(idlist.indexOf(cgid) >= 0) {
' if(idlist.indexOf(cgid) >= 0) {\n'\ cg[i].style.display = "block";
' cg[i].style.display = "block";\n'\ } else {
' } else {\n'\ cg[i].style.display = "none";
' cg[i].style.display = "none";\n'\ }
' }\n'\ }
' }\n'\ }
' }\n'\ function callDetail(devid, devtitle) {
' function callDetail(devid, devtitle) {\n'\ if(!(devid in devstats) || devstats[devid].length < 1)
' if(!(devid in devstats) || devstats[devid].length < 1)\n'\ return;
' return;\n'\ var list = devstats[devid];
' var list = devstats[devid];\n'\ var tmp = devtitle.split(" ");
' var tmp = devtitle.split(" ");\n'\ var name = tmp[0], phase = tmp[tmp.length-1];
' var name = tmp[0], phase = tmp[tmp.length-1];\n'\ var dd = document.getElementById(phase);
' var dd = document.getElementById(phase);\n'\ var total = parseFloat(tmp[1].slice(1));
' var total = parseFloat(tmp[1].slice(1));\n'\ var mlist = [];
' var mlist = [];\n'\ var maxlen = 0;
' var maxlen = 0;\n'\ var info = []
' var info = []\n'\ for(var i in list) {
' for(var i in list) {\n'\ if(list[i][0] == "@") {
' if(list[i][0] == "@") {\n'\ info = list[i].split("|");
' info = list[i].split("|");\n'\ continue;
' continue;\n'\ }
' }\n'\ var tmp = list[i].split("|");
' var tmp = list[i].split("|");\n'\ var t = parseFloat(tmp[0]), f = tmp[1], c = parseInt(tmp[2]);
' var t = parseFloat(tmp[0]), f = tmp[1], c = parseInt(tmp[2]);\n'\ var p = (t*100.0/total).toFixed(2);
' var p = (t*100.0/total).toFixed(2);\n'\ mlist[mlist.length] = [f, c, t.toFixed(2), p+"%"];
' mlist[mlist.length] = [f, c, t.toFixed(2), p+"%"];\n'\ if(f.length > maxlen)
' if(f.length > maxlen)\n'\ maxlen = f.length;
' maxlen = f.length;\n'\ }
' }\n'\ var pad = 5;
' var pad = 5;\n'\ if(mlist.length == 0) pad = 30;
' if(mlist.length == 0) pad = 30;\n'\ var html = '<div style="padding-top:'+pad+'px"><t3> <b>'+name+':</b>';
' var html = \'<div style="padding-top:\'+pad+\'px"><t3> <b>\'+name+\':</b>\';\n'\ if(info.length > 2)
' if(info.length > 2)\n'\ html += " start=<b>"+info[1]+"</b>, end=<b>"+info[2]+"</b>";
' html += " start=<b>"+info[1]+"</b>, end=<b>"+info[2]+"</b>";\n'\ if(info.length > 3)
' if(info.length > 3)\n'\ html += ", length<i>(w/o overhead)</i>=<b>"+info[3]+" ms</b>";
' html += ", length<i>(w/o overhead)</i>=<b>"+info[3]+" ms</b>";\n'\ if(info.length > 4)
' if(info.length > 4)\n'\ html += ", return=<b>"+info[4]+"</b>";
' html += ", return=<b>"+info[4]+"</b>";\n'\ html += "</t3></div>";
' html += "</t3></div>";\n'\ if(mlist.length > 0) {
' if(mlist.length > 0) {\n'\ html += '<table class=fstat style="padding-top:'+(maxlen*5)+'px;"><tr><th>Function</th>';
' html += \'<table class=fstat style="padding-top:\'+(maxlen*5)+\'px;"><tr><th>Function</th>\';\n'\ for(var i in mlist)
' for(var i in mlist)\n'\ html += "<td class=vt>"+mlist[i][0]+"</td>";
' html += "<td class=vt>"+mlist[i][0]+"</td>";\n'\ html += "</tr><tr><th>Calls</th>";
' html += "</tr><tr><th>Calls</th>";\n'\ for(var i in mlist)
' for(var i in mlist)\n'\ html += "<td>"+mlist[i][1]+"</td>";
' html += "<td>"+mlist[i][1]+"</td>";\n'\ html += "</tr><tr><th>Time(ms)</th>";
' html += "</tr><tr><th>Time(ms)</th>";\n'\ for(var i in mlist)
' for(var i in mlist)\n'\ html += "<td>"+mlist[i][2]+"</td>";
' html += "<td>"+mlist[i][2]+"</td>";\n'\ html += "</tr><tr><th>Percent</th>";
' html += "</tr><tr><th>Percent</th>";\n'\ for(var i in mlist)
' for(var i in mlist)\n'\ html += "<td>"+mlist[i][3]+"</td>";
' html += "<td>"+mlist[i][3]+"</td>";\n'\ html += "</tr></table>";
' html += "</tr></table>";\n'\ }
' }\n'\ dd.innerHTML = html;
' dd.innerHTML = html;\n'\ var height = (maxlen*5)+100;
' var height = (maxlen*5)+100;\n'\ dd.style.height = height+"px";
' dd.style.height = height+"px";\n'\ document.getElementById("devicedetail").style.height = height+"px";
' document.getElementById("devicedetail").style.height = height+"px";\n'\ }
' }\n'\ function callSelect() {
' function callSelect() {\n'\ var cglist = document.getElementById("callgraphs");
' var cglist = document.getElementById("callgraphs");\n'\ if(!cglist) return;
' if(!cglist) return;\n'\ var cg = cglist.getElementsByClassName("atop");
' var cg = cglist.getElementsByClassName("atop");\n'\ for (var i = 0; i < cg.length; i++) {
' for (var i = 0; i < cg.length; i++) {\n'\ if(this.id == cg[i].id) {
' if(this.id == cg[i].id) {\n'\ cg[i].style.display = "block";
' cg[i].style.display = "block";\n'\ } else {
' } else {\n'\ cg[i].style.display = "none";
' cg[i].style.display = "none";\n'\ }
' }\n'\ }
' }\n'\ }
' }\n'\ function devListWindow(e) {
' function devListWindow(e) {\n'\ var win = window.open();
' var win = window.open();\n'\ var html = "<title>"+e.target.innerHTML+"</title>"+
' var html = "<title>"+e.target.innerHTML+"</title>"+\n'\ "<style type=\"text/css\">"+
' "<style type=\\"text/css\\">"+\n'\ " ul {list-style-type:circle;padding-left:10px;margin-left:10px;}"+
' " ul {list-style-type:circle;padding-left:10px;margin-left:10px;}"+\n'\ "</style>"
' "</style>"\n'\ var dt = devtable[0];
' var dt = devtable[0];\n'\ if(e.target.id != "devlist1")
' if(e.target.id != "devlist1")\n'\ dt = devtable[1];
' dt = devtable[1];\n'\ win.document.write(html+dt);
' win.document.write(html+dt);\n'\ }
' }\n'\ function errWindow() {
' function errWindow() {\n'\ var range = this.id.split("_");
' var range = this.id.split("_");\n'\ var idx1 = parseInt(range[0]);
' var idx1 = parseInt(range[0]);\n'\ var idx2 = parseInt(range[1]);
' var idx2 = parseInt(range[1]);\n'\ var win = window.open();
' var win = window.open();\n'\ var log = document.getElementById("dmesglog");
' var log = document.getElementById("dmesglog");\n'\ var title = "<title>dmesg log</title>";
' var title = "<title>dmesg log</title>";\n'\ var text = log.innerHTML.split("\n");
' var text = log.innerHTML.split("\\n");\n'\ var html = "";
' var html = "";\n'\ for(var i = 0; i < text.length; i++) {
' for(var i = 0; i < text.length; i++) {\n'\ if(i == idx1) {
' if(i == idx1) {\n'\ html += "<e id=target>"+text[i]+"</e>\n";
' html += "<e id=target>"+text[i]+"</e>\\n";\n'\ } else if(i > idx1 && i <= idx2) {
' } else if(i > idx1 && i <= idx2) {\n'\ html += "<e>"+text[i]+"</e>\n";
' html += "<e>"+text[i]+"</e>\\n";\n'\ } else {
' } else {\n'\ html += text[i]+"\n";
' html += text[i]+"\\n";\n'\ }
' }\n'\ }
' }\n'\ win.document.write("<style>e{color:red}</style>"+title+"<pre>"+html+"</pre>");
' win.document.write("<style>e{color:red}</style>"+title+"<pre>"+html+"</pre>");\n'\ win.location.hash = "#target";
' win.location.hash = "#target";\n'\ win.document.close();
' win.document.close();\n'\ }
' }\n'\ function logWindow(e) {
' function logWindow(e) {\n'\ var name = e.target.id.slice(4);
' var name = e.target.id.slice(4);\n'\ var win = window.open();
' var win = window.open();\n'\ var log = document.getElementById(name+"log");
' var log = document.getElementById(name+"log");\n'\ var title = "<title>"+document.title.split(" ")[0]+" "+name+" log</title>";
' var title = "<title>"+document.title.split(" ")[0]+" "+name+" log</title>";\n'\ win.document.write(title+"<pre>"+log.innerHTML+"</pre>");
' win.document.write(title+"<pre>"+log.innerHTML+"</pre>");\n'\ win.document.close();
' win.document.close();\n'\ }
' }\n'\ function onMouseDown(e) {
' function onMouseDown(e) {\n'\ dragval[0] = e.clientX;
' dragval[0] = e.clientX;\n'\ dragval[1] = document.getElementById("dmesgzoombox").scrollLeft;
' dragval[1] = document.getElementById("dmesgzoombox").scrollLeft;\n'\ document.onmousemove = onMouseMove;
' document.onmousemove = onMouseMove;\n'\ }
' }\n'\ function onMouseMove(e) {
' function onMouseMove(e) {\n'\ var zoombox = document.getElementById("dmesgzoombox");
' var zoombox = document.getElementById("dmesgzoombox");\n'\ zoombox.scrollLeft = dragval[1] + dragval[0] - e.clientX;
' zoombox.scrollLeft = dragval[1] + dragval[0] - e.clientX;\n'\ }
' }\n'\ function onMouseUp(e) {
' function onMouseUp(e) {\n'\ document.onmousemove = null;
' document.onmousemove = null;\n'\ }
' }\n'\ function onKeyPress(e) {
' function onKeyPress(e) {\n'\ var c = e.charCode;
' var c = e.charCode;\n'\ if(c != 42 && c != 43 && c != 45) return;
' if(c != 42 && c != 43 && c != 45) return;\n'\ var click = document.createEvent("Events");
' var click = document.createEvent("Events");\n'\ click.initEvent("click", true, false);
' click.initEvent("click", true, false);\n'\ if(c == 43)
' if(c == 43) \n'\ document.getElementById("zoomin").dispatchEvent(click);
' document.getElementById("zoomin").dispatchEvent(click);\n'\ else if(c == 45)
' else if(c == 45)\n'\ document.getElementById("zoomout").dispatchEvent(click);
' document.getElementById("zoomout").dispatchEvent(click);\n'\ else if(c == 42)
' else if(c == 42)\n'\ document.getElementById("zoomdef").dispatchEvent(click);
' document.getElementById("zoomdef").dispatchEvent(click);\n'\ }
' }\n'\ window.addEventListener("resize", function () {zoomTimeline();});
' window.addEventListener("resize", function () {zoomTimeline();});\n'\ window.addEventListener("load", function () {
' window.addEventListener("load", function () {\n'\ var dmesg = document.getElementById("dmesg");
' var dmesg = document.getElementById("dmesg");\n'\ dmesg.style.width = "100%"
' dmesg.style.width = "100%"\n'\ dmesg.onmousedown = onMouseDown;
' dmesg.onmousedown = onMouseDown;\n'\ document.onmouseup = onMouseUp;
' document.onmouseup = onMouseUp;\n'\ document.onkeypress = onKeyPress;
' document.onkeypress = onKeyPress;\n'\ document.getElementById("zoomin").onclick = zoomTimeline;
' document.getElementById("zoomin").onclick = zoomTimeline;\n'\ document.getElementById("zoomout").onclick = zoomTimeline;
' document.getElementById("zoomout").onclick = zoomTimeline;\n'\ document.getElementById("zoomdef").onclick = zoomTimeline;
' document.getElementById("zoomdef").onclick = zoomTimeline;\n'\ var list = document.getElementsByClassName("err");
' var list = document.getElementsByClassName("err");\n'\ for (var i = 0; i < list.length; i++)
' for (var i = 0; i < list.length; i++)\n'\ list[i].onclick = errWindow;
' list[i].onclick = errWindow;\n'\ var list = document.getElementsByClassName("logbtn");
' var list = document.getElementsByClassName("logbtn");\n'\ for (var i = 0; i < list.length; i++)
' for (var i = 0; i < list.length; i++)\n'\ list[i].onclick = logWindow;
' list[i].onclick = logWindow;\n'\ list = document.getElementsByClassName("devlist");
' list = document.getElementsByClassName("devlist");\n'\ for (var i = 0; i < list.length; i++)
' for (var i = 0; i < list.length; i++)\n'\ list[i].onclick = devListWindow;
' list[i].onclick = devListWindow;\n'\ var dev = dmesg.getElementsByClassName("thread");
' var dev = dmesg.getElementsByClassName("thread");\n'\ for (var i = 0; i < dev.length; i++) {
' for (var i = 0; i < dev.length; i++) {\n'\ dev[i].onclick = deviceDetail;
' dev[i].onclick = deviceDetail;\n'\ dev[i].onmouseover = deviceHover;
' dev[i].onmouseover = deviceHover;\n'\ dev[i].onmouseout = deviceUnhover;
' dev[i].onmouseout = deviceUnhover;\n'\ }
' }\n'\ var dev = dmesg.getElementsByClassName("srccall");
' var dev = dmesg.getElementsByClassName("srccall");\n'\ for (var i = 0; i < dev.length; i++)
' for (var i = 0; i < dev.length; i++)\n'\ dev[i].onclick = callSelect;
' dev[i].onclick = callSelect;\n'\ zoomTimeline();
' zoomTimeline();\n'\ });
' });\n'\ </script> """
'</script>\n'
hf.write(script_code); hf.write(script_code);
# Function: executeSuspend # Function: executeSuspend
...@@ -5637,7 +5637,7 @@ def deviceInfo(output=''): ...@@ -5637,7 +5637,7 @@ def deviceInfo(output=''):
tgtval = 'runtime_status' tgtval = 'runtime_status'
lines = dict() lines = dict()
for dirname, dirnames, filenames in os.walk('/sys/devices'): for dirname, dirnames, filenames in os.walk('/sys/devices'):
if(not re.match('.*/power', dirname) or if(not re.match(r'.*/power', dirname) or
'control' not in filenames or 'control' not in filenames or
tgtval not in filenames): tgtval not in filenames):
continue continue
...@@ -5731,7 +5731,7 @@ def dmidecode_backup(out, fatal=False): ...@@ -5731,7 +5731,7 @@ def dmidecode_backup(out, fatal=False):
if 'processor-version' not in out and os.path.exists(cpath): if 'processor-version' not in out and os.path.exists(cpath):
with open(cpath, 'r') as fp: with open(cpath, 'r') as fp:
for line in fp: for line in fp:
m = re.match('^model\s*name\s*\:\s*(?P<c>.*)', line) m = re.match(r'^model\s*name\s*\:\s*(?P<c>.*)', line)
if m: if m:
out['processor-version'] = m.group('c').strip() out['processor-version'] = m.group('c').strip()
break break
...@@ -6312,7 +6312,7 @@ def data_from_html(file, outpath, issues, fulldetail=False): ...@@ -6312,7 +6312,7 @@ def data_from_html(file, outpath, issues, fulldetail=False):
tstr = dt.strftime('%Y/%m/%d %H:%M:%S') tstr = dt.strftime('%Y/%m/%d %H:%M:%S')
error = find_in_html(html, '<table class="testfail"><tr><td>', '</td>') error = find_in_html(html, '<table class="testfail"><tr><td>', '</td>')
if error: if error:
m = re.match('[a-z0-9]* failed in (?P<p>\S*).*', error) m = re.match(r'[a-z0-9]* failed in (?P<p>\S*).*', error)
if m: if m:
result = 'fail in %s' % m.group('p') result = 'fail in %s' % m.group('p')
else: else:
...@@ -6350,7 +6350,7 @@ def data_from_html(file, outpath, issues, fulldetail=False): ...@@ -6350,7 +6350,7 @@ def data_from_html(file, outpath, issues, fulldetail=False):
extra['netfix'] = line extra['netfix'] = line
line = find_in_html(log, '# command ', '\n') line = find_in_html(log, '# command ', '\n')
if line: if line:
m = re.match('.* -m (?P<m>\S*).*', line) m = re.match(r'.* -m (?P<m>\S*).*', line)
if m: if m:
extra['fullmode'] = m.group('m') extra['fullmode'] = m.group('m')
low = find_in_html(html, 'freeze time: <b>', ' ms</b>') low = find_in_html(html, 'freeze time: <b>', ' ms</b>')
...@@ -6362,7 +6362,7 @@ def data_from_html(file, outpath, issues, fulldetail=False): ...@@ -6362,7 +6362,7 @@ def data_from_html(file, outpath, issues, fulldetail=False):
if lowstr == '+': if lowstr == '+':
issue = 'S2LOOPx%d' % len(low.split('+')) issue = 'S2LOOPx%d' % len(low.split('+'))
else: else:
m = re.match('.*waking *(?P<n>[0-9]*) *times.*', low) m = re.match(r'.*waking *(?P<n>[0-9]*) *times.*', low)
issue = 'S2WAKEx%s' % m.group('n') if m else 'S2WAKExNaN' issue = 'S2WAKEx%s' % m.group('n') if m else 'S2WAKExNaN'
match = [i for i in issues if i['match'] == issue] match = [i for i in issues if i['match'] == issue]
if len(match) > 0: if len(match) > 0:
...@@ -6380,10 +6380,10 @@ def data_from_html(file, outpath, issues, fulldetail=False): ...@@ -6380,10 +6380,10 @@ def data_from_html(file, outpath, issues, fulldetail=False):
# extract device info # extract device info
devices = dict() devices = dict()
for line in html.split('\n'): for line in html.split('\n'):
m = re.match(' *<div id=\"[a,0-9]*\" *title=\"(?P<title>.*)\" class=\"thread.*', line) m = re.match(r' *<div id=\"[a,0-9]*\" *title=\"(?P<title>.*)\" class=\"thread.*', line)
if not m or 'thread kth' in line or 'thread sec' in line: if not m or 'thread kth' in line or 'thread sec' in line:
continue continue
m = re.match('(?P<n>.*) \((?P<t>[0-9,\.]*) ms\) (?P<p>.*)', m.group('title')) m = re.match(r'(?P<n>.*) \((?P<t>[0-9,\.]*) ms\) (?P<p>.*)', m.group('title'))
if not m: if not m:
continue continue
name, time, phase = m.group('n'), m.group('t'), m.group('p') name, time, phase = m.group('n'), m.group('t'), m.group('p')
...@@ -6444,9 +6444,9 @@ def genHtml(subdir, force=False): ...@@ -6444,9 +6444,9 @@ def genHtml(subdir, force=False):
for filename in filenames: for filename in filenames:
file = os.path.join(dirname, filename) file = os.path.join(dirname, filename)
if sysvals.usable(file): if sysvals.usable(file):
if(re.match('.*_dmesg.txt', filename)): if(re.match(r'.*_dmesg.txt', filename)):
sysvals.dmesgfile = file sysvals.dmesgfile = file
elif(re.match('.*_ftrace.txt', filename)): elif(re.match(r'.*_ftrace.txt', filename)):
sysvals.ftracefile = file sysvals.ftracefile = file
sysvals.setOutputFile() sysvals.setOutputFile()
if (sysvals.dmesgfile or sysvals.ftracefile) and sysvals.htmlfile and \ if (sysvals.dmesgfile or sysvals.ftracefile) and sysvals.htmlfile and \
...@@ -6469,7 +6469,7 @@ def runSummary(subdir, local=True, genhtml=False): ...@@ -6469,7 +6469,7 @@ def runSummary(subdir, local=True, genhtml=False):
desc = {'host':[],'mode':[],'kernel':[]} desc = {'host':[],'mode':[],'kernel':[]}
for dirname, dirnames, filenames in os.walk(subdir): for dirname, dirnames, filenames in os.walk(subdir):
for filename in filenames: for filename in filenames:
if(not re.match('.*.html', filename)): if(not re.match(r'.*.html', filename)):
continue continue
data = data_from_html(os.path.join(dirname, filename), outpath, issues) data = data_from_html(os.path.join(dirname, filename), outpath, issues)
if(not data): if(not data):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment