Lines Matching +full:clip +full:- +full:y +full:- +full:low

2 # SPDX-License-Identifier: GPL-2.0-only
21 # https://01.org/pm-graph
23 # git@github.com:intel/pm-graph
36 # CONFIG_DEVMEM=y
37 # CONFIG_PM_DEBUG=y
38 # CONFIG_PM_SLEEP_DEBUG=y
39 # CONFIG_FTRACE=y
40 # CONFIG_FUNCTION_TRACER=y
41 # CONFIG_FUNCTION_GRAPH_TRACER=y
42 # CONFIG_KPROBES=y
43 # CONFIG_KPROBES_ON_FTRACE=y
51 # ----------------- LIBRARIES --------------------
73 print('[%09.3f] %s' % (time.time()-mystarttime, msg))
81 # ----------------- CLASSES --------------------
85 # A global, single-instance container used to
107 cgtest = -1
182 tmstart = 'SUSPEND START %Y%m%d-%H:%M:%S.%f'
183 tmend = 'RESUME COMPLETE %Y%m%d-%H:%M:%S.%f'
294 [0, 'sysinfo', 'uname', '-a'],
295 [0, 'cpuinfo', 'head', '-7', '/proc/cpuinfo'],
298 [0, 'pcidevices', 'lspci', '-tv'],
299 [0, 'usbdevices', 'lsusb', '-tv'],
300 [0, 'acpidevices', 'sh', '-c', 'ls -l /sys/bus/acpi/devices/*/physical_node'],
307 [2, 'gpecounts', 'sh', '-c', 'grep -v invalid /sys/firmware/acpi/interrupts/*'],
308 [2, 'suspendstats', 'sh', '-c', 'grep -v invalid /sys/power/suspend_stats/*'],
309 …[2, 'cpuidle', 'sh', '-c', 'grep -v invalid /sys/devices/system/cpu/cpu*/cpuidle/state*/s2idle/*'],
310 [2, 'battery', 'sh', '-c', 'grep -v invalid /sys/class/power_supply/*/*'],
311 [2, 'thermal', 'sh', '-c', 'grep . /sys/class/thermal/thermal_zone*/temp'],
333 self.testdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S')
416 args['date'] = n.strftime('%y%m%d')
432 if 'baseboard-manufacturer' in info:
433 m = info['baseboard-manufacturer']
434 elif 'system-manufacturer' in info:
435 m = info['system-manufacturer']
436 if 'system-product-name' in info:
437 p = info['system-product-name']
438 elif 'baseboard-product-name' in info:
439 p = info['baseboard-product-name']
440 if m[:5].lower() == 'intel' and 'baseboard-product-name' in info:
441 p = info['baseboard-product-name']
442 c = info['processor-version'] if 'processor-version' in info else ''
443 b = info['bios-version'] if 'bios-version' in info else ''
444 r = info['bios-release-date'] if 'bios-release-date' in info else ''
454 fmt = '%-24s: %s'
456 print(fmt % ('os-version', self.osversion))
467 if re.match(r'^processor[ \t]*:[ \t]*[0-9]*', line):
472 m = re.match(r'^MemTotal:[ \t]*(?P<sz>[0-9]*) *kB', line)
475 m = re.match(r'^MemFree:[ \t]*(?P<sz>[0-9]*) *kB', line)
478 if os.path.exists('/etc/os-release'):
479 with open('/etc/os-release', 'r') as fp:
487 fmt = name+'-%m%d%y-%H%M%S'
542 m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
556 m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
662 if re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', func):
664 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', fmt):
679 # sort kprobes: trace, ub-dev, custom, dev
711 linesack = (len(check.split('\n')) - 1) // 2
804 tgtsize -= 65536
819 self.fsetVal('print-parent', 'trace_options')
820 self.fsetVal('funcgraph-abstime', 'trace_options')
821 self.fsetVal('funcgraph-cpu', 'trace_options')
822 self.fsetVal('funcgraph-duration', 'trace_options')
823 self.fsetVal('funcgraph-proc', 'trace_options')
824 self.fsetVal('funcgraph-tail', 'trace_options')
825 self.fsetVal('nofuncgraph-overhead', 'trace_options')
826 self.fsetVal('context-info', 'trace_options')
827 self.fsetVal('graph-time', 'trace_options')
905 cmd = 'chown -R {0}:{0} {1} > /dev/null 2>&1'
979 footer += '# platform-testcmd: %s\n' % (self.testcommand)
1003 dev = dirname.split('/')[-2]
1005 props[dev].syspath = dirname[:-6]
1046 footer += '# platform-devinfo: %s\n' % self.b64zip(out)
1050 footer += '# platform-%s: %s | %s\n' % (name, cmdline, self.b64zip(info))
1059 prefix = prefix[:len(prefix)-1]
1062 if '/' in prefix and prefix[-1] != '/':
1085 cmd = [self.getExec('ip'), '-4', '-o', '-br', 'addr']
1103 if args[i][0] == '{' and args[i][-1] == '}':
1104 args[i] = self.cmdinfovar(args[i][1:-1])
1125 dinfo += '\t%s : %s -> %s\n' % \
1150 line = fp.read().strip().split('\n')[-1]
1151 m = re.match(r'.* (?P<v>[0-9A-Fx]*) .*', line)
1173 fp = Popen([cmd, '-v'], stdout=PIPE, stderr=PIPE).stderr
1183 fullcmd = '%s -q -S echo freeze > %s' % (cmd, self.powerfile)
1184 fp = Popen(['sh', '-c', fullcmd], stdout=PIPE, stderr=PIPE)
1215 fp = Popen([cmd, '-s', net, 'on'], stdout=PIPE, stderr=PIPE).stdout
1227 vals.append(prop.split('=')[-1])
1235 m = re.match(r' *(?P<dev>.*): (?P<stat>[0-9a-f]*) .*', line)
1242 while (time.time() - start) < timeout:
1246 (self.wifiDetails(dev), max(0, time.time() - start))
1264 if re.match(r'^[0-9,\-\.]*$', arr[j]):
1265 arr[j] = r'[0-9,\-\.]*'
1291 dt = t - self.multitest['last']
1295 pprint('TEST (%s) COMPLETE -- Duration %.1fs' % (id, dt))
1301 left = finish - datetime.now()
1302 left -= timedelta(microseconds=left.microseconds)
1304 left = timedelta(seconds=((self.multitest['count'] - idx) * int(avg)))
1305 pprint('TEST (%s) START - Avg Duration %.1fs, Time left %s' % \
1310 sz, unit, c = 'time', c[-1], c[:-1]
1319 xset, ret = 'timeout 10 xset -d :0.0 {0}', 0
1321 xset = 'sudo -u %s %s' % (self.sudouser, xset)
1333 self.vprint('Display Switched: %s -> %s' % (b4, curr))
1365 # runtime suspend re-enable or re-disable
1442 # 10 sequential, non-overlapping phases of S/R
1484 'ACPI' : r'.*\bACPI *(?P<b>[A-Za-z]*) *Error[: ].*',
1486 'USBERR' : r'.*usb .*device .*, error [0-9-]*',
1487 'ATAERR' : r' *ata[0-9\.]*: .*failed.*',
1489 'TPMERR' : r'(?i) *tpm *tpm[0-9]*: .*error.*',
1497 self.tSuspended = 0.0 # low-level suspend start
1498 self.tResumed = 0.0 # low-level resume start
1518 self.tLow = [] # time spent in low-level suspends (standby/freeze)
1543 return plist[-1*depth]
1553 out['syslpi'] = i.split('=')[-1]+'%'
1555 out['pkgpc10'] = i.split('=')[-1]+'%'
1569 m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
1662 threadname = 'kthread-%d' % (pid)
1664 threadname = '%s-%d' % (proc, pid)
1672 sysvals.vprint('[%f - %f] %s-%d %s %s %s' % \
1719 o = min(dev['end'], tdev['end']) - max(dev['start'], tdev['start'])
1733 if tdev['start'] - dev['end'] < 0.1:
1766 p.length = p.end - p.time
1772 if(t - dT < t0):
1774 return t - dT
1800 d['length'] = d['end'] - d['start']
1811 e.length = e.end - e.time
1833 tL = tR - tS
1852 stime = (self.tSuspended - self.start) * 1000000
1853 rtime = (self.end - self.tResumed) * 1000000
1855 hwr = self.hwend - timedelta(microseconds=rtime)
1856 self.tLow.append('%.0f'%((hwr - hws).total_seconds() * 1000))
1858 s = (self.tSuspended - self.tKernSus) * 1000
1859 r = (self.tKernRes - self.tResumed) * 1000
1861 def setPhase(self, phase, ktime, isbegin, order=-1):
1874 self.dmesg[phase] = {'list': dict(), 'start': -1.0, 'end': -1.0,
1894 # if any calls never returned, clip them at system resume end
1919 # if any calls never returned, clip them at system resume end
1937 def newActionGlobal(self, name, start, end, pid=-1, color=''):
1948 o = max(0, min(end, pend) - max(start, pstart))
1963 targetphase = phases[-1]
1964 if pid == -2:
1966 elif pid == -3:
1980 length = -1.0
1982 length = end - start
1983 if pid == -2 or name not in sysvals.tracefuncs.keys():
2000 if name == devname or re.match(r'^%s\[(?P<num>[0-9]*)\]$' % name, devname):
2032 sysvals.vprint('%20s: %f - %f (%d devices)' % (phase, ps, pe, dc))
2034 sysvals.vprint(''.join('-' for i in range(80)))
2036 fmt = '%3d) %'+maxname+'s - %f - %f'
2043 sysvals.vprint(''.join('-' for i in range(80)))
2076 info += ('<li>%s: %.3fms</li>' % (phase, (e-s)*1000))
2095 # list of top-most root devices
2102 if(pid < 0 or re.match(r'[0-9]*-[0-9]*\.[0-9]*[\.0-9]*\:[\.0-9]*$', pdev)):
2118 length = (list[dev]['end'] - list[dev]['start']) * 1000
2119 width = widfmt % (((list[dev]['end']-list[dev]['start'])*100)/tTotal)
2125 self.newAction(phase, devname, -2, '', \
2135 tlast = start = end = -1
2144 maxj = (t - tlast) * 1024.0
2150 out = self.newActionGlobal(name, start, end, -3)
2193 m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
2196 m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
2199 m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) calling '+\
2205 m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: PM: '+\
2206 r'.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line)
2208 m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
2209 r'.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line)
2211 m = re.match(r'.*(\[ *)(?P<t>[0-9\.]*)(\]) call '+\
2236 self.length = end - start
2248 title = '%s(%s)%s <- %s, %s(%s)' % \
2261 dt = self.time - tgt.end
2262 # only combine calls if -all- attributes are identical
2347 if(m[-1] == '{'):
2352 elif(m[-1] == ';'):
2370 pprint(' -- %12.6f (depth=%02d): %s(); (%.3f us) %s' % (self.time, \
2373 pprint(' -- %12.6f (depth=%02d): %s} (%.3f us) %s' % (self.time, \
2376 pprint(' -- %12.6f (depth=%02d): %s() { (%.3f us) %s' % (self.time, \
2419 self.start = -1.0
2420 self.end = -1.0
2440 self.list[-1].freturn = True
2441 self.list[-1].length = line.time - self.list[-1].time
2449 # compare current depth with this lines pre-call depth
2456 last = self.list[-1]
2460 # handle low misalignments by inserting returns
2461 mismatch = prelinedep - self.depth
2468 self.depth -= 1
2473 last.length = line.time - last.time
2499 prelinedep -= 1
2527 if (md and self.depth >= md - 1) or (line.name in self.sv.cgblacklist):
2532 self.depth -= 1
2537 while len(self.list) > 0 and self.list[-1].depth > line.depth:
2538 self.list.pop(-1)
2542 self.list[-1].freturn = True
2543 self.list[-1].length = line.time - self.list[-1].time
2544 self.list[-1].name = line.name
2550 if mismatch < 0 and self.list[-1].depth == 0 and self.list[-1].freturn:
2551 line = self.list[-1]
2553 res = -1
2564 if res == -1:
2575 window = '(%f - %f)' % (self.start, line.time)
2585 mydepth = -1
2597 l.depth -= mydepth
2605 last = self.list[-1]
2623 # check each leaf and clip it at max possible length
2625 if last.length > l.time - last.time:
2626 last.length = l.time - last.time
2638 cl.length = l.time - cl.time
2643 cnt -= 1
2704 out = data.newActionGlobal(name, fs, fe, -2)
2709 pprint('%s pid=%d [%f - %f] %.3f us' % \
2711 (self.end - self.start)*1000000))
2756 self.html += '<div class="version"><a href="https://01.org/pm-graph">%s v%s</a></div>' \
2783 item.row = -1
2809 remaining -= 1
2826 # initialize all device rows to -1 and calculate devrows
2832 dev['row'] = -1
2835 sortdict[item] = (-1*float(dev['start']), float(dev['end']) - float(dev['start']))
2838 sortdict[item] = (float(dev['end']) - float(dev['start']), item.dev['name'])
2845 if item.dev['pid'] == -2:
2871 remaining -= 1
2916 self.bodyH = self.height - self.scaleH
2923 …html_zoombox = '<center><button id="zoomin">ZOOM IN +</button><button id="zoomout">ZOOM OUT -</but…
2947 rline = '<div class="t" style="left:0;border-left:1px solid black;border-right:0;">{0}</div>\n'
2950 mTotal = mMax - m0
2957 divEdge = (mTotal - tS*(divTotal-1))*100/mTotal
2961 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal) - divEdge)
2962 val = '%0.fms' % (float(i-divTotal+1)*tS*1000)
2963 if(i == divTotal - 1):
2967 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal))
2979 stampfmt = r'# [a-z]*-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\
2980 r'(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\
2982 wififmt = r'^# wifi *(?P<d>\S*) *(?P<s>\S*) *(?P<t>[0-9\.]+).*'
2989 pinfofmt = r'# platform-(?P<val>[a-z,A-Z,0-9,_]*): (?P<info>.*)'
2991 firmwarefmt = r'# fwsuspend (?P<s>[0-9]*) fwresume (?P<r>[0-9]*)$'
2992 procexecfmt = r'ps - (?P<ps>.*)$'
2993 procmultifmt = r'@(?P<n>[0-9]*)\|(?P<ps>.*)$'
2995 r'^ *(?P<time>[0-9\.]*) *\| *(?P<cpu>[0-9]*)\)'+\
2996 r' *(?P<proc>.*)-(?P<pid>[0-9]*) *\|'+\
2997 r'[ +!#\*@$]*(?P<dur>[0-9\.]*) .*\| (?P<msg>.*)'
2999 r' *(?P<proc>.*)-(?P<pid>[0-9]*) *\[(?P<cpu>[0-9]*)\] *'+\
3000 r'(?P<flags>\S*) *(?P<time>[0-9\.]*): *'+\
3066 dt = datetime(int(m.group('y'))+2000, int(m.group('m')),
3069 data.stamp['time'] = dt.strftime('%B %d %Y, %I:%M:%S %p')
3181 c = ['cat /proc/[1-9]*/stat 2>/dev/null']
3195 ujiff = user - val['user']
3196 kjiff = kern - val['kern']
3206 if len(out[-1]) > self.maxchars:
3208 elif len(out[-1]) > 0:
3209 out[-1] += ','
3210 out[-1] += '%s-%s %d' % (val['name'], pid, jiffies)
3213 sysvals.fsetVal('ps - @%d|%s' % (len(out), line), 'trace_marker')
3215 sysvals.fsetVal('ps - %s' % out[0], 'trace_marker')
3226 # ----------------- FUNCTIONS --------------------
3330 cg = testrun[testidx].ftemp[pid][-1]
3334 if(res == -1):
3335 testrun[testidx].ftemp[pid][-1].addLine(t)
3342 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3492 name = val[0].replace('--', '-')
3510 testrun.ttemp['thaw_processes'][-1]['end'] = t.time
3531 # -- phase changes --
3571 t.time - data.dmesg[lp]['start']
3619 testrun.ttemp[name][-1]['end'] = t.time
3620 testrun.ttemp[name][-1]['loop'] += 1
3633 testrun.ttemp[name][-1]['end'] = t.time
3646 data.newAction(phase, n, pid, p, t.time, -1, drv)
3659 dev['length'] = t.time - dev['start']
3677 'end': -1,
3692 if (t.time - e['begin']) * 1000 < sysvals.mindevlen:
3711 cg = testrun.ftemp[key][-1]
3715 if(res == -1):
3716 testrun.ftemp[key][-1].addLine(t)
3753 if i < len(testruns) - 1:
3763 if event['end'] - event['begin'] <= 0:
3778 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3790 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3800 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3822 …sysvals.vprint('Callgraph found for task %d: %.3fms, %s' % (cg.pid, (cg.end - cg.start)*1000, name…
3876 for i in range(tc - 1):
3896 tp.stamp = datetime.now().strftime('# suspend-%m%d%y-%H%M%S localhost mem unknown')
3907 m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
3919 m = re.match(r'.* *(?P<k>[0-9]\.[0-9]{2}\.[0-9]-.*) .*', msg)
3975 'suspend': ['PM: Entering [a-z]* sleep.*', 'Suspending console.*',
3981 'suspend_machine': ['PM: suspend-to-idle',
3985 'ACPI: Low-level resume complete.*',
3987 r'Suspended for [0-9\.]* seconds'],
3988 'resume_noirq': ['PM: resume from suspend-to-idle',
4003 'emsg': 'PM: Preparing system for[a-z]* sleep.*' },
4015 'emsg': 'Disabling non-boot CPUs .*' },
4018 t0 = -1.0
4019 cpu_start = -1.0
4020 prevktime = -1.0
4024 m = re.match(r'[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
4121 # -- device callbacks --
4126 data.newAction(phase, f, int(n), p, ktime, -1, '')
4145 if(a in actions and actions[a][-1]['begin'] == actions[a][-1]['end']):
4146 actions[a][-1]['end'] = ktime
4148 if(re.match(r'Disabling non-boot CPUs .*', msg)):
4151 elif(re.match(r'Enabling non-boot CPUs .*', msg)):
4154 elif(re.match(r'smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg) \
4155 or re.match(r'psci: CPU(?P<cpu>[0-9]*) killed.*', msg)):
4157 m = re.match(r'smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)
4159 m = re.match(r'psci: CPU(?P<cpu>[0-9]*) killed.*', msg)
4165 elif(re.match(r'CPU(?P<cpu>[0-9]*) is up', msg)):
4167 m = re.match(r'CPU(?P<cpu>[0-9]*) is up', msg)
4221 cglen = (cg.end - cg.start) * 1000
4284 tdcenter = 'text-align:center;' if center else ''
4286 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4289 ….stamp {width: 100%;text-align:center;background:#888;line-height:30px;color:white;font: 25px Aria…
4290 table {width:100%;border-collapse: collapse;border:1px solid;}\n\
4294 tr.alt {background-color:#ddd;}\n\
4296 .minval {background-color:#BBFFBB;}\n\
4297 .medval {background-color:#BBBBFF;}\n\
4298 .maxval {background-color:#FFBBBB;}\n\
4299 .head a {color:#000;text-decoration: none;}\n\
4310 html = summaryCSS('Summary - SleepGraph')
4348 idx = len(list[mode]['data']) - 1
4433 iMin = iMed = iMax = [-1, -1, -1]
4436 # row classes - alternate row color
4480 html = summaryCSS('Device Summary - SleepGraph', False)
4526 # row classes - alternate row color
4547 html = summaryCSS('Issues Summary - SleepGraph', False)
4570 # row classes - alternate row color
4617 data.trimFreezeTime(testruns[-1].tSuspended)
4623 …lass="traceevent{6}" style="left:{1}%;top:{2}px;height:{3}px;width:{4}%;line-height:{3}px;{7}">{5}…
4631 …'<td class="gray" title="time spent in low-power mode with clock running">'+sysvals.suspendmode+' …
4656 tTotal = data.end - data.start
4680 rtot += data.end - data.tKernRes + (data.wifi['time'] * 1000.0)
4712 wtime = '%.0f ms'%(data.end - data.tKernRes + (data.wifi['time'] * 1000.0))
4723 tMax = testruns[-1].end
4724 tTotal = tMax - t0
4757 d = testruns[0].addHorizontalDivider(msg, testruns[-1].end)
4761 d = testruns[0].addHorizontalDivider('asynchronous kernel threads', testruns[-1].end)
4783 left = '%f' % (((m0-t0)*100.0)/tTotal)
4790 left = '%f' % ((((m0-t0)*100.0)+sysvals.srgap/2)/tTotal)
4791 mTotal = mMax - m0
4795 width = '%f' % (((mTotal*100.0)-sysvals.srgap/2)/tTotal)
4800 length = phase['end']-phase['start']
4801 left = '%f' % (((phase['start']-m0)*100.0)/mTotal)
4810 right = '%f' % (((mMax-t)*100.0)/mTotal)
4834 left = '%f' % (((dev['start']-m0)*100)/mTotal)
4835 width = '%f' % (((dev['end']-dev['start'])*100)/mTotal)
4836 length = ' (%0.3f ms) ' % ((dev['end']-dev['start'])*1000)
4855 left = '%f' % (((start-m0)*100)/mTotal)
4856 width = '%f' % ((end-start)*100/mTotal)
4868 left = '%f' % (((e.time-m0)*100)/mTotal)
4885 phasedef = testruns[-1].phasedef
4908 pscolor = 'linear-gradient(to top left, #ccc, #eee)'
4913 length = phase['end']-phase['start']
4914 left = '%.3f' % (((phase['start']-t0)*100.0)/tTotal)
4929 data = testruns[-1]
4975 hoverZ = 'z-index:8;'
4989 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4992 body {overflow-y:scroll;}\n\
4993 ….stamp {width:100%;text-align:center;background:gray;line-height:30px;color:white;font:25px Arial;…
4995 .callgraph {margin-top:30px;box-shadow:5px 5px 20px black;}\n\
4996 .callgraph article * {padding-left:28px;}\n\
5001 t3 {color:black;font:20px Times;white-space:nowrap;}\n\
5002 t4 {color:black;font:bold 30px Times;line-height:60px;white-space:nowrap;}\n\
5011 .time2 {font:15px Arial;border-bottom:1px solid;border-left:1px solid;border-right:1px solid;}\n\
5013 td {text-align:center;}\n\
5019-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:black;stroke-width:0"…
5020 …troke="black" stroke-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:b…
5021 .pf:'+cgchk+' ~ *:not(:nth-child(2)) {display:none;}\n\
5022 …oombox {position:relative;width:100%;overflow-x:scroll;-webkit-user-select:none;-moz-user-select:n…
5023 ….timeline {position:relative;font-size:14px;cursor:pointer;width:100%; overflow:hidden;background:…
5024 …bsolute;height:0%;overflow:hidden;z-index:7;line-height:30px;font-size:14px;border:1px solid;text-
5025 .thread.ps {border-radius:3px;background:linear-gradient(to top, #ccc, #eee);}\n\
5027 ….thread.sec,.thread.sec:hover {background:black;border:0;color:white;line-height:15px;font-size:10…
5031 .jiffie {position:absolute;pointer-events: none;z-index:8;}\n\
5032 …font-size:10px;z-index:7;overflow:hidden;color:black;text-align:center;white-space:nowrap;border-r…
5033 .traceevent:hover {color:white;font-weight:bold;border:1px solid white;}\n\
5034 .phase {position:absolute;overflow:hidden;border:0px;text-align:center;}\n\
5035 ….phaselet {float:left;overflow:hidden;border:0px;text-align:center;min-height:100px;font-size:24px…
5036 ….t {position:absolute;line-height:'+('%d'%scaleTH)+'px;pointer-events:none;top:0;height:100%;borde…
5037 …err {position:absolute;top:0%;height:100%;border-right:3px solid red;color:red;font:bold 14px Time…
5038 .legend {position:relative; width:100%; height:40px; text-align:center;margin-bottom:20px}\n\
5039 …ion:absolute;cursor:pointer;top:10px; width:0px;height:20px;border:1px solid;padding-left:20px;}\n\
5040 button {height:40px;width:200px;margin-bottom:20px;margin-top:20px;font-size:24px;}\n\
5041 …ion:relative;float:right;height:25px;width:auto;margin-top:3px;margin-bottom:0;font-size:10px;text
5043 a:link {color:white;text-decoration:none;}\n\
5047 ….version {position:relative;float:left;color:white;font-size:10px;line-height:30px;margin-left:10p…
5048 #devicedetail {min-height:100px;box-shadow:5px 5px 20px black;}\n\
5050 .tback {position:absolute;width:100%;background:linear-gradient(#ccc, #ddd);}\n\
5051 .bg {z-index:1;}\n\
5064 tMax = testruns[-1].end * 1000
5074 script_code = r""" var resolution = -1;
5077 var rline = '<div class="t" style="left:0;border-left:1px solid black;border-right:0;">';
5078 var tTotal = tMax - t0;
5088 var divEdge = (mTotal - tS*(divTotal-1))*100/mTotal;
5094 pos = 100 - (((j)*tS*100)/mTotal) - divEdge;
5095 val = (j-divTotal+1)*tS;
5096 if(j == divTotal - 1)
5101 pos = 100 - (((j)*tS*100)/mTotal);
5126 zoombox.scrollLeft = ((left + sh) * newval / val) - sh;
5131 zoombox.scrollLeft = ((left + sh) * newval / val) - sh;
5139 var tTotal = tMax - t0;
5143 if(i >= tS.length) i = tS.length - 1;
5156 var cpu = -1;
5157 if(name.match("CPU_ON\[[0-9]*\]"))
5159 else if(name.match("CPU_OFF\[[0-9]*\]"))
5211 var cpu = -1;
5212 if(name.match("CPU_ON\[[0-9]*\]"))
5214 else if(name.match("CPU_OFF\[[0-9]*\]"))
5240 var pname = info[info.length-1];
5241 pd[pname] = parseFloat(info[info.length-3].slice(1));
5265 var time = "<t4 style=\"font-size:"+fs+"px\">"+pd[phases[i].id]+" ms<br></t4>";
5266 …var pname = "<t3 style=\"font-size:"+fs2+"px\">"+phases[i].id.replace(new RegExp("_", "g"), " ")+"…
5294 var name = tmp[0], phase = tmp[tmp.length-1];
5314 var html = '<div style="padding-top:'+pad+'px"><t3> <b>'+name+':</b>';
5323 html += '<table class=fstat style="padding-top:'+(maxlen*5)+'px;"><tr><th>Function</th>';
5358 " ul {list-style-type:circle;padding-left:10px;margin-left:10px;}"+
5402 zoombox.scrollLeft = dragval[1] + dragval[0] - e.clientX;
5593 return os.readlink(file).split('/')[-1]
5627 '---------------------------------------------------------------------------------------------\n'\
5632 '---------------------------------------------------------------------------------------------\n'\
5634 '---------------------------------------------------------------------------------------------')
5645 dirname = dirname[:-6]
5646 device = dirname.split('/')[-1]
5666 lines[dirname] = '%-26s %-26s %1s %1s %1s %1s %1s %10s %10s' % \
5698 modes.append('mem-%s' % memmode)
5705 modes.append('disk-%s' % m.strip('[]'))
5711 'bios-vendor': 'bios_vendor',
5712 'bios-version': 'bios_version',
5713 'bios-release-date': 'bios_date',
5714 'system-manufacturer': 'sys_vendor',
5715 'system-product-name': 'product_name',
5716 'system-version': 'product_version',
5717 'system-serial-number': 'product_serial',
5718 'baseboard-manufacturer': 'board_vendor',
5719 'baseboard-product-name': 'board_name',
5720 'baseboard-version': 'board_version',
5721 'baseboard-serial-number': 'board_serial',
5722 'chassis-manufacturer': 'chassis_vendor',
5723 'chassis-version': 'chassis_version',
5724 'chassis-serial-number': 'chassis_serial',
5731 if 'processor-version' not in out and os.path.exists(cpath):
5736 out['processor-version'] = m.group('c').strip()
5758 'bios-vendor': (0, 4),
5759 'bios-version': (0, 5),
5760 'bios-release-date': (0, 8),
5761 'system-manufacturer': (1, 4),
5762 'system-product-name': (1, 5),
5763 'system-version': (1, 6),
5764 'system-serial-number': (1, 7),
5765 'baseboard-manufacturer': (2, 4),
5766 'baseboard-product-name': (2, 5),
5767 'baseboard-version': (2, 6),
5768 'baseboard-serial-number': (2, 7),
5769 'chassis-manufacturer': (3, 4),
5770 'chassis-version': (3, 6),
5771 'chassis-serial-number': (3, 7),
5772 'processor-manufacturer': (4, 7),
5773 'processor-version': (4, 16),
5804 if buf[i:i+4] == b'_SM_' and i < memsize - 16:
5827 while(count < num and i <= len(buf) - 4):
5830 while n < len(buf) - 1:
5839 if idx > 0 and idx < len(data) - 1:
5840 s = data[idx-1].decode('utf-8')
5936 recdata = fp.read(rechead[1]-8)
5968 fwData[0] = record[1] - record[0]
6023 pprint(' please choose one with -m')
6033 status = efmt.format('-f')
6035 status = efmt.format('-dev')
6037 status = efmt.format('-proc')
6121 doError(name+': non-integer value given', True)
6140 doError(name+': non-numerical value given', True)
6170 sysvals.vprint(' %-8s : %s' % (key.upper(), sysvals.stamp[key]))
6186 sysvals.vprint('[%s - %s]' % (info[0], info[1]))
6247 sysvals.testVal(sysvals.s0ixpath, 'basic', 'Y')
6284 num = re.search(r'[-+]?\d*\.\d+|\d+', str)
6308 dt = datetime.strptime(' '.join(stmp[3:]), '%B %d %Y, %I:%M:%S %p')
6312 tstr = dt.strftime('%Y/%m/%d %H:%M:%S')
6315 m = re.match(r'[a-z0-9]* failed in (?P<p>\S*).*', error)
6353 m = re.match(r'.* -m (?P<m>\S*).*', line)
6356 low = find_in_html(html, 'freeze time: <b>', ' ms</b>')
6358 if not low:
6360 if lowstr not in low:
6363 issue = 'S2LOOPx%d' % len(low.split('+'))
6365 m = re.match(r'.*waking *(?P<n>[0-9]*) *times.*', low)
6383 m = re.match(r' *<div id=\"[a,0-9]*\" *title=\"(?P<title>.*)\" class=\"thread.*', line)
6386 m = re.match(r'(?P<n>.*) \((?P<t>[0-9,\.]*) ms\) (?P<p>.*)', m.group('title'))
6393 name = ' '.join(name.split(' ')[:-1])
6435 for arg in ['-multi ', '-info ']:
6461 # create a summary of tests in a sub-directory
6491 pprint(' summary.html - tabular list of test data found')
6492 createHTMLDeviceSummary(testruns, os.path.join(outpath, 'summary-devices.html'), title)
6493 pprint(' summary-devices.html - kernel device list sorted by total execution time')
6494 createHTMLIssuesSummary(testruns, issues, os.path.join(outpath, 'summary-issues.html'), title)
6495 pprint(' summary-issues.html - kernel issues found sorted by frequency')
6505 doError('invalid boolean --> (%s: %s), use "true/false" or "1/0"' % (name, value), True)
6535 elif(option == 'override-timeline-functions'):
6537 elif(option == 'override-dev-timeline-functions'):
6546 sysvals.rs = -1
6550 doError('invalid value --> (%s: %s), use "enable/disable"' % (option, value), True)
6554 doError('invalid value --> (%s: %s), use %s' % (option, value, disopt), True)
6572 doError('invalid phase --> (%s: %s), valid phases are %s'\
6616 elif(option == 'callloop-maxgap'):
6617 sysvals.callloopmaxgap = getArgFloat('callloop-maxgap', value, 0.0, 1.0, False)
6618 elif(option == 'callloop-maxlen'):
6619 sysvals.callloopmaxgap = getArgFloat('callloop-maxlen', value, 0.0, 1.0, False)
6624 elif(option == 'output-dir'):
6632 doError('-dev is not compatible with -f')
6634 doError('-proc is not compatible with -f')
6665 if val[0] == '[' and val[-1] == ']':
6666 for prop in val[1:-1].split(','):
6685 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', format):
6723 ' Generates output files in subdirectory: suspend-yymmdd-HHMMSS\n'\
6729 ' -h Print this help text\n'\
6730 ' -v Print the current tool version\n'\
6731 ' -config fn Pull arguments and config options from file fn\n'\
6732 ' -verbose Print extra information during execution and analysis\n'\
6733 ' -m mode Mode to initiate for suspend (default: %s)\n'\
6734 ' -o name Overrides the output subdirectory name when running a new test\n'\
6735 ' default: suspend-{date}-{time}\n'\
6736 ' -rtcwake t Wakeup t seconds after suspend, set t to "off" to disable (default: 15)\n'\
6737 ' -addlogs Add the dmesg and ftrace logs to the html output\n'\
6738 ' -noturbostat Dont use turbostat in freeze mode (default: disabled)\n'\
6739 ' -srgap Add a visible gap in the timeline between sus/res (default: disabled)\n'\
6740 …' -skiphtml Run the test and capture the trace logs, but skip the timeline (default: disabled…
6741 ' -result fn Export a results table to a text file for parsing.\n'\
6742 ' -wifi If a wifi connection is available, check that it reconnects after resume.\n'\
6743 ' -wifitrace Trace kernel execution through wifi reconnect.\n'\
6744 ' -netfix Use netfix to reset the network in the event it fails to resume.\n'\
6746 ' -sync Sync the filesystems before starting the test\n'\
6747 ' -rs on/off Enable/disable runtime suspend for all devices, restore all after test\n'\
6748 ' -display m Change the display mode to m for the test (on/off/standby/suspend)\n'\
6750 ' -gzip Gzip the trace and dmesg logs to save space\n'\
6751 ' -cmd {s} Run the timeline over a custom command, e.g. "sync -d"\n'\
6752 ' -proc Add usermode process info into the timeline (default: disabled)\n'\
6753 ' -dev Add kernel function calls and threads to the timeline (default: disabled)\n'\
6754 ' -x2 Run two suspend/resumes back to back (default: disabled)\n'\
6755 ' -x2delay t Include t ms delay between multiple test runs (default: 0 ms)\n'\
6756 ' -predelay t Include t ms delay before 1st suspend (default: 0 ms)\n'\
6757 ' -postdelay t Include t ms delay after last resume (default: 0 ms)\n'\
6758 ' -mindev ms Discard all device blocks shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6759 ' -multi n d Execute <n> consecutive tests at <d> seconds intervals. If <n> is followed\n'\
6762 ' -maxfail n Abort a -multi run after n consecutive fails (default is 0 = never abort)\n'\
6764 ' -f Use ftrace to create device callgraphs (default: disabled)\n'\
6765 ' -ftop Use ftrace on the top level call: "%s" (default: disabled)\n'\
6766 ' -maxdepth N limit the callgraph data to N call levels (default: 0=all)\n'\
6767 ' -expandcg pre-expand the callgraph data in the html output (default: disabled)\n'\
6768 ' -fadd file Add functions to be graphed in the timeline from a list in a text file\n'\
6769 ' -filter "d1,d2,..." Filter out all but this comma-delimited list of device names\n'\
6770 ' -mincg ms Discard all callgraphs shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6771 ' -cgphase P Only show callgraph data for phase P (e.g. suspend_late)\n'\
6772 ' -cgtest N Only show callgraph data for test N (e.g. 0 or 1 in an x2 run)\n'\
6773 ' -timeprec N Number of significant digits in timestamps (0:S, [3:ms], 6:us)\n'\
6774 ' -cgfilter S Filter the callgraph output in the timeline\n'\
6775 ' -cgskip file Callgraph functions to skip, off to disable (default: cgskip.txt)\n'\
6776 ' -bufsize N Set trace buffer size to N kilo-bytes (default: all of free memory)\n'\
6777 ' -devdump Print out all the raw device data for each phase\n'\
6778 ' -cgdump Print out all the raw callgraph data\n'\
6781 ' -modes List available suspend modes\n'\
6782 ' -status Test to see if the system is enabled to run this tool\n'\
6783 ' -fpdt Print out the contents of the ACPI Firmware Performance Data Table\n'\
6784 ' -wificheck Print out wifi connection info\n'\
6785 ' -x<mode> Test xset by toggling the given mode (on/off/standby/suspend)\n'\
6786 ' -sysinfo Print out system info extracted from BIOS\n'\
6787 ' -devinfo Print out the pm settings of all devices which support runtime suspend\n'\
6788 ' -cmdinfo Print out all the platform info collected before and after suspend/resume\n'\
6789 ' -flist Print the list of functions currently being captured in ftrace\n'\
6790 ' -flistall Print all functions capable of being captured in ftrace\n'\
6791 ' -summary dir Create a summary of tests in this dir [-genhtml builds missing html]\n'\
6793 ' -ftrace ftracefile Create HTML output using ftrace input (used with -dmesg)\n'\
6794 ' -dmesg dmesgfile Create HTML output using dmesg (used with -ftrace)\n'\
6798 # ----------------- MAIN --------------------
6803 simplecmds = ['-sysinfo', '-modes', '-fpdt', '-flist', '-flistall',
6804 '-devinfo', '-status', '-xon', '-xoff', '-xstandby', '-xsuspend',
6805 '-xinit', '-xreset', '-xstat', '-wificheck', '-cmdinfo']
6806 if '-f' in sys.argv:
6811 if(arg == '-m'):
6821 elif(arg == '-h'):
6824 elif(arg == '-v'):
6827 elif(arg == '-debugtiming'):
6829 elif(arg == '-x2'):
6831 elif(arg == '-x2delay'):
6832 sysvals.x2delay = getArgInt('-x2delay', args, 0, 60000)
6833 elif(arg == '-predelay'):
6834 sysvals.predelay = getArgInt('-predelay', args, 0, 60000)
6835 elif(arg == '-postdelay'):
6836 sysvals.postdelay = getArgInt('-postdelay', args, 0, 60000)
6837 elif(arg == '-f'):
6839 elif(arg == '-ftop'):
6843 elif(arg == '-skiphtml'):
6845 elif(arg == '-cgdump'):
6847 elif(arg == '-devdump'):
6849 elif(arg == '-genhtml'):
6851 elif(arg == '-addlogs'):
6853 elif(arg == '-nologs'):
6855 elif(arg == '-addlogdmesg'):
6857 elif(arg == '-addlogftrace'):
6859 elif(arg == '-noturbostat'):
6861 elif(arg == '-verbose'):
6863 elif(arg == '-proc'):
6865 elif(arg == '-dev'):
6867 elif(arg == '-sync'):
6869 elif(arg == '-wifi'):
6871 elif(arg == '-wifitrace'):
6873 elif(arg == '-netfix'):
6875 elif(arg == '-gzip'):
6877 elif(arg == '-info'):
6881 doError('-info requires one string argument', True)
6882 elif(arg == '-desc'):
6886 doError('-desc requires one string argument', True)
6887 elif(arg == '-rs'):
6891 doError('-rs requires "enable" or "disable"', True)
6894 sysvals.rs = -1
6899 elif(arg == '-display'):
6903 doError('-display requires an mode value', True)
6908 elif(arg == '-maxdepth'):
6909 sysvals.max_graph_depth = getArgInt('-maxdepth', args, 0, 1000)
6910 elif(arg == '-rtcwake'):
6919 sysvals.rtcwaketime = getArgInt('-rtcwake', val, 0, 3600, False)
6920 elif(arg == '-timeprec'):
6921 sysvals.setPrecision(getArgInt('-timeprec', args, 0, 6))
6922 elif(arg == '-mindev'):
6923 sysvals.mindevlen = getArgFloat('-mindev', args, 0.0, 10000.0)
6924 elif(arg == '-mincg'):
6925 sysvals.mincglen = getArgFloat('-mincg', args, 0.0, 10000.0)
6926 elif(arg == '-bufsize'):
6927 sysvals.bufsize = getArgInt('-bufsize', args, 1, 1024*1024*8)
6928 elif(arg == '-cgtest'):
6929 sysvals.cgtest = getArgInt('-cgtest', args, 0, 1)
6930 elif(arg == '-cgphase'):
6937 doError('invalid phase --> (%s: %s), valid phases are %s'\
6940 elif(arg == '-cgfilter'):
6946 elif(arg == '-skipkprobe'):
6952 elif(arg == '-cgskip'):
6963 elif(arg == '-callloop-maxgap'):
6964 sysvals.callloopmaxgap = getArgFloat('-callloop-maxgap', args, 0.0, 1.0)
6965 elif(arg == '-callloop-maxlen'):
6966 sysvals.callloopmaxlen = getArgFloat('-callloop-maxlen', args, 0.0, 1.0)
6967 elif(arg == '-cmd'):
6974 elif(arg == '-expandcg'):
6976 elif(arg == '-srgap'):
6978 elif(arg == '-maxfail'):
6979 sysvals.maxfail = getArgInt('-maxfail', args, 0, 1000000)
6980 elif(arg == '-multi'):
6984 doError('-multi requires two values', True)
6986 elif(arg == '-o'):
6992 elif(arg == '-config'):
7001 elif(arg == '-fadd'):
7010 elif(arg == '-dmesg'):
7019 elif(arg == '-ftrace'):
7028 elif(arg == '-summary'):
7038 elif(arg == '-filter'):
7044 elif(arg == '-result'):
7056 doError('-dev is not compatible with -f')
7058 doError('-proc is not compatible with -f')
7107 print('[%s - %s]\n%s\n' % out)
7110 # if instructed, re-analyze existing data files
7124 memmode = mode.split('-', 1)[-1] if '-' in mode else 'deep'
7133 if mode.startswith('disk-'):
7134 sysvals.diskmode = mode.split('-', 1)[-1]
7143 s = '-%dm' % sysvals.multitest['time']
7145 s = '-x%d' % sysvals.multitest['count']
7146 sysvals.outdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S'+s)
7158 fmt = 'suspend-%y%m%d-%H%M%S'