Lines Matching +full:sig +full:- +full:dir +full:- +full:cmd

2 # SPDX-License-Identifier: GPL-2.0-only
21 # https://01.org/pm-graph
23 # git@github.com:intel/pm-graph
51 # ----------------- LIBRARIES --------------------
76 # ----------------- CLASSES --------------------
80 # A global, single-instance container used to
100 cgtest = -1
171 tmstart = 'SUSPEND START %Y%m%d-%H:%M:%S.%f'
172 tmend = 'RESUME COMPLETE %Y%m%d-%H:%M:%S.%f'
284 [0, 'pcidevices', 'lspci', '-tv'],
285 [0, 'usbdevices', 'lsusb', '-t'],
288 [2, 'gpecounts', 'sh', '-c', 'grep -v invalid /sys/firmware/acpi/interrupts/*'],
289 [2, 'suspendstats', 'sh', '-c', 'grep -v invalid /sys/power/suspend_stats/*'],
290 …[2, 'cpuidle', 'sh', '-c', 'grep -v invalid /sys/devices/system/cpu/cpu*/cpuidle/state*/s2idle/*'],
291 [2, 'battery', 'sh', '-c', 'grep -v invalid /sys/class/power_supply/*/*'],
313 self.testdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S')
336 s = 'SIG'+i
363 def getExec(self, cmd): argument
365 fp = Popen(['which', cmd], stdout=PIPE, stderr=PIPE).stdout
374 cmdfull = os.path.join(path, cmd)
401 if 'baseboard-manufacturer' in info:
402 m = info['baseboard-manufacturer']
403 elif 'system-manufacturer' in info:
404 m = info['system-manufacturer']
405 if 'system-product-name' in info:
406 p = info['system-product-name']
407 elif 'baseboard-product-name' in info:
408 p = info['baseboard-product-name']
409 if m[:5].lower() == 'intel' and 'baseboard-product-name' in info:
410 p = info['baseboard-product-name']
411 c = info['processor-version'] if 'processor-version' in info else ''
412 b = info['bios-version'] if 'bios-version' in info else ''
413 r = info['bios-release-date'] if 'bios-release-date' in info else ''
421 fmt = '%-24s: %s'
431 if re.match('^processor[ \t]*:[ \t]*[0-9]*', line):
436 m = re.match('^MemTotal:[ \t]*(?P<sz>[0-9]*) *kB', line)
439 m = re.match('^MemFree:[ \t]*(?P<sz>[0-9]*) *kB', line)
447 fmt = name+'-%m%d%y-%H%M%S'
502 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
516 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
622 if re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', func):
624 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', fmt):
639 # sort kprobes: trace, ub-dev, custom, dev
671 linesack = (len(check.split('\n')) - 1) // 2
759 tgtsize -= 65536
770 self.fsetVal('print-parent', 'trace_options')
771 self.fsetVal('funcgraph-abstime', 'trace_options')
772 self.fsetVal('funcgraph-cpu', 'trace_options')
773 self.fsetVal('funcgraph-duration', 'trace_options')
774 self.fsetVal('funcgraph-proc', 'trace_options')
775 self.fsetVal('funcgraph-tail', 'trace_options')
776 self.fsetVal('nofuncgraph-overhead', 'trace_options')
777 self.fsetVal('context-info', 'trace_options')
778 self.fsetVal('graph-time', 'trace_options')
852 def sudoUserchown(self, dir): argument
853 if os.path.exists(dir) and self.sudouser:
854 cmd = 'chown -R {0}:{0} {1} > /dev/null 2>&1'
855 call(cmd.format(self.sudouser, dir), shell=True)
879 dir = os.path.dirname(os.path.realpath(__file__))
882 elif os.path.exists(dir+'/'+file):
883 return dir+'/'+file
884 elif os.path.exists(dir+'/config/'+file):
885 return dir+'/config/'+file
924 footer += '# platform-testcmd: %s\n' % (self.testcommand)
948 dev = dirname.split('/')[-2]
950 props[dev].syspath = dirname[:-6]
994 footer += '# platform-devinfo: %s\n' % self.b64zip(out)
998 footer += '# platform-%s: %s | %s\n' % (name, cmdline, self.b64zip(info))
1007 prefix = prefix[:len(prefix)-1]
1010 if '/' in prefix and prefix[-1] != '/':
1056 dinfo += '\t%s : %s -> %s\n' % \
1081 line = fp.read().strip().split('\n')[-1]
1082 m = re.match('.* (?P<v>[0-9A-Fx]*) .*', line)
1092 cmd = self.getExec('turbostat')
1093 if not cmd:
1095 fp = Popen([cmd, '-v'], stdout=PIPE, stderr=PIPE).stderr
1103 cmd = self.getExec('turbostat')
1105 fullcmd = '%s -q -S echo freeze > %s' % (cmd, self.powerfile)
1106 fp = Popen(['sh', '-c', fullcmd], stdout=PIPE, stderr=PIPE).stderr
1139 vals.append(prop.split('=')[-1])
1147 m = re.match(' *(?P<dev>.*): (?P<stat>[0-9a-f]*) .*', w.split('\n')[-1])
1154 while (time.time() - start) < timeout:
1158 (self.wifiDetails(dev), max(0, time.time() - start))
1176 if re.match('^[0-9,\-\.]*$', arr[j]):
1177 arr[j] = '[0-9,\-\.]*'
1203 dt = t - self.multitest['last']
1207 pprint('TEST (%s) COMPLETE -- Duration %.1fs' % (id, dt))
1213 left = finish - datetime.now()
1214 left -= timedelta(microseconds=left.microseconds)
1216 left = timedelta(seconds=((self.multitest['count'] - idx) * int(avg)))
1217 pprint('TEST (%s) START - Avg Duration %.1fs, Time left %s' % \
1222 sz, unit, c = 'time', c[-1], c[:-1]
1230 def displayControl(self, cmd): argument
1231 xset, ret = 'timeout 10 xset -d :0.0 {0}', 0
1233 xset = 'sudo -u %s %s' % (self.sudouser, xset)
1234 if cmd == 'init':
1238 elif cmd == 'reset':
1240 elif cmd in ['on', 'off', 'standby', 'suspend']:
1242 ret = call(xset.format('dpms force %s' % cmd), shell=True)
1245 self.vprint('Display Switched: %s -> %s' % (b4, curr))
1246 if curr != cmd:
1247 self.vprint('WARNING: Display failed to change to %s' % cmd)
1249 self.vprint('WARNING: Display failed to change to %s with xset' % cmd)
1251 elif cmd == 'stat':
1277 # runtime suspend re-enable or re-disable
1340 # 10 sequential, non-overlapping phases of S/R
1381 'ACPI' : r'.*\bACPI *(?P<b>[A-Za-z]*) *Error[: ].*',
1383 'USBERR' : r'.*usb .*device .*, error [0-9-]*',
1384 'ATAERR' : r' *ata[0-9\.]*: .*failed.*',
1386 'TPMERR' : r'(?i) *tpm *tpm[0-9]*: .*error.*',
1394 self.tSuspended = 0.0 # low-level suspend start
1395 self.tResumed = 0.0 # low-level resume start
1415 self.tLow = [] # time spent in low-level suspends (standby/freeze)
1440 return plist[-1*depth]
1450 out['syslpi'] = i.split('=')[-1]+'%'
1452 out['pkgpc10'] = i.split('=')[-1]+'%'
1466 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
1472 dir = 'suspend' if t < self.tSuspended else 'resume'
1478 list.append((msg, err, dir, t, i, i))
1482 for msg, type, dir, t, idx1, idx2 in list:
1484 self.errorinfo[dir].append((type, t, idx1, idx2))
1559 threadname = 'kthread-%d' % (pid)
1561 threadname = '%s-%d' % (proc, pid)
1567 sysvals.vprint('[%f - %f] %s-%d %s %s %s' % \
1613 o = min(dev['end'], tdev['end']) - max(dev['start'], tdev['start'])
1627 if tdev['start'] - dev['end'] < 0.1:
1660 p.length = p.end - p.time
1666 if(t - dT < t0):
1668 return t - dT
1694 d['length'] = d['end'] - d['start']
1705 e.length = e.end - e.time
1706 for dir in ['suspend', 'resume']:
1708 for e in self.errorinfo[dir]:
1712 self.errorinfo[dir] = list
1719 tL = tR - tS
1727 tTry = '-%.0f' % (round(self.dmesg[lp]['waking'][1] * 1000))
1729 tTry = '-%.3f' % (self.dmesg[lp]['waking'][1] * 1000)
1738 stime = (self.tSuspended - self.start) * 1000000
1739 rtime = (self.end - self.tResumed) * 1000000
1741 hwr = self.hwend - timedelta(microseconds=rtime)
1742 self.tLow.append('%.0f'%((hwr - hws).total_seconds() * 1000))
1744 sktime = (self.tSuspended - self.tKernSus) * 1000
1745 rktime = (self.tKernRes - self.tResumed) * 1000
1747 def setPhase(self, phase, ktime, isbegin, order=-1):
1760 self.dmesg[phase] = {'list': dict(), 'start': -1.0, 'end': -1.0,
1823 def newActionGlobal(self, name, start, end, pid=-1, color=''):
1834 o = max(0, min(end, pend) - max(start, pstart))
1849 targetphase = phases[-1]
1850 if pid == -2:
1852 elif pid == -3:
1866 length = -1.0
1868 length = end - start
1869 if pid == -2 or name not in sysvals.tracefuncs.keys():
1886 if name == devname or re.match('^%s\[(?P<num>[0-9]*)\]$' % name, devname):
1918 sysvals.vprint('%20s: %f - %f (%d devices)' % (phase, ps, pe, dc))
1920 sysvals.vprint(''.join('-' for i in range(80)))
1922 fmt = '%3d) %'+maxname+'s - %f - %f'
1929 sysvals.vprint(''.join('-' for i in range(80)))
1962 info += ('<li>%s: %.3fms</li>' % (phase, (e-s)*1000))
1981 # list of top-most root devices
1988 if(pid < 0 or re.match('[0-9]*-[0-9]*\.[0-9]*[\.0-9]*\:[\.0-9]*$', pdev)):
2004 length = (list[dev]['end'] - list[dev]['start']) * 1000
2005 width = widfmt % (((list[dev]['end']-list[dev]['start'])*100)/tTotal)
2011 self.newAction(phase, devname, -2, '', \
2022 start = -1
2023 end = -1
2029 if start == -1 or tlast < start:
2031 if end == -1 or t > end:
2034 if start == -1 or end == -1:
2037 out = self.newActionGlobal(name, start, end, -3)
2130 self.length = end - start
2142 title = '%s(%s)%s <- %s, %s(%s)' % \
2155 dt = self.time - tgt.end
2156 # only combine calls if -all- attributes are identical
2241 if(m[-1] == '{'):
2246 elif(m[-1] == ';'):
2264 pprint(' -- %12.6f (depth=%02d): %s(); (%.3f us) %s' % (self.time, \
2267 pprint(' -- %12.6f (depth=%02d): %s} (%.3f us) %s' % (self.time, \
2270 pprint(' -- %12.6f (depth=%02d): %s() { (%.3f us) %s' % (self.time, \
2313 self.start = -1.0
2314 self.end = -1.0
2334 self.list[-1].freturn = True
2335 self.list[-1].length = line.time - self.list[-1].time
2343 # compare current depth with this lines pre-call depth
2350 last = self.list[-1]
2355 mismatch = prelinedep - self.depth
2362 self.depth -= 1
2367 last.length = line.time - last.time
2393 prelinedep -= 1
2421 if (md and self.depth >= md - 1) or (line.name in self.sv.cgblacklist):
2426 self.depth -= 1
2431 while len(self.list) > 0 and self.list[-1].depth > line.depth:
2432 self.list.pop(-1)
2436 self.list[-1].freturn = True
2437 self.list[-1].length = line.time - self.list[-1].time
2438 self.list[-1].name = line.name
2444 if mismatch < 0 and self.list[-1].depth == 0 and self.list[-1].freturn:
2445 line = self.list[-1]
2447 res = -1
2458 if res == -1:
2469 window = '(%f - %f)' % (self.start, line.time)
2479 mydepth = -1
2491 l.depth -= mydepth
2499 last = self.list[-1]
2519 if last.length > l.time - last.time:
2520 last.length = l.time - last.time
2532 cl.length = l.time - cl.time
2537 cnt -= 1
2598 out = data.newActionGlobal(name, fs, fe, -2)
2603 pprint('%s pid=%d [%f - %f] %.3f us' % \
2605 (self.end - self.start)*1000000))
2650 self.html += '<div class="version"><a href="https://01.org/pm-graph">%s v%s</a></div>' \
2677 item.row = -1
2703 remaining -= 1
2720 # initialize all device rows to -1 and calculate devrows
2726 dev['row'] = -1
2729 sortdict[item] = (-1*float(dev['start']), float(dev['end']) - float(dev['start']))
2732 sortdict[item] = (float(dev['end']) - float(dev['start']), item.dev['name'])
2739 if item.dev['pid'] == -2:
2765 remaining -= 1
2810 self.bodyH = self.height - self.scaleH
2817 …html_zoombox = '<center><button id="zoomin">ZOOM IN +</button><button id="zoomout">ZOOM OUT -</but…
2841 rline = '<div class="t" style="left:0;border-left:1px solid black;border-right:0;">{0}</div>\n'
2844 mTotal = mMax - m0
2851 divEdge = (mTotal - tS*(divTotal-1))*100/mTotal
2855 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal) - divEdge)
2856 val = '%0.fms' % (float(i-divTotal+1)*tS*1000)
2857 if(i == divTotal - 1):
2861 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal))
2873 stampfmt = '# [a-z]*-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\
2874 '(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\
2876 wififmt = '^# wifi *(?P<d>\S*) *(?P<s>\S*) *(?P<t>[0-9\.]+).*'
2880 cmdlinefmt = '^# command \| (?P<cmd>.*)'
2883 pinfofmt = '# platform-(?P<val>[a-z,A-Z,0-9]*): (?P<info>.*)'
2885 firmwarefmt = '# fwsuspend (?P<s>[0-9]*) fwresume (?P<r>[0-9]*)$'
2886 procexecfmt = 'ps - (?P<ps>.*)$'
2888 '^ *(?P<time>[0-9\.]*) *\| *(?P<cpu>[0-9]*)\)'+\
2889 ' *(?P<proc>.*)-(?P<pid>[0-9]*) *\|'+\
2890 '[ +!#\*@$]*(?P<dur>[0-9\.]*) .*\| (?P<msg>.*)'
2892 ' *(?P<proc>.*)-(?P<pid>[0-9]*) *\[(?P<cpu>[0-9]*)\] *'+\
2893 '(?P<flags>\S*) *(?P<time>[0-9\.]*): *'+\
2943 self.cmdline = m.group('cmd')
3070 c = ['cat /proc/[1-9]*/stat 2>/dev/null']
3084 ujiff = user - val['user']
3085 kjiff = kern - val['kern']
3097 out += '%s-%s %d' % (val['name'], pid, jiffies)
3098 return 'ps - '+out
3111 # ----------------- FUNCTIONS --------------------
3216 cg = testrun[testidx].ftemp[pid][-1]
3220 if(res == -1):
3221 testrun[testidx].ftemp[pid][-1].addLine(t)
3228 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3330 name = val[0].replace('--', '-')
3344 testrun.ttemp['thaw_processes'][-1]['end'] = t.time
3365 # -- phase changes --
3405 t.time - data.dmesg[lp]['start']
3453 testrun.ttemp[name][-1]['end'] = t.time
3454 testrun.ttemp[name][-1]['loop'] += 1
3467 testrun.ttemp[name][-1]['end'] = t.time
3480 data.newAction(phase, n, pid, p, t.time, -1, drv)
3493 dev['length'] = t.time - dev['start']
3511 'end': -1,
3542 cg = testrun.ftemp[key][-1]
3546 if(res == -1):
3547 testrun.ftemp[key][-1].addLine(t)
3585 if i < len(testruns) - 1:
3595 if event['end'] - event['begin'] <= 0:
3610 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3622 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3632 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3654 …sysvals.vprint('Callgraph found for task %d: %.3fms, %s' % (cg.pid, (cg.end - cg.start)*1000, name…
3702 for i in range(tc - 1):
3724 tp.stamp = datetime.now().strftime('# suspend-%m%d%y-%H%M%S localhost mem unknown')
3735 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
3746 m = re.match('.* *(?P<k>[0-9]\.[0-9]{2}\.[0-9]-.*) .*', msg)
3765 mc = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) calling '+\
3767 mr = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) call '+\
3800 'suspend': ['PM: Entering [a-z]* sleep.*', 'Suspending console.*'],
3804 'resume_machine': ['ACPI: Low-level resume complete.*'],
3834 'emsg': 'PM: Entering (?P<mode>[a-z,A-Z]*) sleep.*' },
3840 'emsg': 'Disabling non-boot CPUs .*' },
3843 t0 = -1.0
3844 cpu_start = -1.0
3845 prevktime = -1.0
3849 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
3945 # -- device callbacks --
3955 data.newAction(phase, f, int(n), p, ktime, -1, '')
3979 actions[a][-1]['end'] = ktime
3981 if(re.match('Disabling non-boot CPUs .*', msg)):
3984 elif(re.match('Enabling non-boot CPUs .*', msg)):
3987 elif(re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)):
3989 m = re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)
3995 elif(re.match('CPU(?P<cpu>[0-9]*) is up', msg)):
3997 m = re.match('CPU(?P<cpu>[0-9]*) is up', msg)
4049 cglen = (cg.end - cg.start) * 1000
4110 tdcenter = 'text-align:center;' if center else ''
4112 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4115 ….stamp {width: 100%;text-align:center;background:#888;line-height:30px;color:white;font: 25px Aria…
4116 table {width:100%;border-collapse: collapse;border:1px solid;}\n\
4120 tr.alt {background-color:#ddd;}\n\
4122 .minval {background-color:#BBFFBB;}\n\
4123 .medval {background-color:#BBBBFF;}\n\
4124 .maxval {background-color:#FFBBBB;}\n\
4125 .head a {color:#000;text-decoration: none;}\n\
4136 html = summaryCSS('Summary - SleepGraph')
4173 idx = len(list[mode]['data']) - 1
4258 iMin = iMed = iMax = [-1, -1, -1]
4261 # row classes - alternate row color
4305 html = summaryCSS('Device Summary - SleepGraph', False)
4351 # row classes - alternate row color
4372 html = summaryCSS('Issues Summary - SleepGraph', False)
4395 # row classes - alternate row color
4442 data.trimFreezeTime(testruns[-1].tSuspended)
4448 …lass="traceevent{6}" style="left:{1}%;top:{2}px;height:{3}px;width:{4}%;line-height:{3}px;{7}">{5}…
4456 …'<td class="gray" title="time spent in low-power mode with clock running">'+sysvals.suspendmode+' …
4481 tTotal = data.end - data.start
4505 rtot += data.end - data.tKernRes + (data.wifi['time'] * 1000.0)
4537 wtime = '%.0f ms'%(data.end - data.tKernRes + (data.wifi['time'] * 1000.0))
4548 tMax = testruns[-1].end
4549 tTotal = tMax - t0
4582 d = testruns[0].addHorizontalDivider(msg, testruns[-1].end)
4586 d = testruns[0].addHorizontalDivider('asynchronous kernel threads', testruns[-1].end)
4602 for dir in phases:
4604 bname = '%s%d' % (dir[0], data.testnumber)
4605 if dir == 'suspend':
4608 left = '%f' % (((m0-t0)*100.0)/tTotal)
4615 left = '%f' % ((((m0-t0)*100.0)+sysvals.srgap/2)/tTotal)
4616 mTotal = mMax - m0
4620 width = '%f' % (((mTotal*100.0)-sysvals.srgap/2)/tTotal)
4622 for b in phases[dir]:
4625 length = phase['end']-phase['start']
4626 left = '%f' % (((phase['start']-m0)*100.0)/mTotal)
4631 for e in data.errorinfo[dir]:
4635 right = '%f' % (((mMax-t)*100.0)/mTotal)
4637 for b in phases[dir]:
4659 left = '%f' % (((dev['start']-m0)*100)/mTotal)
4660 width = '%f' % (((dev['end']-dev['start'])*100)/mTotal)
4661 length = ' (%0.3f ms) ' % ((dev['end']-dev['start'])*1000)
4683 left = '%f' % (((start-m0)*100)/mTotal)
4684 width = '%f' % ((end-start)*100/mTotal)
4696 left = '%f' % (((e.time-m0)*100)/mTotal)
4705 devtl.createTimeScale(m0, mMax, tTotal, dir)
4713 phasedef = testruns[-1].phasedef
4736 pscolor = 'linear-gradient(to top left, #ccc, #eee)'
4741 length = phase['end']-phase['start']
4742 left = '%.3f' % (((phase['start']-t0)*100.0)/tTotal)
4757 data = testruns[-1]
4803 hoverZ = 'z-index:8;'
4817 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4820 body {overflow-y:scroll;}\n\
4821 ….stamp {width:100%;text-align:center;background:gray;line-height:30px;color:white;font:25px Arial;…
4823 .callgraph {margin-top:30px;box-shadow:5px 5px 20px black;}\n\
4824 .callgraph article * {padding-left:28px;}\n\
4829 t3 {color:black;font:20px Times;white-space:nowrap;}\n\
4830 t4 {color:black;font:bold 30px Times;line-height:60px;white-space:nowrap;}\n\
4839 .time2 {font:15px Arial;border-bottom:1px solid;border-left:1px solid;border-right:1px solid;}\n\
4841 td {text-align:center;}\n\
4847-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:black;stroke-width:0"…
4848 …troke="black" stroke-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:b…
4849 .pf:'+cgchk+' ~ *:not(:nth-child(2)) {display:none;}\n\
4850 …oombox {position:relative;width:100%;overflow-x:scroll;-webkit-user-select:none;-moz-user-select:n…
4851 ….timeline {position:relative;font-size:14px;cursor:pointer;width:100%; overflow:hidden;background:…
4852 …bsolute;height:0%;overflow:hidden;z-index:7;line-height:30px;font-size:14px;border:1px solid;text-
4853 .thread.ps {border-radius:3px;background:linear-gradient(to top, #ccc, #eee);}\n\
4855 ….thread.sec,.thread.sec:hover {background:black;border:0;color:white;line-height:15px;font-size:10…
4859 .jiffie {position:absolute;pointer-events: none;z-index:8;}\n\
4860 …font-size:10px;z-index:7;overflow:hidden;color:black;text-align:center;white-space:nowrap;border-r…
4861 .traceevent:hover {color:white;font-weight:bold;border:1px solid white;}\n\
4862 .phase {position:absolute;overflow:hidden;border:0px;text-align:center;}\n\
4863 ….phaselet {float:left;overflow:hidden;border:0px;text-align:center;min-height:100px;font-size:24px…
4864 ….t {position:absolute;line-height:'+('%d'%scaleTH)+'px;pointer-events:none;top:0;height:100%;borde…
4865 …err {position:absolute;top:0%;height:100%;border-right:3px solid red;color:red;font:bold 14px Time…
4866 .legend {position:relative; width:100%; height:40px; text-align:center;margin-bottom:20px}\n\
4867 …ion:absolute;cursor:pointer;top:10px; width:0px;height:20px;border:1px solid;padding-left:20px;}\n\
4868 button {height:40px;width:200px;margin-bottom:20px;margin-top:20px;font-size:24px;}\n\
4869 …ion:relative;float:right;height:25px;width:auto;margin-top:3px;margin-bottom:0;font-size:10px;text
4871 a:link {color:white;text-decoration:none;}\n\
4875 ….version {position:relative;float:left;color:white;font-size:10px;line-height:30px;margin-left:10p…
4876 #devicedetail {min-height:100px;box-shadow:5px 5px 20px black;}\n\
4878 .tback {position:absolute;width:100%;background:linear-gradient(#ccc, #ddd);}\n\
4879 .bg {z-index:1;}\n\
4892 tMax = testruns[-1].end * 1000
4902 ' var resolution = -1;\n'\
4905 ' var rline = \'<div class="t" style="left:0;border-left:1px solid black;border-right:0;">\';\n'\
4906 ' var tTotal = tMax - t0;\n'\
4916 ' var divEdge = (mTotal - tS*(divTotal-1))*100/mTotal;\n'\
4922 ' pos = 100 - (((j)*tS*100)/mTotal) - divEdge;\n'\
4923 ' val = (j-divTotal+1)*tS;\n'\
4924 ' if(j == divTotal - 1)\n'\
4929 ' pos = 100 - (((j)*tS*100)/mTotal);\n'\
4954 ' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\
4959 ' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\
4967 ' var tTotal = tMax - t0;\n'\
4971 ' if(i >= tS.length) i = tS.length - 1;\n'\
4984 ' var cpu = -1;\n'\
4985 ' if(name.match("CPU_ON\[[0-9]*\]"))\n'\
4987 ' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\
5039 ' var cpu = -1;\n'\
5040 ' if(name.match("CPU_ON\[[0-9]*\]"))\n'\
5042 ' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\
5068 ' var pname = info[info.length-1];\n'\
5069 ' pd[pname] = parseFloat(info[info.length-3].slice(1));\n'\
5093 ' var time = "<t4 style=\\"font-size:"+fs+"px\\">"+pd[phases[i].id]+" ms<br></t4>";\n'\
5094 …' var pname = "<t3 style=\\"font-size:"+fs2+"px\\">"+phases[i].id.replace(new RegExp("_", "g")…
5122 ' var name = tmp[0], phase = tmp[tmp.length-1];\n'\
5142 ' var html = \'<div style="padding-top:\'+pad+\'px"><t3> <b>\'+name+\':</b>\';\n'\
5151 …' html += \'<table class=fstat style="padding-top:\'+(maxlen*5)+\'px;"><tr><th>Function</th>\';\…
5186 ' " ul {list-style-type:circle;padding-left:10px;margin-left:10px;}"+\n'\
5230 ' zoombox.scrollLeft = dragval[1] + dragval[0] - e.clientX;\n'\
5350 tdata['error'] = 'cmd returned %d' % res
5423 return os.readlink(file).split('/')[-1]
5457 '---------------------------------------------------------------------------------------------\n'\
5462 '---------------------------------------------------------------------------------------------\n'\
5464 '---------------------------------------------------------------------------------------------')
5475 dirname = dirname[:-6]
5476 device = dirname.split('/')[-1]
5496 lines[dirname] = '%-26s %-26s %1s %1s %1s %1s %1s %10s %10s' % \
5528 modes.append('mem-%s' % memmode)
5535 modes.append('disk-%s' % m.strip('[]'))
5552 'bios-vendor': (0, 4),
5553 'bios-version': (0, 5),
5554 'bios-release-date': (0, 8),
5555 'system-manufacturer': (1, 4),
5556 'system-product-name': (1, 5),
5557 'system-version': (1, 6),
5558 'system-serial-number': (1, 7),
5559 'baseboard-manufacturer': (2, 4),
5560 'baseboard-product-name': (2, 5),
5561 'baseboard-version': (2, 6),
5562 'baseboard-serial-number': (2, 7),
5563 'chassis-manufacturer': (3, 4),
5564 'chassis-type': (3, 5),
5565 'chassis-version': (3, 6),
5566 'chassis-serial-number': (3, 7),
5567 'processor-manufacturer': (4, 7),
5568 'processor-version': (4, 16),
5612 if buf[i:i+4] == b'_SM_' and i < memsize - 16:
5642 while(count < num and i <= len(buf) - 4):
5645 while n < len(buf) - 1:
5654 if idx > 0 and idx < len(data) - 1:
5655 s = data[idx-1].decode('utf-8')
5751 recdata = fp.read(rechead[1]-8)
5783 fwData[0] = record[1] - record[0]
5838 pprint(' please choose one with -m')
5930 doError(name+': non-integer value given', True)
5949 doError(name+': non-numerical value given', True)
5979 sysvals.vprint(' %-8s : %s' % (key.upper(), sysvals.stamp[key]))
5995 sysvals.vprint('[%s - %s]' % (info[0], info[1]))
6091 num = re.search(r'[-+]?\d*\.\d+|\d+', str)
6119 m = re.match('[a-z0-9]* failed in (?P<p>\S*).*', error)
6141 for dir in d.errorinfo:
6142 for err in d.errorinfo[dir]:
6160 m = re.match('.*waking *(?P<n>[0-9]*) *times.*', low)
6178 m = re.match(' *<div id=\"[a,0-9]*\" *title=\"(?P<title>.*)\" class=\"thread.*', line)
6181 m = re.match('(?P<n>.*) \((?P<t>[0-9,\.]*) ms\) (?P<p>.*)', m.group('title'))
6186 name = ' '.join(name.split(' ')[:-1])
6228 for arg in ['-multi ', '-info ']:
6254 # create a summary of tests in a sub-directory
6284 pprint(' summary.html - tabular list of test data found')
6285 createHTMLDeviceSummary(testruns, os.path.join(outpath, 'summary-devices.html'), title)
6286 pprint(' summary-devices.html - kernel device list sorted by total execution time')
6287 createHTMLIssuesSummary(testruns, issues, os.path.join(outpath, 'summary-issues.html'), title)
6288 pprint(' summary-issues.html - kernel issues found sorted by frequency')
6298 doError('invalid boolean --> (%s: %s), use "true/false" or "1/0"' % (name, value), True)
6328 elif(option == 'override-timeline-functions'):
6330 elif(option == 'override-dev-timeline-functions'):
6339 sysvals.rs = -1
6343 doError('invalid value --> (%s: %s), use "enable/disable"' % (option, value), True)
6347 doError('invalid value --> (%s: %s), use %s' % (option, value, disopt), True)
6365 doError('invalid phase --> (%s: %s), valid phases are %s'\
6389 elif(option == 'command' or option == 'cmd'):
6409 elif(option == 'callloop-maxgap'):
6410 sysvals.callloopmaxgap = getArgFloat('callloop-maxgap', value, 0.0, 1.0, False)
6411 elif(option == 'callloop-maxlen'):
6412 sysvals.callloopmaxgap = getArgFloat('callloop-maxlen', value, 0.0, 1.0, False)
6417 elif(option == 'output-dir'):
6425 doError('-dev is not compatible with -f')
6427 doError('-proc is not compatible with -f')
6458 if val[0] == '[' and val[-1] == ']':
6459 for prop in val[1:-1].split(','):
6478 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', format):
6516 ' Generates output files in subdirectory: suspend-yymmdd-HHMMSS\n'\
6522 ' -h Print this help text\n'\
6523 ' -v Print the current tool version\n'\
6524 ' -config fn Pull arguments and config options from file fn\n'\
6525 ' -verbose Print extra information during execution and analysis\n'\
6526 ' -m mode Mode to initiate for suspend (default: %s)\n'\
6527 ' -o name Overrides the output subdirectory name when running a new test\n'\
6528 ' default: suspend-{date}-{time}\n'\
6529 ' -rtcwake t Wakeup t seconds after suspend, set t to "off" to disable (default: 15)\n'\
6530 ' -addlogs Add the dmesg and ftrace logs to the html output\n'\
6531 ' -noturbostat Dont use turbostat in freeze mode (default: disabled)\n'\
6532 ' -srgap Add a visible gap in the timeline between sus/res (default: disabled)\n'\
6533 …' -skiphtml Run the test and capture the trace logs, but skip the timeline (default: disabled…
6534 ' -result fn Export a results table to a text file for parsing.\n'\
6535 ' -wifi If a wifi connection is available, check that it reconnects after resume.\n'\
6537 ' -sync Sync the filesystems before starting the test\n'\
6538 ' -rs on/off Enable/disable runtime suspend for all devices, restore all after test\n'\
6539 ' -display m Change the display mode to m for the test (on/off/standby/suspend)\n'\
6541 ' -gzip Gzip the trace and dmesg logs to save space\n'\
6542 ' -cmd {s} Run the timeline over a custom command, e.g. "sync -d"\n'\
6543 ' -proc Add usermode process info into the timeline (default: disabled)\n'\
6544 ' -dev Add kernel function calls and threads to the timeline (default: disabled)\n'\
6545 ' -x2 Run two suspend/resumes back to back (default: disabled)\n'\
6546 ' -x2delay t Include t ms delay between multiple test runs (default: 0 ms)\n'\
6547 ' -predelay t Include t ms delay before 1st suspend (default: 0 ms)\n'\
6548 ' -postdelay t Include t ms delay after last resume (default: 0 ms)\n'\
6549 ' -mindev ms Discard all device blocks shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6550 ' -multi n d Execute <n> consecutive tests at <d> seconds intervals. If <n> is followed\n'\
6553 ' -maxfail n Abort a -multi run after n consecutive fails (default is 0 = never abort)\n'\
6555 ' -f Use ftrace to create device callgraphs (default: disabled)\n'\
6556 ' -ftop Use ftrace on the top level call: "%s" (default: disabled)\n'\
6557 ' -maxdepth N limit the callgraph data to N call levels (default: 0=all)\n'\
6558 ' -expandcg pre-expand the callgraph data in the html output (default: disabled)\n'\
6559 ' -fadd file Add functions to be graphed in the timeline from a list in a text file\n'\
6560 ' -filter "d1,d2,..." Filter out all but this comma-delimited list of device names\n'\
6561 ' -mincg ms Discard all callgraphs shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6562 ' -cgphase P Only show callgraph data for phase P (e.g. suspend_late)\n'\
6563 ' -cgtest N Only show callgraph data for test N (e.g. 0 or 1 in an x2 run)\n'\
6564 ' -timeprec N Number of significant digits in timestamps (0:S, [3:ms], 6:us)\n'\
6565 ' -cgfilter S Filter the callgraph output in the timeline\n'\
6566 ' -cgskip file Callgraph functions to skip, off to disable (default: cgskip.txt)\n'\
6567 ' -bufsize N Set trace buffer size to N kilo-bytes (default: all of free memory)\n'\
6568 ' -devdump Print out all the raw device data for each phase\n'\
6569 ' -cgdump Print out all the raw callgraph data\n'\
6572 ' -modes List available suspend modes\n'\
6573 ' -status Test to see if the system is enabled to run this tool\n'\
6574 ' -fpdt Print out the contents of the ACPI Firmware Performance Data Table\n'\
6575 ' -wificheck Print out wifi connection info\n'\
6576 ' -x<mode> Test xset by toggling the given mode (on/off/standby/suspend)\n'\
6577 ' -sysinfo Print out system info extracted from BIOS\n'\
6578 ' -devinfo Print out the pm settings of all devices which support runtime suspend\n'\
6579 ' -cmdinfo Print out all the platform info collected before and after suspend/resume\n'\
6580 ' -flist Print the list of functions currently being captured in ftrace\n'\
6581 ' -flistall Print all functions capable of being captured in ftrace\n'\
6582 ' -summary dir Create a summary of tests in this dir [-genhtml builds missing html]\n'\
6584 ' -ftrace ftracefile Create HTML output using ftrace input (used with -dmesg)\n'\
6585 ' -dmesg dmesgfile Create HTML output using dmesg (used with -ftrace)\n'\
6589 # ----------------- MAIN --------------------
6593 cmd = '' variable
6594 simplecmds = ['-sysinfo', '-modes', '-fpdt', '-flist', '-flistall',
6595 '-devinfo', '-status', '-xon', '-xoff', '-xstandby', '-xsuspend',
6596 '-xinit', '-xreset', '-xstat', '-wificheck', '-cmdinfo']
6597 if '-f' in sys.argv:
6602 if(arg == '-m'):
6611 cmd = arg[1:] variable
6612 elif(arg == '-h'):
6615 elif(arg == '-v'):
6618 elif(arg == '-x2'):
6620 elif(arg == '-x2delay'):
6621 sysvals.x2delay = getArgInt('-x2delay', args, 0, 60000)
6622 elif(arg == '-predelay'):
6623 sysvals.predelay = getArgInt('-predelay', args, 0, 60000)
6624 elif(arg == '-postdelay'):
6625 sysvals.postdelay = getArgInt('-postdelay', args, 0, 60000)
6626 elif(arg == '-f'):
6628 elif(arg == '-ftop'):
6632 elif(arg == '-skiphtml'):
6634 elif(arg == '-cgdump'):
6636 elif(arg == '-devdump'):
6638 elif(arg == '-genhtml'):
6640 elif(arg == '-addlogs'):
6642 elif(arg == '-nologs'):
6644 elif(arg == '-addlogdmesg'):
6646 elif(arg == '-addlogftrace'):
6648 elif(arg == '-noturbostat'):
6650 elif(arg == '-verbose'):
6652 elif(arg == '-proc'):
6654 elif(arg == '-dev'):
6656 elif(arg == '-sync'):
6658 elif(arg == '-wifi'):
6660 elif(arg == '-gzip'):
6662 elif(arg == '-info'):
6666 doError('-info requires one string argument', True)
6667 elif(arg == '-desc'):
6671 doError('-desc requires one string argument', True)
6672 elif(arg == '-rs'):
6676 doError('-rs requires "enable" or "disable"', True)
6679 sysvals.rs = -1
6684 elif(arg == '-display'):
6688 doError('-display requires an mode value', True)
6693 elif(arg == '-maxdepth'):
6694 sysvals.max_graph_depth = getArgInt('-maxdepth', args, 0, 1000)
6695 elif(arg == '-rtcwake'):
6704 sysvals.rtcwaketime = getArgInt('-rtcwake', val, 0, 3600, False)
6705 elif(arg == '-timeprec'):
6706 sysvals.setPrecision(getArgInt('-timeprec', args, 0, 6))
6707 elif(arg == '-mindev'):
6708 sysvals.mindevlen = getArgFloat('-mindev', args, 0.0, 10000.0)
6709 elif(arg == '-mincg'):
6710 sysvals.mincglen = getArgFloat('-mincg', args, 0.0, 10000.0)
6711 elif(arg == '-bufsize'):
6712 sysvals.bufsize = getArgInt('-bufsize', args, 1, 1024*1024*8)
6713 elif(arg == '-cgtest'):
6714 sysvals.cgtest = getArgInt('-cgtest', args, 0, 1)
6715 elif(arg == '-cgphase'):
6722 doError('invalid phase --> (%s: %s), valid phases are %s'\
6725 elif(arg == '-cgfilter'):
6731 elif(arg == '-skipkprobe'):
6737 elif(arg == '-cgskip'):
6748 elif(arg == '-callloop-maxgap'):
6749 sysvals.callloopmaxgap = getArgFloat('-callloop-maxgap', args, 0.0, 1.0)
6750 elif(arg == '-callloop-maxlen'):
6751 sysvals.callloopmaxlen = getArgFloat('-callloop-maxlen', args, 0.0, 1.0)
6752 elif(arg == '-cmd'):
6759 elif(arg == '-expandcg'):
6761 elif(arg == '-srgap'):
6763 elif(arg == '-maxfail'):
6764 sysvals.maxfail = getArgInt('-maxfail', args, 0, 1000000)
6765 elif(arg == '-multi'):
6769 doError('-multi requires two values', True)
6771 elif(arg == '-o'):
6777 elif(arg == '-config'):
6786 elif(arg == '-fadd'):
6795 elif(arg == '-dmesg'):
6804 elif(arg == '-ftrace'):
6813 elif(arg == '-summary'):
6818 cmd = 'summary' variable
6823 elif(arg == '-filter'):
6829 elif(arg == '-result'):
6841 doError('-dev is not compatible with -f')
6843 doError('-proc is not compatible with -f')
6859 if(cmd != ''):
6861 if(cmd == 'status'):
6864 elif(cmd == 'fpdt'):
6867 elif(cmd == 'sysinfo'):
6869 elif(cmd == 'devinfo'):
6871 elif(cmd == 'modes'):
6873 elif(cmd == 'flist'):
6875 elif(cmd == 'flistall'):
6877 elif(cmd == 'summary'):
6879 elif(cmd in ['xon', 'xoff', 'xstandby', 'xsuspend', 'xinit', 'xreset']):
6881 ret = sysvals.displayControl(cmd[1:])
6882 elif(cmd == 'xstat'):
6884 elif(cmd == 'wificheck'):
6890 elif(cmd == 'cmdinfo'):
6892 print('[%s - %s]\n%s\n' % out)
6895 # if instructed, re-analyze existing data files
6909 memmode = mode.split('-', 1)[-1] if '-' in mode else 'deep'
6918 if mode.startswith('disk-'):
6919 sysvals.diskmode = mode.split('-', 1)[-1]
6928 s = '-%dm' % sysvals.multitest['time']
6930 s = '-x%d' % sysvals.multitest['count']
6931 sysvals.outdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S'+s)
6943 fmt = 'suspend-%y%m%d-%H%M%S'