Lines Matching +full:event +full:- +full:touch +full:- +full:alt

2 # SPDX-License-Identifier: GPL-2.0-only
21 # https://01.org/pm-graph
23 # git@github.com:intel/pm-graph
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'],
306 [2, 'gpecounts', 'sh', '-c', 'grep -v invalid /sys/firmware/acpi/interrupts/*'],
307 [2, 'suspendstats', 'sh', '-c', 'grep -v invalid /sys/power/suspend_stats/*'],
308 …[2, 'cpuidle', 'sh', '-c', 'grep -v invalid /sys/devices/system/cpu/cpu*/cpuidle/state*/s2idle/*'],
309 [2, 'battery', 'sh', '-c', 'grep -v invalid /sys/class/power_supply/*/*'],
310 [2, 'thermal', 'sh', '-c', 'grep . /sys/class/thermal/thermal_zone*/temp'],
332 self.testdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S')
431 if 'baseboard-manufacturer' in info:
432 m = info['baseboard-manufacturer']
433 elif 'system-manufacturer' in info:
434 m = info['system-manufacturer']
435 if 'system-product-name' in info:
436 p = info['system-product-name']
437 elif 'baseboard-product-name' in info:
438 p = info['baseboard-product-name']
439 if m[:5].lower() == 'intel' and 'baseboard-product-name' in info:
440 p = info['baseboard-product-name']
441 c = info['processor-version'] if 'processor-version' in info else ''
442 b = info['bios-version'] if 'bios-version' in info else ''
443 r = info['bios-release-date'] if 'bios-release-date' in info else ''
453 fmt = '%-24s: %s'
455 print(fmt % ('os-version', self.osversion))
466 if re.match('^processor[ \t]*:[ \t]*[0-9]*', line):
471 m = re.match('^MemTotal:[ \t]*(?P<sz>[0-9]*) *kB', line)
474 m = re.match('^MemFree:[ \t]*(?P<sz>[0-9]*) *kB', line)
477 if os.path.exists('/etc/os-release'):
478 with open('/etc/os-release', 'r') as fp:
486 fmt = name+'-%m%d%y-%H%M%S'
541 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
555 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
661 if re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', func):
663 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', fmt):
678 # sort kprobes: trace, ub-dev, custom, dev
710 linesack = (len(check.split('\n')) - 1) // 2
803 tgtsize -= 65536
818 self.fsetVal('print-parent', 'trace_options')
819 self.fsetVal('funcgraph-abstime', 'trace_options')
820 self.fsetVal('funcgraph-cpu', 'trace_options')
821 self.fsetVal('funcgraph-duration', 'trace_options')
822 self.fsetVal('funcgraph-proc', 'trace_options')
823 self.fsetVal('funcgraph-tail', 'trace_options')
824 self.fsetVal('nofuncgraph-overhead', 'trace_options')
825 self.fsetVal('context-info', 'trace_options')
826 self.fsetVal('graph-time', 'trace_options')
904 cmd = 'chown -R {0}:{0} {1} > /dev/null 2>&1'
978 footer += '# platform-testcmd: %s\n' % (self.testcommand)
1002 dev = dirname.split('/')[-2]
1004 props[dev].syspath = dirname[:-6]
1045 footer += '# platform-devinfo: %s\n' % self.b64zip(out)
1049 footer += '# platform-%s: %s | %s\n' % (name, cmdline, self.b64zip(info))
1058 prefix = prefix[:len(prefix)-1]
1061 if '/' in prefix and prefix[-1] != '/':
1107 dinfo += '\t%s : %s -> %s\n' % \
1132 line = fp.read().strip().split('\n')[-1]
1133 m = re.match('.* (?P<v>[0-9A-Fx]*) .*', line)
1155 fp = Popen([cmd, '-v'], stdout=PIPE, stderr=PIPE).stderr
1165 fullcmd = '%s -q -S echo freeze > %s' % (cmd, self.powerfile)
1166 fp = Popen(['sh', '-c', fullcmd], stdout=PIPE, stderr=PIPE).stderr
1197 fp = Popen([cmd, '-s', net, 'on'], stdout=PIPE, stderr=PIPE).stdout
1209 vals.append(prop.split('=')[-1])
1217 m = re.match(' *(?P<dev>.*): (?P<stat>[0-9a-f]*) .*', line)
1224 while (time.time() - start) < timeout:
1228 (self.wifiDetails(dev), max(0, time.time() - start))
1246 if re.match('^[0-9,\-\.]*$', arr[j]):
1247 arr[j] = '[0-9,\-\.]*'
1273 dt = t - self.multitest['last']
1277 pprint('TEST (%s) COMPLETE -- Duration %.1fs' % (id, dt))
1283 left = finish - datetime.now()
1284 left -= timedelta(microseconds=left.microseconds)
1286 left = timedelta(seconds=((self.multitest['count'] - idx) * int(avg)))
1287 pprint('TEST (%s) START - Avg Duration %.1fs, Time left %s' % \
1292 sz, unit, c = 'time', c[-1], c[:-1]
1301 xset, ret = 'timeout 10 xset -d :0.0 {0}', 0
1303 xset = 'sudo -u %s %s' % (self.sudouser, xset)
1315 self.vprint('Display Switched: %s -> %s' % (b4, curr))
1347 # runtime suspend re-enable or re-disable
1424 # 10 sequential, non-overlapping phases of S/R
1466 'ACPI' : r'.*\bACPI *(?P<b>[A-Za-z]*) *Error[: ].*',
1468 'USBERR' : r'.*usb .*device .*, error [0-9-]*',
1469 'ATAERR' : r' *ata[0-9\.]*: .*failed.*',
1471 'TPMERR' : r'(?i) *tpm *tpm[0-9]*: .*error.*',
1479 self.tSuspended = 0.0 # low-level suspend start
1480 self.tResumed = 0.0 # low-level resume start
1500 self.tLow = [] # time spent in low-level suspends (standby/freeze)
1525 return plist[-1*depth]
1535 out['syslpi'] = i.split('=')[-1]+'%'
1537 out['pkgpc10'] = i.split('=')[-1]+'%'
1551 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
1618 # device target event is entirely inside the source boundary
1622 # thread target event will expand the source boundary
1644 threadname = 'kthread-%d' % (pid)
1646 threadname = '%s-%d' % (proc, pid)
1652 sysvals.vprint('[%f - %f] %s-%d %s %s %s' % \
1699 o = min(dev['end'], tdev['end']) - max(dev['start'], tdev['start'])
1713 if tdev['start'] - dev['end'] < 0.1:
1722 # merge any threads between tests that touch
1740 for e in sorted(src, key=lambda event: event.time):
1746 p.length = p.end - p.time
1752 if(t - dT < t0):
1754 return t - dT
1780 d['length'] = d['end'] - d['start']
1791 e.length = e.end - e.time
1813 tL = tR - tS
1832 stime = (self.tSuspended - self.start) * 1000000
1833 rtime = (self.end - self.tResumed) * 1000000
1835 hwr = self.hwend - timedelta(microseconds=rtime)
1836 self.tLow.append('%.0f'%((hwr - hws).total_seconds() * 1000))
1838 sktime = (self.tSuspended - self.tKernSus) * 1000
1839 rktime = (self.tKernRes - self.tResumed) * 1000
1841 def setPhase(self, phase, ktime, isbegin, order=-1):
1854 self.dmesg[phase] = {'list': dict(), 'start': -1.0, 'end': -1.0,
1917 def newActionGlobal(self, name, start, end, pid=-1, color=''):
1928 o = max(0, min(end, pend) - max(start, pstart))
1943 targetphase = phases[-1]
1944 if pid == -2:
1946 elif pid == -3:
1960 length = -1.0
1962 length = end - start
1963 if pid == -2 or name not in sysvals.tracefuncs.keys():
1980 if name == devname or re.match('^%s\[(?P<num>[0-9]*)\]$' % name, devname):
2012 sysvals.vprint('%20s: %f - %f (%d devices)' % (phase, ps, pe, dc))
2014 sysvals.vprint(''.join('-' for i in range(80)))
2016 fmt = '%3d) %'+maxname+'s - %f - %f'
2023 sysvals.vprint(''.join('-' for i in range(80)))
2056 info += ('<li>%s: %.3fms</li>' % (phase, (e-s)*1000))
2075 # list of top-most root devices
2082 if(pid < 0 or re.match('[0-9]*-[0-9]*\.[0-9]*[\.0-9]*\:[\.0-9]*$', pdev)):
2098 length = (list[dev]['end'] - list[dev]['start']) * 1000
2099 width = widfmt % (((list[dev]['end']-list[dev]['start'])*100)/tTotal)
2105 self.newAction(phase, devname, -2, '', \
2115 tlast = start = end = -1
2124 maxj = (t - tlast) * 1024.0
2130 out = self.newActionGlobal(name, start, end, -3)
2173 m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
2176 m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
2179 m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) calling '+\
2185 m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: PM: '+\
2186 '.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line)
2188 m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) .* (?P<f>.*)\: '+\
2189 '.* returned (?P<r>[0-9]*) after (?P<dt>[0-9]*) usecs', line)
2191 m = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) call '+\
2216 self.length = end - start
2228 title = '%s(%s)%s <- %s, %s(%s)' % \
2241 dt = self.time - tgt.end
2242 # only combine calls if -all- attributes are identical
2259 # trace event:
2276 # is this a trace event
2279 # nop format trace event
2282 # function_graph format trace event
2327 if(m[-1] == '{'):
2332 elif(m[-1] == ';'):
2350 pprint(' -- %12.6f (depth=%02d): %s(); (%.3f us) %s' % (self.time, \
2353 pprint(' -- %12.6f (depth=%02d): %s} (%.3f us) %s' % (self.time, \
2356 pprint(' -- %12.6f (depth=%02d): %s() { (%.3f us) %s' % (self.time, \
2399 self.start = -1.0
2400 self.end = -1.0
2420 self.list[-1].freturn = True
2421 self.list[-1].length = line.time - self.list[-1].time
2429 # compare current depth with this lines pre-call depth
2436 last = self.list[-1]
2441 mismatch = prelinedep - self.depth
2448 self.depth -= 1
2453 last.length = line.time - last.time
2479 prelinedep -= 1
2507 if (md and self.depth >= md - 1) or (line.name in self.sv.cgblacklist):
2512 self.depth -= 1
2517 while len(self.list) > 0 and self.list[-1].depth > line.depth:
2518 self.list.pop(-1)
2522 self.list[-1].freturn = True
2523 self.list[-1].length = line.time - self.list[-1].time
2524 self.list[-1].name = line.name
2530 if mismatch < 0 and self.list[-1].depth == 0 and self.list[-1].freturn:
2531 line = self.list[-1]
2533 res = -1
2544 if res == -1:
2555 window = '(%f - %f)' % (self.start, line.time)
2565 mydepth = -1
2577 l.depth -= mydepth
2585 last = self.list[-1]
2605 if last.length > l.time - last.time:
2606 last.length = l.time - last.time
2618 cl.length = l.time - cl.time
2623 cnt -= 1
2684 out = data.newActionGlobal(name, fs, fe, -2)
2689 pprint('%s pid=%d [%f - %f] %.3f us' % \
2691 (self.end - self.start)*1000000))
2736 self.html += '<div class="version"><a href="https://01.org/pm-graph">%s v%s</a></div>' \
2763 item.row = -1
2789 remaining -= 1
2806 # initialize all device rows to -1 and calculate devrows
2812 dev['row'] = -1
2815 sortdict[item] = (-1*float(dev['start']), float(dev['end']) - float(dev['start']))
2818 sortdict[item] = (float(dev['end']) - float(dev['start']), item.dev['name'])
2825 if item.dev['pid'] == -2:
2851 remaining -= 1
2896 self.bodyH = self.height - self.scaleH
2903 …html_zoombox = '<center><button id="zoomin">ZOOM IN +</button><button id="zoomout">ZOOM OUT -</but…
2927 rline = '<div class="t" style="left:0;border-left:1px solid black;border-right:0;">{0}</div>\n'
2930 mTotal = mMax - m0
2937 divEdge = (mTotal - tS*(divTotal-1))*100/mTotal
2941 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal) - divEdge)
2942 val = '%0.fms' % (float(i-divTotal+1)*tS*1000)
2943 if(i == divTotal - 1):
2947 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal))
2959 stampfmt = '# [a-z]*-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\
2960 '(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\
2962 wififmt = '^# wifi *(?P<d>\S*) *(?P<s>\S*) *(?P<t>[0-9\.]+).*'
2969 pinfofmt = '# platform-(?P<val>[a-z,A-Z,0-9,_]*): (?P<info>.*)'
2971 firmwarefmt = '# fwsuspend (?P<s>[0-9]*) fwresume (?P<r>[0-9]*)$'
2972 procexecfmt = 'ps - (?P<ps>.*)$'
2973 procmultifmt = '@(?P<n>[0-9]*)\|(?P<ps>.*)$'
2975 '^ *(?P<time>[0-9\.]*) *\| *(?P<cpu>[0-9]*)\)'+\
2976 ' *(?P<proc>.*)-(?P<pid>[0-9]*) *\|'+\
2977 '[ +!#\*@$]*(?P<dur>[0-9\.]*) .*\| (?P<msg>.*)'
2979 ' *(?P<proc>.*)-(?P<pid>[0-9]*) *\[(?P<cpu>[0-9]*)\] *'+\
2980 '(?P<flags>\S*) *(?P<time>[0-9\.]*): *'+\
3161 c = ['cat /proc/[1-9]*/stat 2>/dev/null']
3175 ujiff = user - val['user']
3176 kjiff = kern - val['kern']
3186 if len(out[-1]) > self.maxchars:
3188 elif len(out[-1]) > 0:
3189 out[-1] += ','
3190 out[-1] += '%s-%s %d' % (val['name'], pid, jiffies)
3193 sysvals.fsetVal('ps - @%d|%s' % (len(out), line), 'trace_marker')
3195 sysvals.fsetVal('ps - %s' % out[0], 'trace_marker')
3206 # ----------------- FUNCTIONS --------------------
3242 # Adds callgraph data which lacks trace event data. This is only
3282 # the line should be a call, return, or event
3300 # trace event processing
3310 cg = testrun[testidx].ftemp[pid][-1]
3314 if(res == -1):
3315 testrun[testidx].ftemp[pid][-1].addLine(t)
3322 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3372 # we only care about trace event ordering
3434 # the line should be a call, return, or event
3472 name = val[0].replace('--', '-')
3487 # the event we used to trigger resume end
3490 testrun.ttemp['thaw_processes'][-1]['end'] = t.time
3493 # trace event processing
3511 # -- phase changes --
3551 t.time - data.dmesg[lp]['start']
3599 testrun.ttemp[name][-1]['end'] = t.time
3600 testrun.ttemp[name][-1]['loop'] += 1
3613 testrun.ttemp[name][-1]['end'] = t.time
3626 data.newAction(phase, n, pid, p, t.time, -1, drv)
3639 dev['length'] = t.time - dev['start']
3641 # kprobe event processing
3657 'end': -1,
3672 if (t.time - e['begin']) * 1000 < sysvals.mindevlen:
3691 cg = testrun.ftemp[key][-1]
3695 if(res == -1):
3696 testrun.ftemp[key][-1].addLine(t)
3733 if i < len(testruns) - 1:
3742 for event in test.ttemp[name]:
3743 if event['end'] - event['begin'] <= 0:
3746 if name == 'machine_suspend' and 'loop' in event:
3747 title = 's2idle_enter_%dx' % event['loop']
3748 data.newActionGlobal(title, event['begin'], event['end'], event['pid'])
3758 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3770 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3780 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3802 …sysvals.vprint('Callgraph found for task %d: %.3fms, %s' % (cg.pid, (cg.end - cg.start)*1000, name…
3856 for i in range(tc - 1):
3876 tp.stamp = datetime.now().strftime('# suspend-%m%d%y-%H%M%S localhost mem unknown')
3887 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
3899 m = re.match('.* *(?P<k>[0-9]\.[0-9]{2}\.[0-9]-.*) .*', msg)
3955 'suspend': ['PM: Entering [a-z]* sleep.*', 'Suspending console.*',
3961 'suspend_machine': ['PM: suspend-to-idle',
3965 'ACPI: Low-level resume complete.*',
3967 'Suspended for [0-9\.]* seconds'],
3968 'resume_noirq': ['PM: resume from suspend-to-idle',
3989 'emsg': 'PM: Entering (?P<mode>[a-z,A-Z]*) sleep.*' },
3995 'emsg': 'Disabling non-boot CPUs .*' },
3998 t0 = -1.0
3999 cpu_start = -1.0
4000 prevktime = -1.0
4004 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
4101 # -- device callbacks --
4106 data.newAction(phase, f, int(n), p, ktime, -1, '')
4127 actions[a][-1]['end'] = ktime
4129 if(re.match('Disabling non-boot CPUs .*', msg)):
4132 elif(re.match('Enabling non-boot CPUs .*', msg)):
4135 elif(re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)):
4137 m = re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)
4143 elif(re.match('CPU(?P<cpu>[0-9]*) is up', msg)):
4145 m = re.match('CPU(?P<cpu>[0-9]*) is up', msg)
4182 for event in actions[name]:
4183 data.newActionGlobal(name, event['begin'], event['end'])
4199 cglen = (cg.end - cg.start) * 1000
4262 tdcenter = 'text-align:center;' if center else ''
4264 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4267 ….stamp {width: 100%;text-align:center;background:#888;line-height:30px;color:white;font: 25px Aria…
4268 table {width:100%;border-collapse: collapse;border:1px solid;}\n\
4272 tr.alt {background-color:#ddd;}\n\
4274 .minval {background-color:#BBFFBB;}\n\
4275 .medval {background-color:#BBBBFF;}\n\
4276 .maxval {background-color:#FFBBBB;}\n\
4277 .head a {color:#000;text-decoration: none;}\n\
4288 html = summaryCSS('Summary - SleepGraph')
4325 idx = len(list[mode]['data']) - 1
4410 iMin = iMed = iMax = [-1, -1, -1]
4413 # row classes - alternate row color
4414 rcls = ['alt'] if num % 2 == 1 else []
4457 html = summaryCSS('Device Summary - SleepGraph', False)
4503 # row classes - alternate row color
4504 rcls = ['alt'] if num % 2 == 1 else []
4524 html = summaryCSS('Issues Summary - SleepGraph', False)
4547 # row classes - alternate row color
4548 rcls = ['alt'] if num % 2 == 1 else []
4594 data.trimFreezeTime(testruns[-1].tSuspended)
4600 …lass="traceevent{6}" style="left:{1}%;top:{2}px;height:{3}px;width:{4}%;line-height:{3}px;{7}">{5}…
4608 …'<td class="gray" title="time spent in low-power mode with clock running">'+sysvals.suspendmode+' …
4633 tTotal = data.end - data.start
4657 rtot += data.end - data.tKernRes + (data.wifi['time'] * 1000.0)
4689 wtime = '%.0f ms'%(data.end - data.tKernRes + (data.wifi['time'] * 1000.0))
4700 tMax = testruns[-1].end
4701 tTotal = tMax - t0
4734 d = testruns[0].addHorizontalDivider(msg, testruns[-1].end)
4738 d = testruns[0].addHorizontalDivider('asynchronous kernel threads', testruns[-1].end)
4760 left = '%f' % (((m0-t0)*100.0)/tTotal)
4767 left = '%f' % ((((m0-t0)*100.0)+sysvals.srgap/2)/tTotal)
4768 mTotal = mMax - m0
4772 width = '%f' % (((mTotal*100.0)-sysvals.srgap/2)/tTotal)
4777 length = phase['end']-phase['start']
4778 left = '%f' % (((phase['start']-m0)*100.0)/mTotal)
4787 right = '%f' % (((mMax-t)*100.0)/mTotal)
4811 left = '%f' % (((dev['start']-m0)*100)/mTotal)
4812 width = '%f' % (((dev['end']-dev['start'])*100)/mTotal)
4813 length = ' (%0.3f ms) ' % ((dev['end']-dev['start'])*1000)
4832 left = '%f' % (((start-m0)*100)/mTotal)
4833 width = '%f' % ((end-start)*100/mTotal)
4845 left = '%f' % (((e.time-m0)*100)/mTotal)
4862 phasedef = testruns[-1].phasedef
4885 pscolor = 'linear-gradient(to top left, #ccc, #eee)'
4890 length = phase['end']-phase['start']
4891 left = '%.3f' % (((phase['start']-t0)*100.0)/tTotal)
4906 data = testruns[-1]
4952 hoverZ = 'z-index:8;'
4966 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4969 body {overflow-y:scroll;}\n\
4970 ….stamp {width:100%;text-align:center;background:gray;line-height:30px;color:white;font:25px Arial;…
4972 .callgraph {margin-top:30px;box-shadow:5px 5px 20px black;}\n\
4973 .callgraph article * {padding-left:28px;}\n\
4978 t3 {color:black;font:20px Times;white-space:nowrap;}\n\
4979 t4 {color:black;font:bold 30px Times;line-height:60px;white-space:nowrap;}\n\
4988 .time2 {font:15px Arial;border-bottom:1px solid;border-left:1px solid;border-right:1px solid;}\n\
4990 td {text-align:center;}\n\
4996-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:black;stroke-width:0"…
4997 …troke="black" stroke-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:b…
4998 .pf:'+cgchk+' ~ *:not(:nth-child(2)) {display:none;}\n\
4999 …oombox {position:relative;width:100%;overflow-x:scroll;-webkit-user-select:none;-moz-user-select:n…
5000 ….timeline {position:relative;font-size:14px;cursor:pointer;width:100%; overflow:hidden;background:…
5001 …bsolute;height:0%;overflow:hidden;z-index:7;line-height:30px;font-size:14px;border:1px solid;text-
5002 .thread.ps {border-radius:3px;background:linear-gradient(to top, #ccc, #eee);}\n\
5004 ….thread.sec,.thread.sec:hover {background:black;border:0;color:white;line-height:15px;font-size:10…
5008 .jiffie {position:absolute;pointer-events: none;z-index:8;}\n\
5009 …font-size:10px;z-index:7;overflow:hidden;color:black;text-align:center;white-space:nowrap;border-r…
5010 .traceevent:hover {color:white;font-weight:bold;border:1px solid white;}\n\
5011 .phase {position:absolute;overflow:hidden;border:0px;text-align:center;}\n\
5012 ….phaselet {float:left;overflow:hidden;border:0px;text-align:center;min-height:100px;font-size:24px…
5013 ….t {position:absolute;line-height:'+('%d'%scaleTH)+'px;pointer-events:none;top:0;height:100%;borde…
5014 …err {position:absolute;top:0%;height:100%;border-right:3px solid red;color:red;font:bold 14px Time…
5015 .legend {position:relative; width:100%; height:40px; text-align:center;margin-bottom:20px}\n\
5016 …ion:absolute;cursor:pointer;top:10px; width:0px;height:20px;border:1px solid;padding-left:20px;}\n\
5017 button {height:40px;width:200px;margin-bottom:20px;margin-top:20px;font-size:24px;}\n\
5018 …ion:relative;float:right;height:25px;width:auto;margin-top:3px;margin-bottom:0;font-size:10px;text
5020 a:link {color:white;text-decoration:none;}\n\
5024 ….version {position:relative;float:left;color:white;font-size:10px;line-height:30px;margin-left:10p…
5025 #devicedetail {min-height:100px;box-shadow:5px 5px 20px black;}\n\
5027 .tback {position:absolute;width:100%;background:linear-gradient(#ccc, #ddd);}\n\
5028 .bg {z-index:1;}\n\
5041 tMax = testruns[-1].end * 1000
5051 ' var resolution = -1;\n'\
5054 ' var rline = \'<div class="t" style="left:0;border-left:1px solid black;border-right:0;">\';\n'\
5055 ' var tTotal = tMax - t0;\n'\
5065 ' var divEdge = (mTotal - tS*(divTotal-1))*100/mTotal;\n'\
5071 ' pos = 100 - (((j)*tS*100)/mTotal) - divEdge;\n'\
5072 ' val = (j-divTotal+1)*tS;\n'\
5073 ' if(j == divTotal - 1)\n'\
5078 ' pos = 100 - (((j)*tS*100)/mTotal);\n'\
5103 ' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\
5108 ' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\
5116 ' var tTotal = tMax - t0;\n'\
5120 ' if(i >= tS.length) i = tS.length - 1;\n'\
5133 ' var cpu = -1;\n'\
5134 ' if(name.match("CPU_ON\[[0-9]*\]"))\n'\
5136 ' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\
5188 ' var cpu = -1;\n'\
5189 ' if(name.match("CPU_ON\[[0-9]*\]"))\n'\
5191 ' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\
5217 ' var pname = info[info.length-1];\n'\
5218 ' pd[pname] = parseFloat(info[info.length-3].slice(1));\n'\
5242 ' var time = "<t4 style=\\"font-size:"+fs+"px\\">"+pd[phases[i].id]+" ms<br></t4>";\n'\
5243 …' var pname = "<t3 style=\\"font-size:"+fs2+"px\\">"+phases[i].id.replace(new RegExp("_", "g")…
5271 ' var name = tmp[0], phase = tmp[tmp.length-1];\n'\
5291 ' var html = \'<div style="padding-top:\'+pad+\'px"><t3> <b>\'+name+\':</b>\';\n'\
5300 …' html += \'<table class=fstat style="padding-top:\'+(maxlen*5)+\'px;"><tr><th>Function</th>\';\…
5335 ' " ul {list-style-type:circle;padding-left:10px;margin-left:10px;}"+\n'\
5379 ' zoombox.scrollLeft = dragval[1] + dragval[0] - e.clientX;\n'\
5568 return os.readlink(file).split('/')[-1]
5602 '---------------------------------------------------------------------------------------------\n'\
5607 '---------------------------------------------------------------------------------------------\n'\
5609 '---------------------------------------------------------------------------------------------')
5620 dirname = dirname[:-6]
5621 device = dirname.split('/')[-1]
5641 lines[dirname] = '%-26s %-26s %1s %1s %1s %1s %1s %10s %10s' % \
5673 modes.append('mem-%s' % memmode)
5680 modes.append('disk-%s' % m.strip('[]'))
5697 'bios-vendor': (0, 4),
5698 'bios-version': (0, 5),
5699 'bios-release-date': (0, 8),
5700 'system-manufacturer': (1, 4),
5701 'system-product-name': (1, 5),
5702 'system-version': (1, 6),
5703 'system-serial-number': (1, 7),
5704 'baseboard-manufacturer': (2, 4),
5705 'baseboard-product-name': (2, 5),
5706 'baseboard-version': (2, 6),
5707 'baseboard-serial-number': (2, 7),
5708 'chassis-manufacturer': (3, 4),
5709 'chassis-type': (3, 5),
5710 'chassis-version': (3, 6),
5711 'chassis-serial-number': (3, 7),
5712 'processor-manufacturer': (4, 7),
5713 'processor-version': (4, 16),
5757 if buf[i:i+4] == b'_SM_' and i < memsize - 16:
5787 while(count < num and i <= len(buf) - 4):
5790 while n < len(buf) - 1:
5799 if idx > 0 and idx < len(data) - 1:
5800 s = data[idx-1].decode('utf-8')
5896 recdata = fp.read(rechead[1]-8)
5928 fwData[0] = record[1] - record[0]
5983 pprint(' please choose one with -m')
5993 status = efmt.format('-f')
5995 status = efmt.format('-dev')
5997 status = efmt.format('-proc')
6081 doError(name+': non-integer value given', True)
6100 doError(name+': non-numerical value given', True)
6130 sysvals.vprint(' %-8s : %s' % (key.upper(), sysvals.stamp[key]))
6146 sysvals.vprint('[%s - %s]' % (info[0], info[1]))
6244 num = re.search(r'[-+]?\d*\.\d+|\d+', str)
6272 m = re.match('[a-z0-9]* failed in (?P<p>\S*).*', error)
6316 m = re.match('.*waking *(?P<n>[0-9]*) *times.*', low)
6334 m = re.match(' *<div id=\"[a,0-9]*\" *title=\"(?P<title>.*)\" class=\"thread.*', line)
6337 m = re.match('(?P<n>.*) \((?P<t>[0-9,\.]*) ms\) (?P<p>.*)', m.group('title'))
6344 name = ' '.join(name.split(' ')[:-1])
6386 for arg in ['-multi ', '-info ']:
6412 # create a summary of tests in a sub-directory
6442 pprint(' summary.html - tabular list of test data found')
6443 createHTMLDeviceSummary(testruns, os.path.join(outpath, 'summary-devices.html'), title)
6444 pprint(' summary-devices.html - kernel device list sorted by total execution time')
6445 createHTMLIssuesSummary(testruns, issues, os.path.join(outpath, 'summary-issues.html'), title)
6446 pprint(' summary-issues.html - kernel issues found sorted by frequency')
6456 doError('invalid boolean --> (%s: %s), use "true/false" or "1/0"' % (name, value), True)
6486 elif(option == 'override-timeline-functions'):
6488 elif(option == 'override-dev-timeline-functions'):
6497 sysvals.rs = -1
6501 doError('invalid value --> (%s: %s), use "enable/disable"' % (option, value), True)
6505 doError('invalid value --> (%s: %s), use %s' % (option, value, disopt), True)
6523 doError('invalid phase --> (%s: %s), valid phases are %s'\
6567 elif(option == 'callloop-maxgap'):
6568 sysvals.callloopmaxgap = getArgFloat('callloop-maxgap', value, 0.0, 1.0, False)
6569 elif(option == 'callloop-maxlen'):
6570 sysvals.callloopmaxgap = getArgFloat('callloop-maxlen', value, 0.0, 1.0, False)
6575 elif(option == 'output-dir'):
6583 doError('-dev is not compatible with -f')
6585 doError('-proc is not compatible with -f')
6616 if val[0] == '[' and val[-1] == ']':
6617 for prop in val[1:-1].split(','):
6636 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', format):
6674 ' Generates output files in subdirectory: suspend-yymmdd-HHMMSS\n'\
6680 ' -h Print this help text\n'\
6681 ' -v Print the current tool version\n'\
6682 ' -config fn Pull arguments and config options from file fn\n'\
6683 ' -verbose Print extra information during execution and analysis\n'\
6684 ' -m mode Mode to initiate for suspend (default: %s)\n'\
6685 ' -o name Overrides the output subdirectory name when running a new test\n'\
6686 ' default: suspend-{date}-{time}\n'\
6687 ' -rtcwake t Wakeup t seconds after suspend, set t to "off" to disable (default: 15)\n'\
6688 ' -addlogs Add the dmesg and ftrace logs to the html output\n'\
6689 ' -noturbostat Dont use turbostat in freeze mode (default: disabled)\n'\
6690 ' -srgap Add a visible gap in the timeline between sus/res (default: disabled)\n'\
6691 …' -skiphtml Run the test and capture the trace logs, but skip the timeline (default: disabled…
6692 ' -result fn Export a results table to a text file for parsing.\n'\
6693 ' -wifi If a wifi connection is available, check that it reconnects after resume.\n'\
6694 ' -wifitrace Trace kernel execution through wifi reconnect.\n'\
6695 ' -netfix Use netfix to reset the network in the event it fails to resume.\n'\
6697 ' -sync Sync the filesystems before starting the test\n'\
6698 ' -rs on/off Enable/disable runtime suspend for all devices, restore all after test\n'\
6699 ' -display m Change the display mode to m for the test (on/off/standby/suspend)\n'\
6701 ' -gzip Gzip the trace and dmesg logs to save space\n'\
6702 ' -cmd {s} Run the timeline over a custom command, e.g. "sync -d"\n'\
6703 ' -proc Add usermode process info into the timeline (default: disabled)\n'\
6704 ' -dev Add kernel function calls and threads to the timeline (default: disabled)\n'\
6705 ' -x2 Run two suspend/resumes back to back (default: disabled)\n'\
6706 ' -x2delay t Include t ms delay between multiple test runs (default: 0 ms)\n'\
6707 ' -predelay t Include t ms delay before 1st suspend (default: 0 ms)\n'\
6708 ' -postdelay t Include t ms delay after last resume (default: 0 ms)\n'\
6709 ' -mindev ms Discard all device blocks shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6710 ' -multi n d Execute <n> consecutive tests at <d> seconds intervals. If <n> is followed\n'\
6713 ' -maxfail n Abort a -multi run after n consecutive fails (default is 0 = never abort)\n'\
6715 ' -f Use ftrace to create device callgraphs (default: disabled)\n'\
6716 ' -ftop Use ftrace on the top level call: "%s" (default: disabled)\n'\
6717 ' -maxdepth N limit the callgraph data to N call levels (default: 0=all)\n'\
6718 ' -expandcg pre-expand the callgraph data in the html output (default: disabled)\n'\
6719 ' -fadd file Add functions to be graphed in the timeline from a list in a text file\n'\
6720 ' -filter "d1,d2,..." Filter out all but this comma-delimited list of device names\n'\
6721 ' -mincg ms Discard all callgraphs shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6722 ' -cgphase P Only show callgraph data for phase P (e.g. suspend_late)\n'\
6723 ' -cgtest N Only show callgraph data for test N (e.g. 0 or 1 in an x2 run)\n'\
6724 ' -timeprec N Number of significant digits in timestamps (0:S, [3:ms], 6:us)\n'\
6725 ' -cgfilter S Filter the callgraph output in the timeline\n'\
6726 ' -cgskip file Callgraph functions to skip, off to disable (default: cgskip.txt)\n'\
6727 ' -bufsize N Set trace buffer size to N kilo-bytes (default: all of free memory)\n'\
6728 ' -devdump Print out all the raw device data for each phase\n'\
6729 ' -cgdump Print out all the raw callgraph data\n'\
6732 ' -modes List available suspend modes\n'\
6733 ' -status Test to see if the system is enabled to run this tool\n'\
6734 ' -fpdt Print out the contents of the ACPI Firmware Performance Data Table\n'\
6735 ' -wificheck Print out wifi connection info\n'\
6736 ' -x<mode> Test xset by toggling the given mode (on/off/standby/suspend)\n'\
6737 ' -sysinfo Print out system info extracted from BIOS\n'\
6738 ' -devinfo Print out the pm settings of all devices which support runtime suspend\n'\
6739 ' -cmdinfo Print out all the platform info collected before and after suspend/resume\n'\
6740 ' -flist Print the list of functions currently being captured in ftrace\n'\
6741 ' -flistall Print all functions capable of being captured in ftrace\n'\
6742 ' -summary dir Create a summary of tests in this dir [-genhtml builds missing html]\n'\
6744 ' -ftrace ftracefile Create HTML output using ftrace input (used with -dmesg)\n'\
6745 ' -dmesg dmesgfile Create HTML output using dmesg (used with -ftrace)\n'\
6749 # ----------------- MAIN --------------------
6754 simplecmds = ['-sysinfo', '-modes', '-fpdt', '-flist', '-flistall',
6755 '-devinfo', '-status', '-xon', '-xoff', '-xstandby', '-xsuspend',
6756 '-xinit', '-xreset', '-xstat', '-wificheck', '-cmdinfo']
6757 if '-f' in sys.argv:
6762 if(arg == '-m'):
6772 elif(arg == '-h'):
6775 elif(arg == '-v'):
6778 elif(arg == '-debugtiming'):
6780 elif(arg == '-x2'):
6782 elif(arg == '-x2delay'):
6783 sysvals.x2delay = getArgInt('-x2delay', args, 0, 60000)
6784 elif(arg == '-predelay'):
6785 sysvals.predelay = getArgInt('-predelay', args, 0, 60000)
6786 elif(arg == '-postdelay'):
6787 sysvals.postdelay = getArgInt('-postdelay', args, 0, 60000)
6788 elif(arg == '-f'):
6790 elif(arg == '-ftop'):
6794 elif(arg == '-skiphtml'):
6796 elif(arg == '-cgdump'):
6798 elif(arg == '-devdump'):
6800 elif(arg == '-genhtml'):
6802 elif(arg == '-addlogs'):
6804 elif(arg == '-nologs'):
6806 elif(arg == '-addlogdmesg'):
6808 elif(arg == '-addlogftrace'):
6810 elif(arg == '-noturbostat'):
6812 elif(arg == '-verbose'):
6814 elif(arg == '-proc'):
6816 elif(arg == '-dev'):
6818 elif(arg == '-sync'):
6820 elif(arg == '-wifi'):
6822 elif(arg == '-wifitrace'):
6824 elif(arg == '-netfix'):
6826 elif(arg == '-gzip'):
6828 elif(arg == '-info'):
6832 doError('-info requires one string argument', True)
6833 elif(arg == '-desc'):
6837 doError('-desc requires one string argument', True)
6838 elif(arg == '-rs'):
6842 doError('-rs requires "enable" or "disable"', True)
6845 sysvals.rs = -1
6850 elif(arg == '-display'):
6854 doError('-display requires an mode value', True)
6859 elif(arg == '-maxdepth'):
6860 sysvals.max_graph_depth = getArgInt('-maxdepth', args, 0, 1000)
6861 elif(arg == '-rtcwake'):
6870 sysvals.rtcwaketime = getArgInt('-rtcwake', val, 0, 3600, False)
6871 elif(arg == '-timeprec'):
6872 sysvals.setPrecision(getArgInt('-timeprec', args, 0, 6))
6873 elif(arg == '-mindev'):
6874 sysvals.mindevlen = getArgFloat('-mindev', args, 0.0, 10000.0)
6875 elif(arg == '-mincg'):
6876 sysvals.mincglen = getArgFloat('-mincg', args, 0.0, 10000.0)
6877 elif(arg == '-bufsize'):
6878 sysvals.bufsize = getArgInt('-bufsize', args, 1, 1024*1024*8)
6879 elif(arg == '-cgtest'):
6880 sysvals.cgtest = getArgInt('-cgtest', args, 0, 1)
6881 elif(arg == '-cgphase'):
6888 doError('invalid phase --> (%s: %s), valid phases are %s'\
6891 elif(arg == '-cgfilter'):
6897 elif(arg == '-skipkprobe'):
6903 elif(arg == '-cgskip'):
6914 elif(arg == '-callloop-maxgap'):
6915 sysvals.callloopmaxgap = getArgFloat('-callloop-maxgap', args, 0.0, 1.0)
6916 elif(arg == '-callloop-maxlen'):
6917 sysvals.callloopmaxlen = getArgFloat('-callloop-maxlen', args, 0.0, 1.0)
6918 elif(arg == '-cmd'):
6925 elif(arg == '-expandcg'):
6927 elif(arg == '-srgap'):
6929 elif(arg == '-maxfail'):
6930 sysvals.maxfail = getArgInt('-maxfail', args, 0, 1000000)
6931 elif(arg == '-multi'):
6935 doError('-multi requires two values', True)
6937 elif(arg == '-o'):
6943 elif(arg == '-config'):
6952 elif(arg == '-fadd'):
6961 elif(arg == '-dmesg'):
6970 elif(arg == '-ftrace'):
6979 elif(arg == '-summary'):
6989 elif(arg == '-filter'):
6995 elif(arg == '-result'):
7007 doError('-dev is not compatible with -f')
7009 doError('-proc is not compatible with -f')
7058 print('[%s - %s]\n%s\n' % out)
7061 # if instructed, re-analyze existing data files
7075 memmode = mode.split('-', 1)[-1] if '-' in mode else 'deep'
7084 if mode.startswith('disk-'):
7085 sysvals.diskmode = mode.split('-', 1)[-1]
7094 s = '-%dm' % sysvals.multitest['time']
7096 s = '-x%d' % sysvals.multitest['count']
7097 sysvals.outdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S'+s)
7109 fmt = 'suspend-%y%m%d-%H%M%S'