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 --------------------
76 # ----------------- CLASSES --------------------
80 # A global, single-instance container used to
99 cgtest = -1
169 tmstart = 'SUSPEND START %Y%m%d-%H:%M:%S.%f'
170 tmend = 'RESUME COMPLETE %Y%m%d-%H:%M:%S.%f'
282 [0, 'pcidevices', 'lspci', '-tv'],
283 [0, 'usbdevices', 'lsusb', '-t'],
286 [2, 'gpecounts', 'sh', '-c', 'grep -v invalid /sys/firmware/acpi/interrupts/*'],
287 [2, 'suspendstats', 'sh', '-c', 'grep -v invalid /sys/power/suspend_stats/*'],
288 …[2, 'cpuidle', 'sh', '-c', 'grep -v invalid /sys/devices/system/cpu/cpu*/cpuidle/state*/s2idle/*'],
289 [2, 'battery', 'sh', '-c', 'grep -v invalid /sys/class/power_supply/*/*'],
311 self.testdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S')
399 if 'baseboard-manufacturer' in info:
400 m = info['baseboard-manufacturer']
401 elif 'system-manufacturer' in info:
402 m = info['system-manufacturer']
403 if 'system-product-name' in info:
404 p = info['system-product-name']
405 elif 'baseboard-product-name' in info:
406 p = info['baseboard-product-name']
407 if m[:5].lower() == 'intel' and 'baseboard-product-name' in info:
408 p = info['baseboard-product-name']
409 c = info['processor-version'] if 'processor-version' in info else ''
410 b = info['bios-version'] if 'bios-version' in info else ''
411 r = info['bios-release-date'] if 'bios-release-date' in info else ''
419 fmt = '%-24s: %s'
429 if re.match('^processor[ \t]*:[ \t]*[0-9]*', line):
434 m = re.match('^MemTotal:[ \t]*(?P<sz>[0-9]*) *kB', line)
437 m = re.match('^MemFree:[ \t]*(?P<sz>[0-9]*) *kB', line)
445 fmt = name+'-%m%d%y-%H%M%S'
500 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
514 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
620 if re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', func):
622 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', fmt):
637 # sort kprobes: trace, ub-dev, custom, dev
669 linesack = (len(check.split('\n')) - 1) // 2
763 tgtsize -= 65536
774 self.fsetVal('print-parent', 'trace_options')
775 self.fsetVal('funcgraph-abstime', 'trace_options')
776 self.fsetVal('funcgraph-cpu', 'trace_options')
777 self.fsetVal('funcgraph-duration', 'trace_options')
778 self.fsetVal('funcgraph-proc', 'trace_options')
779 self.fsetVal('funcgraph-tail', 'trace_options')
780 self.fsetVal('nofuncgraph-overhead', 'trace_options')
781 self.fsetVal('context-info', 'trace_options')
782 self.fsetVal('graph-time', 'trace_options')
858 cmd = 'chown -R {0}:{0} {1} > /dev/null 2>&1'
920 footer += '# platform-testcmd: %s\n' % (self.testcommand)
944 dev = dirname.split('/')[-2]
946 props[dev].syspath = dirname[:-6]
990 footer += '# platform-devinfo: %s\n' % self.b64zip(out)
994 footer += '# platform-%s: %s | %s\n' % (name, cmdline, self.b64zip(info))
1005 prefix = prefix[:len(prefix)-1]
1008 if '/' in prefix and prefix[-1] != '/':
1053 dinfo += '\t%s : %s -> %s\n' % \
1069 fp = Popen([cmd, '-v'], stdout=PIPE, stderr=PIPE).stderr
1079 fullcmd = '%s -q -S echo freeze > %s' % (cmd, self.powerfile)
1080 fp = Popen(['sh', '-c', fullcmd], stdout=PIPE, stderr=PIPE).stderr
1113 vals.append(prop.split('=')[-1])
1121 m = re.match(' *(?P<dev>.*): (?P<stat>[0-9a-f]*) .*', w.split('\n')[-1])
1128 while (time.time() - start) < timeout:
1132 (self.wifiDetails(dev), max(0, time.time() - start))
1150 if re.match('^[0-9,\-\.]*$', arr[j]):
1151 arr[j] = '[0-9,\-\.]*'
1177 dt = t - self.multitest['last']
1181 pprint('TEST (%s) COMPLETE -- Duration %.1fs' % (id, dt))
1187 left = finish - datetime.now()
1188 left -= timedelta(microseconds=left.microseconds)
1190 left = timedelta(seconds=((self.multitest['count'] - idx) * int(avg)))
1191 pprint('TEST (%s) START - Avg Duration %.1fs, Time left %s' % \
1196 sz, unit, c = 'time', c[-1], c[:-1]
1263 # 10 sequential, non-overlapping phases of S/R
1304 'ACPI' : r'.*\bACPI *(?P<b>[A-Za-z]*) *Error[: ].*',
1306 'USBERR' : r'.*usb .*device .*, error [0-9-]*',
1307 'ATAERR' : r' *ata[0-9\.]*: .*failed.*',
1309 'TPMERR' : r'(?i) *tpm *tpm[0-9]*: .*error.*',
1317 self.tSuspended = 0.0 # low-level suspend start
1318 self.tResumed = 0.0 # low-level resume start
1338 self.tLow = [] # time spent in low-level suspends (standby/freeze)
1363 return plist[-1*depth]
1373 out['syslpi'] = i.split('=')[-1]+'%'
1375 out['pkgpc10'] = i.split('=')[-1]+'%'
1389 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
1456 # device target event is entirely inside the source boundary
1460 # thread target event will expand the source boundary
1482 threadname = 'kthread-%d' % (pid)
1484 threadname = '%s-%d' % (proc, pid)
1490 sysvals.vprint('[%f - %f] %s-%d %s %s %s' % \
1536 o = min(dev['end'], tdev['end']) - max(dev['start'], tdev['start'])
1550 if tdev['start'] - dev['end'] < 0.1:
1559 # merge any threads between tests that touch
1577 for e in sorted(src, key=lambda event: event.time):
1583 p.length = p.end - p.time
1589 if(t - dT < t0):
1591 return t - dT
1617 d['length'] = d['end'] - d['start']
1628 e.length = e.end - e.time
1642 tL = tR - tS
1648 text = '%.0f (-%.0f waking)' % (tL * 1000, tTry)
1656 stime = (self.tSuspended - self.start) * 1000000
1657 rtime = (self.end - self.tResumed) * 1000000
1659 hwr = self.hwend - timedelta(microseconds=rtime)
1660 self.tLow.append('%.0f'%((hwr - hws).total_seconds() * 1000))
1662 sktime = (self.tSuspended - self.tKernSus) * 1000
1663 rktime = (self.tKernRes - self.tResumed) * 1000
1665 def setPhase(self, phase, ktime, isbegin, order=-1):
1678 self.dmesg[phase] = {'list': dict(), 'start': -1.0, 'end': -1.0,
1741 def newActionGlobal(self, name, start, end, pid=-1, color=''):
1752 o = max(0, min(end, pend) - max(start, pstart))
1767 targetphase = phases[-1]
1768 if pid == -2:
1770 elif pid == -3:
1784 length = -1.0
1786 length = end - start
1787 if pid == -2 or name not in sysvals.tracefuncs.keys():
1804 if name == devname or re.match('^%s\[(?P<num>[0-9]*)\]$' % name, devname):
1836 sysvals.vprint('%20s: %f - %f (%d devices)' % (phase, ps, pe, dc))
1838 sysvals.vprint(''.join('-' for i in range(80)))
1840 fmt = '%3d) %'+maxname+'s - %f - %f'
1847 sysvals.vprint(''.join('-' for i in range(80)))
1880 info += ('<li>%s: %.3fms</li>' % (phase, (e-s)*1000))
1899 # list of top-most root devices
1906 if(pid < 0 or re.match('[0-9]*-[0-9]*\.[0-9]*[\.0-9]*\:[\.0-9]*$', pdev)):
1922 length = (list[dev]['end'] - list[dev]['start']) * 1000
1923 width = widfmt % (((list[dev]['end']-list[dev]['start'])*100)/tTotal)
1929 self.newAction(phase, devname, -2, '', \
1940 start = -1
1941 end = -1
1947 if start == -1 or tlast < start:
1949 if end == -1 or t > end:
1952 if start == -1 or end == -1:
1955 out = self.newActionGlobal(name, start, end, -3)
2048 self.length = end - start
2060 title = '%s(%s)%s <- %s, %s(%s)' % \
2073 dt = self.time - tgt.end
2074 # only combine calls if -all- attributes are identical
2091 # trace event:
2108 # is this a trace event
2111 # nop format trace event
2114 # function_graph format trace event
2159 if(m[-1] == '{'):
2164 elif(m[-1] == ';'):
2182 pprint(' -- %12.6f (depth=%02d): %s(); (%.3f us) %s' % (self.time, \
2185 pprint(' -- %12.6f (depth=%02d): %s} (%.3f us) %s' % (self.time, \
2188 pprint(' -- %12.6f (depth=%02d): %s() { (%.3f us) %s' % (self.time, \
2231 self.start = -1.0
2232 self.end = -1.0
2252 self.list[-1].freturn = True
2253 self.list[-1].length = line.time - self.list[-1].time
2261 # compare current depth with this lines pre-call depth
2268 last = self.list[-1]
2273 mismatch = prelinedep - self.depth
2280 self.depth -= 1
2285 last.length = line.time - last.time
2311 prelinedep -= 1
2339 if (md and self.depth >= md - 1) or (line.name in self.sv.cgblacklist):
2344 self.depth -= 1
2349 while len(self.list) > 0 and self.list[-1].depth > line.depth:
2350 self.list.pop(-1)
2354 self.list[-1].freturn = True
2355 self.list[-1].length = line.time - self.list[-1].time
2356 self.list[-1].name = line.name
2362 if mismatch < 0 and self.list[-1].depth == 0 and self.list[-1].freturn:
2363 line = self.list[-1]
2365 res = -1
2376 if res == -1:
2387 window = '(%f - %f)' % (self.start, line.time)
2397 mydepth = -1
2409 l.depth -= mydepth
2417 last = self.list[-1]
2437 if last.length > l.time - last.time:
2438 last.length = l.time - last.time
2450 cl.length = l.time - cl.time
2455 cnt -= 1
2516 out = data.newActionGlobal(name, fs, fe, -2)
2521 pprint('%s pid=%d [%f - %f] %.3f us' % \
2523 (self.end - self.start)*1000000))
2568 self.html += '<div class="version"><a href="https://01.org/pm-graph">%s v%s</a></div>' \
2595 item.row = -1
2621 remaining -= 1
2638 # initialize all device rows to -1 and calculate devrows
2644 dev['row'] = -1
2647 sortdict[item] = (-1*float(dev['start']), float(dev['end']) - float(dev['start']))
2650 sortdict[item] = (float(dev['end']) - float(dev['start']), item.dev['name'])
2657 if item.dev['pid'] == -2:
2683 remaining -= 1
2728 self.bodyH = self.height - self.scaleH
2735 …html_zoombox = '<center><button id="zoomin">ZOOM IN +</button><button id="zoomout">ZOOM OUT -</but…
2759 rline = '<div class="t" style="left:0;border-left:1px solid black;border-right:0;">{0}</div>\n'
2762 mTotal = mMax - m0
2769 divEdge = (mTotal - tS*(divTotal-1))*100/mTotal
2773 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal) - divEdge)
2774 val = '%0.fms' % (float(i-divTotal+1)*tS*1000)
2775 if(i == divTotal - 1):
2779 pos = '%0.3f' % (100 - ((float(i)*tS*100)/mTotal))
2791 stampfmt = '# [a-z]*-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\
2792 '(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\
2794 wififmt = '^# wifi *(?P<d>\S*) *(?P<s>\S*) *(?P<t>[0-9\.]+).*'
2801 pinfofmt = '# platform-(?P<val>[a-z,A-Z,0-9]*): (?P<info>.*)'
2803 firmwarefmt = '# fwsuspend (?P<s>[0-9]*) fwresume (?P<r>[0-9]*)$'
2804 procexecfmt = 'ps - (?P<ps>.*)$'
2806 '^ *(?P<time>[0-9\.]*) *\| *(?P<cpu>[0-9]*)\)'+\
2807 ' *(?P<proc>.*)-(?P<pid>[0-9]*) *\|'+\
2808 '[ +!#\*@$]*(?P<dur>[0-9\.]*) .*\| (?P<msg>.*)'
2810 ' *(?P<proc>.*)-(?P<pid>[0-9]*) *\[(?P<cpu>[0-9]*)\] *'+\
2811 '(?P<flags>\S*) *(?P<time>[0-9\.]*): *'+\
2988 c = ['cat /proc/[1-9]*/stat 2>/dev/null']
3002 ujiff = user - val['user']
3003 kjiff = kern - val['kern']
3015 out += '%s-%s %d' % (val['name'], pid, jiffies)
3016 return 'ps - '+out
3029 # ----------------- FUNCTIONS --------------------
3066 # Adds callgraph data which lacks trace event data. This is only
3106 # the line should be a call, return, or event
3124 # trace event processing
3134 cg = testrun[testidx].ftemp[pid][-1]
3138 if(res == -1):
3139 testrun[testidx].ftemp[pid][-1].addLine(t)
3146 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3223 # the line should be a call, return, or event
3248 name = val[0].replace('--', '-')
3259 # the event we used to trigger resume end
3262 testrun.ttemp['thaw_processes'][-1]['end'] = t.time
3265 # trace event processing
3283 # -- phase changes --
3322 t.time - data.dmesg[lp]['start']
3370 testrun.ttemp[name][-1]['end'] = t.time
3371 testrun.ttemp[name][-1]['loop'] += 1
3384 testrun.ttemp[name][-1]['end'] = t.time
3397 data.newAction(phase, n, pid, p, t.time, -1, drv)
3410 dev['length'] = t.time - dev['start']
3412 # kprobe event processing
3428 'end': -1,
3459 cg = testrun.ftemp[key][-1]
3463 if(res == -1):
3464 testrun.ftemp[key][-1].addLine(t)
3502 if i < len(testruns) - 1:
3511 for event in test.ttemp[name]:
3512 if event['end'] - event['begin'] <= 0:
3515 if name == 'machine_suspend' and 'loop' in event:
3516 title = 's2idle_enter_%dx' % event['loop']
3517 data.newActionGlobal(title, event['begin'], event['end'], event['pid'])
3527 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3539 if ke - kb < 0.000001 or tlb > kb or tle <= kb:
3549 if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
3571 …sysvals.vprint('Callgraph found for task %d: %.3fms, %s' % (cg.pid, (cg.end - cg.start)*1000, name…
3619 for i in range(tc - 1):
3641 tp.stamp = datetime.now().strftime('# suspend-%m%d%y-%H%M%S localhost mem unknown')
3652 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
3663 m = re.match('.* *(?P<k>[0-9]\.[0-9]{2}\.[0-9]-.*) .*', msg)
3682 mc = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) calling '+\
3684 mr = re.match('.*(\[ *)(?P<t>[0-9\.]*)(\]) call '+\
3717 'suspend': ['PM: Entering [a-z]* sleep.*', 'Suspending console.*'],
3721 'resume_machine': ['ACPI: Low-level resume complete.*'],
3751 'emsg': 'PM: Entering (?P<mode>[a-z,A-Z]*) sleep.*' },
3757 'emsg': 'Disabling non-boot CPUs .*' },
3760 t0 = -1.0
3761 cpu_start = -1.0
3762 prevktime = -1.0
3766 m = re.match('[ \t]*(\[ *)(?P<ktime>[0-9\.]*)(\]) (?P<msg>.*)', line)
3862 # -- device callbacks --
3872 data.newAction(phase, f, int(n), p, ktime, -1, '')
3896 actions[a][-1]['end'] = ktime
3898 if(re.match('Disabling non-boot CPUs .*', msg)):
3901 elif(re.match('Enabling non-boot CPUs .*', msg)):
3904 elif(re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)):
3906 m = re.match('smpboot: CPU (?P<cpu>[0-9]*) is now offline', msg)
3912 elif(re.match('CPU(?P<cpu>[0-9]*) is up', msg)):
3914 m = re.match('CPU(?P<cpu>[0-9]*) is up', msg)
3949 for event in actions[name]:
3950 data.newActionGlobal(name, event['begin'], event['end'])
3966 cglen = (cg.end - cg.start) * 1000
4027 tdcenter = 'text-align:center;' if center else ''
4029 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4032 ….stamp {width: 100%;text-align:center;background:#888;line-height:30px;color:white;font: 25px Aria…
4033 table {width:100%;border-collapse: collapse;border:1px solid;}\n\
4037 tr.alt {background-color:#ddd;}\n\
4039 .minval {background-color:#BBFFBB;}\n\
4040 .medval {background-color:#BBBBFF;}\n\
4041 .maxval {background-color:#FFBBBB;}\n\
4042 .head a {color:#000;text-decoration: none;}\n\
4053 html = summaryCSS('Summary - SleepGraph')
4090 idx = len(list[mode]['data']) - 1
4175 iMin = iMed = iMax = [-1, -1, -1]
4178 # row classes - alternate row color
4179 rcls = ['alt'] if num % 2 == 1 else []
4222 html = summaryCSS('Device Summary - SleepGraph', False)
4268 # row classes - alternate row color
4269 rcls = ['alt'] if num % 2 == 1 else []
4289 html = summaryCSS('Issues Summary - SleepGraph', False)
4312 # row classes - alternate row color
4313 rcls = ['alt'] if num % 2 == 1 else []
4359 data.trimFreezeTime(testruns[-1].tSuspended)
4365 …lass="traceevent{6}" style="left:{1}%;top:{2}px;height:{3}px;width:{4}%;line-height:{3}px;{7}">{5}…
4373 …'<td class="gray" title="time spent in low-power mode with clock running">'+sysvals.suspendmode+' …
4398 tTotal = data.end - data.start
4422 rtot += data.end - data.tKernRes + (data.wifi['time'] * 1000.0)
4454 wtime = '%.0f ms'%(data.end - data.tKernRes + (data.wifi['time'] * 1000.0))
4465 tMax = testruns[-1].end
4466 tTotal = tMax - t0
4499 d = testruns[0].addHorizontalDivider(msg, testruns[-1].end)
4503 d = testruns[0].addHorizontalDivider('asynchronous kernel threads', testruns[-1].end)
4525 left = '%f' % (((m0-t0)*100.0)/tTotal)
4532 left = '%f' % ((((m0-t0)*100.0)+sysvals.srgap/2)/tTotal)
4533 mTotal = mMax - m0
4537 width = '%f' % (((mTotal*100.0)-sysvals.srgap/2)/tTotal)
4542 length = phase['end']-phase['start']
4543 left = '%f' % (((phase['start']-m0)*100.0)/mTotal)
4552 right = '%f' % (((mMax-t)*100.0)/mTotal)
4576 left = '%f' % (((dev['start']-m0)*100)/mTotal)
4577 width = '%f' % (((dev['end']-dev['start'])*100)/mTotal)
4578 length = ' (%0.3f ms) ' % ((dev['end']-dev['start'])*1000)
4600 left = '%f' % (((start-m0)*100)/mTotal)
4601 width = '%f' % ((end-start)*100/mTotal)
4613 left = '%f' % (((e.time-m0)*100)/mTotal)
4630 phasedef = testruns[-1].phasedef
4653 pscolor = 'linear-gradient(to top left, #ccc, #eee)'
4658 length = phase['end']-phase['start']
4659 left = '%.3f' % (((phase['start']-t0)*100.0)/tTotal)
4674 data = testruns[-1]
4720 hoverZ = 'z-index:8;'
4734 <meta http-equiv="content-type" content="text/html; charset=UTF-8">\n\
4737 body {overflow-y:scroll;}\n\
4738 ….stamp {width:100%;text-align:center;background:gray;line-height:30px;color:white;font:25px Arial;…
4740 .callgraph {margin-top:30px;box-shadow:5px 5px 20px black;}\n\
4741 .callgraph article * {padding-left:28px;}\n\
4746 t3 {color:black;font:20px Times;white-space:nowrap;}\n\
4747 t4 {color:black;font:bold 30px Times;line-height:60px;white-space:nowrap;}\n\
4756 .time2 {font:15px Arial;border-bottom:1px solid;border-left:1px solid;border-right:1px solid;}\n\
4758 td {text-align:center;}\n\
4764-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:black;stroke-width:0"…
4765 …troke="black" stroke-width="1" fill="white"/><rect x="4" y="8" width="10" height="2" style="fill:b…
4766 .pf:'+cgchk+' ~ *:not(:nth-child(2)) {display:none;}\n\
4767 …oombox {position:relative;width:100%;overflow-x:scroll;-webkit-user-select:none;-moz-user-select:n…
4768 ….timeline {position:relative;font-size:14px;cursor:pointer;width:100%; overflow:hidden;background:…
4769 …bsolute;height:0%;overflow:hidden;z-index:7;line-height:30px;font-size:14px;border:1px solid;text-
4770 .thread.ps {border-radius:3px;background:linear-gradient(to top, #ccc, #eee);}\n\
4772 ….thread.sec,.thread.sec:hover {background:black;border:0;color:white;line-height:15px;font-size:10…
4776 .jiffie {position:absolute;pointer-events: none;z-index:8;}\n\
4777 …font-size:10px;z-index:7;overflow:hidden;color:black;text-align:center;white-space:nowrap;border-r…
4778 .traceevent:hover {color:white;font-weight:bold;border:1px solid white;}\n\
4779 .phase {position:absolute;overflow:hidden;border:0px;text-align:center;}\n\
4780 ….phaselet {float:left;overflow:hidden;border:0px;text-align:center;min-height:100px;font-size:24px…
4781 ….t {position:absolute;line-height:'+('%d'%scaleTH)+'px;pointer-events:none;top:0;height:100%;borde…
4782 …err {position:absolute;top:0%;height:100%;border-right:3px solid red;color:red;font:bold 14px Time…
4783 .legend {position:relative; width:100%; height:40px; text-align:center;margin-bottom:20px}\n\
4784 …ion:absolute;cursor:pointer;top:10px; width:0px;height:20px;border:1px solid;padding-left:20px;}\n\
4785 button {height:40px;width:200px;margin-bottom:20px;margin-top:20px;font-size:24px;}\n\
4786 …ion:relative;float:right;height:25px;width:auto;margin-top:3px;margin-bottom:0;font-size:10px;text
4788 a:link {color:white;text-decoration:none;}\n\
4792 ….version {position:relative;float:left;color:white;font-size:10px;line-height:30px;margin-left:10p…
4793 #devicedetail {min-height:100px;box-shadow:5px 5px 20px black;}\n\
4795 .tback {position:absolute;width:100%;background:linear-gradient(#ccc, #ddd);}\n\
4796 .bg {z-index:1;}\n\
4809 tMax = testruns[-1].end * 1000
4819 ' var resolution = -1;\n'\
4822 ' var rline = \'<div class="t" style="left:0;border-left:1px solid black;border-right:0;">\';\n'\
4823 ' var tTotal = tMax - t0;\n'\
4833 ' var divEdge = (mTotal - tS*(divTotal-1))*100/mTotal;\n'\
4839 ' pos = 100 - (((j)*tS*100)/mTotal) - divEdge;\n'\
4840 ' val = (j-divTotal+1)*tS;\n'\
4841 ' if(j == divTotal - 1)\n'\
4846 ' pos = 100 - (((j)*tS*100)/mTotal);\n'\
4871 ' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\
4876 ' zoombox.scrollLeft = ((left + sh) * newval / val) - sh;\n'\
4884 ' var tTotal = tMax - t0;\n'\
4888 ' if(i >= tS.length) i = tS.length - 1;\n'\
4901 ' var cpu = -1;\n'\
4902 ' if(name.match("CPU_ON\[[0-9]*\]"))\n'\
4904 ' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\
4956 ' var cpu = -1;\n'\
4957 ' if(name.match("CPU_ON\[[0-9]*\]"))\n'\
4959 ' else if(name.match("CPU_OFF\[[0-9]*\]"))\n'\
4985 ' var pname = info[info.length-1];\n'\
4986 ' pd[pname] = parseFloat(info[info.length-3].slice(1));\n'\
5010 ' var time = "<t4 style=\\"font-size:"+fs+"px\\">"+pd[phases[i].id]+" ms<br></t4>";\n'\
5011 …' var pname = "<t3 style=\\"font-size:"+fs2+"px\\">"+phases[i].id.replace(new RegExp("_", "g")…
5039 ' var name = tmp[0], phase = tmp[tmp.length-1];\n'\
5059 ' var html = \'<div style="padding-top:\'+pad+\'px"><t3> <b>\'+name+\':</b>\';\n'\
5068 …' html += \'<table class=fstat style="padding-top:\'+(maxlen*5)+\'px;"><tr><th>Function</th>\';\…
5103 ' " ul {list-style-type:circle;padding-left:10px;margin-left:10px;}"+\n'\
5147 ' zoombox.scrollLeft = dragval[1] + dragval[0] - e.clientX;\n'\
5216 # runtime suspend re-enable or re-disable
5350 return os.readlink(file).split('/')[-1]
5384 '---------------------------------------------------------------------------------------------\n'\
5389 '---------------------------------------------------------------------------------------------\n'\
5391 '---------------------------------------------------------------------------------------------')
5402 dirname = dirname[:-6]
5403 device = dirname.split('/')[-1]
5423 lines[dirname] = '%-26s %-26s %1s %1s %1s %1s %1s %10s %10s' % \
5455 modes.append('mem-%s' % memmode)
5462 modes.append('disk-%s' % m.strip('[]'))
5479 'bios-vendor': (0, 4),
5480 'bios-version': (0, 5),
5481 'bios-release-date': (0, 8),
5482 'system-manufacturer': (1, 4),
5483 'system-product-name': (1, 5),
5484 'system-version': (1, 6),
5485 'system-serial-number': (1, 7),
5486 'baseboard-manufacturer': (2, 4),
5487 'baseboard-product-name': (2, 5),
5488 'baseboard-version': (2, 6),
5489 'baseboard-serial-number': (2, 7),
5490 'chassis-manufacturer': (3, 4),
5491 'chassis-type': (3, 5),
5492 'chassis-version': (3, 6),
5493 'chassis-serial-number': (3, 7),
5494 'processor-manufacturer': (4, 7),
5495 'processor-version': (4, 16),
5539 if buf[i:i+4] == b'_SM_' and i < memsize - 16:
5569 while(count < num and i <= len(buf) - 4):
5572 while n < len(buf) - 1:
5581 if idx > 0 and idx < len(data) - 1:
5582 s = data[idx-1].decode('utf-8')
5590 xset, ret = 'timeout 10 xset -d :0.0 {0}', 0
5592 xset = 'sudo -u %s %s' % (sysvals.sudouser, xset)
5604 sysvals.vprint('Display Switched: %s -> %s' % (b4, curr))
5711 recdata = fp.read(rechead[1]-8)
5743 fwData[0] = record[1] - record[0]
5798 pprint(' please choose one with -m')
5890 doError(name+': non-integer value given', True)
5909 doError(name+': non-numerical value given', True)
5939 sysvals.vprint(' %-8s : %s' % (key.upper(), sysvals.stamp[key]))
5955 sysvals.vprint('[%s - %s]' % (info[0], info[1]))
6040 num = re.search(r'[-+]?\d*\.\d+|\d+', str)
6068 m = re.match('[a-z0-9]* failed in (?P<p>\S*).*', error)
6119 m = re.match(' *<div id=\"[a,0-9]*\" *title=\"(?P<title>.*)\" class=\"thread.*', line)
6122 m = re.match('(?P<n>.*) \((?P<t>[0-9,\.]*) ms\) (?P<p>.*)', m.group('title'))
6127 name = ' '.join(name.split(' ')[:-1])
6169 for arg in ['-multi ', '-info ']:
6195 # create a summary of tests in a sub-directory
6225 pprint(' summary.html - tabular list of test data found')
6226 createHTMLDeviceSummary(testruns, os.path.join(outpath, 'summary-devices.html'), title)
6227 pprint(' summary-devices.html - kernel device list sorted by total execution time')
6228 createHTMLIssuesSummary(testruns, issues, os.path.join(outpath, 'summary-issues.html'), title)
6229 pprint(' summary-issues.html - kernel issues found sorted by frequency')
6239 doError('invalid boolean --> (%s: %s), use "true/false" or "1/0"' % (name, value), True)
6269 elif(option == 'override-timeline-functions'):
6271 elif(option == 'override-dev-timeline-functions'):
6280 sysvals.rs = -1
6284 doError('invalid value --> (%s: %s), use "enable/disable"' % (option, value), True)
6288 doError('invalid value --> (%s: %s), use %s' % (option, value, disopt), True)
6306 doError('invalid phase --> (%s: %s), valid phases are %s'\
6350 elif(option == 'callloop-maxgap'):
6351 sysvals.callloopmaxgap = getArgFloat('callloop-maxgap', value, 0.0, 1.0, False)
6352 elif(option == 'callloop-maxlen'):
6353 sysvals.callloopmaxgap = getArgFloat('callloop-maxlen', value, 0.0, 1.0, False)
6358 elif(option == 'output-dir'):
6366 doError('-dev is not compatible with -f')
6368 doError('-proc is not compatible with -f')
6399 if val[0] == '[' and val[-1] == ']':
6400 for prop in val[1:-1].split(','):
6419 for arg in re.findall('{(?P<n>[a-z,A-Z,0-9]*)}', format):
6457 ' Generates output files in subdirectory: suspend-yymmdd-HHMMSS\n'\
6463 ' -h Print this help text\n'\
6464 ' -v Print the current tool version\n'\
6465 ' -config fn Pull arguments and config options from file fn\n'\
6466 ' -verbose Print extra information during execution and analysis\n'\
6467 ' -m mode Mode to initiate for suspend (default: %s)\n'\
6468 ' -o name Overrides the output subdirectory name when running a new test\n'\
6469 ' default: suspend-{date}-{time}\n'\
6470 ' -rtcwake t Wakeup t seconds after suspend, set t to "off" to disable (default: 15)\n'\
6471 ' -addlogs Add the dmesg and ftrace logs to the html output\n'\
6472 ' -noturbostat Dont use turbostat in freeze mode (default: disabled)\n'\
6473 ' -srgap Add a visible gap in the timeline between sus/res (default: disabled)\n'\
6474 …' -skiphtml Run the test and capture the trace logs, but skip the timeline (default: disabled…
6475 ' -result fn Export a results table to a text file for parsing.\n'\
6476 ' -wifi If a wifi connection is available, check that it reconnects after resume.\n'\
6478 ' -sync Sync the filesystems before starting the test\n'\
6479 ' -rs on/off Enable/disable runtime suspend for all devices, restore all after test\n'\
6480 ' -display m Change the display mode to m for the test (on/off/standby/suspend)\n'\
6482 ' -gzip Gzip the trace and dmesg logs to save space\n'\
6483 ' -cmd {s} Run the timeline over a custom command, e.g. "sync -d"\n'\
6484 ' -proc Add usermode process info into the timeline (default: disabled)\n'\
6485 ' -dev Add kernel function calls and threads to the timeline (default: disabled)\n'\
6486 ' -x2 Run two suspend/resumes back to back (default: disabled)\n'\
6487 ' -x2delay t Include t ms delay between multiple test runs (default: 0 ms)\n'\
6488 ' -predelay t Include t ms delay before 1st suspend (default: 0 ms)\n'\
6489 ' -postdelay t Include t ms delay after last resume (default: 0 ms)\n'\
6490 ' -mindev ms Discard all device blocks shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6491 ' -multi n d Execute <n> consecutive tests at <d> seconds intervals. If <n> is followed\n'\
6494 ' -maxfail n Abort a -multi run after n consecutive fails (default is 0 = never abort)\n'\
6496 ' -f Use ftrace to create device callgraphs (default: disabled)\n'\
6497 ' -ftop Use ftrace on the top level call: "%s" (default: disabled)\n'\
6498 ' -maxdepth N limit the callgraph data to N call levels (default: 0=all)\n'\
6499 ' -expandcg pre-expand the callgraph data in the html output (default: disabled)\n'\
6500 ' -fadd file Add functions to be graphed in the timeline from a list in a text file\n'\
6501 ' -filter "d1,d2,..." Filter out all but this comma-delimited list of device names\n'\
6502 ' -mincg ms Discard all callgraphs shorter than ms milliseconds (e.g. 0.001 for us)\n'\
6503 ' -cgphase P Only show callgraph data for phase P (e.g. suspend_late)\n'\
6504 ' -cgtest N Only show callgraph data for test N (e.g. 0 or 1 in an x2 run)\n'\
6505 ' -timeprec N Number of significant digits in timestamps (0:S, [3:ms], 6:us)\n'\
6506 ' -cgfilter S Filter the callgraph output in the timeline\n'\
6507 ' -cgskip file Callgraph functions to skip, off to disable (default: cgskip.txt)\n'\
6508 ' -bufsize N Set trace buffer size to N kilo-bytes (default: all of free memory)\n'\
6509 ' -devdump Print out all the raw device data for each phase\n'\
6510 ' -cgdump Print out all the raw callgraph data\n'\
6513 ' -modes List available suspend modes\n'\
6514 ' -status Test to see if the system is enabled to run this tool\n'\
6515 ' -fpdt Print out the contents of the ACPI Firmware Performance Data Table\n'\
6516 ' -wificheck Print out wifi connection info\n'\
6517 ' -x<mode> Test xset by toggling the given mode (on/off/standby/suspend)\n'\
6518 ' -sysinfo Print out system info extracted from BIOS\n'\
6519 ' -devinfo Print out the pm settings of all devices which support runtime suspend\n'\
6520 ' -cmdinfo Print out all the platform info collected before and after suspend/resume\n'\
6521 ' -flist Print the list of functions currently being captured in ftrace\n'\
6522 ' -flistall Print all functions capable of being captured in ftrace\n'\
6523 ' -summary dir Create a summary of tests in this dir [-genhtml builds missing html]\n'\
6525 ' -ftrace ftracefile Create HTML output using ftrace input (used with -dmesg)\n'\
6526 ' -dmesg dmesgfile Create HTML output using dmesg (used with -ftrace)\n'\
6530 # ----------------- MAIN --------------------
6535 simplecmds = ['-sysinfo', '-modes', '-fpdt', '-flist', '-flistall',
6536 '-devinfo', '-status', '-xon', '-xoff', '-xstandby', '-xsuspend',
6537 '-xinit', '-xreset', '-xstat', '-wificheck', '-cmdinfo']
6538 if '-f' in sys.argv:
6543 if(arg == '-m'):
6553 elif(arg == '-h'):
6556 elif(arg == '-v'):
6559 elif(arg == '-x2'):
6561 elif(arg == '-x2delay'):
6562 sysvals.x2delay = getArgInt('-x2delay', args, 0, 60000)
6563 elif(arg == '-predelay'):
6564 sysvals.predelay = getArgInt('-predelay', args, 0, 60000)
6565 elif(arg == '-postdelay'):
6566 sysvals.postdelay = getArgInt('-postdelay', args, 0, 60000)
6567 elif(arg == '-f'):
6569 elif(arg == '-ftop'):
6573 elif(arg == '-skiphtml'):
6575 elif(arg == '-cgdump'):
6577 elif(arg == '-devdump'):
6579 elif(arg == '-genhtml'):
6581 elif(arg == '-addlogs'):
6583 elif(arg == '-nologs'):
6585 elif(arg == '-addlogdmesg'):
6587 elif(arg == '-addlogftrace'):
6589 elif(arg == '-noturbostat'):
6591 elif(arg == '-verbose'):
6593 elif(arg == '-proc'):
6595 elif(arg == '-dev'):
6597 elif(arg == '-sync'):
6599 elif(arg == '-wifi'):
6601 elif(arg == '-gzip'):
6603 elif(arg == '-info'):
6607 doError('-info requires one string argument', True)
6608 elif(arg == '-rs'):
6612 doError('-rs requires "enable" or "disable"', True)
6615 sysvals.rs = -1
6620 elif(arg == '-display'):
6624 doError('-display requires an mode value', True)
6629 elif(arg == '-maxdepth'):
6630 sysvals.max_graph_depth = getArgInt('-maxdepth', args, 0, 1000)
6631 elif(arg == '-rtcwake'):
6640 sysvals.rtcwaketime = getArgInt('-rtcwake', val, 0, 3600, False)
6641 elif(arg == '-timeprec'):
6642 sysvals.setPrecision(getArgInt('-timeprec', args, 0, 6))
6643 elif(arg == '-mindev'):
6644 sysvals.mindevlen = getArgFloat('-mindev', args, 0.0, 10000.0)
6645 elif(arg == '-mincg'):
6646 sysvals.mincglen = getArgFloat('-mincg', args, 0.0, 10000.0)
6647 elif(arg == '-bufsize'):
6648 sysvals.bufsize = getArgInt('-bufsize', args, 1, 1024*1024*8)
6649 elif(arg == '-cgtest'):
6650 sysvals.cgtest = getArgInt('-cgtest', args, 0, 1)
6651 elif(arg == '-cgphase'):
6658 doError('invalid phase --> (%s: %s), valid phases are %s'\
6661 elif(arg == '-cgfilter'):
6667 elif(arg == '-skipkprobe'):
6673 elif(arg == '-cgskip'):
6684 elif(arg == '-callloop-maxgap'):
6685 sysvals.callloopmaxgap = getArgFloat('-callloop-maxgap', args, 0.0, 1.0)
6686 elif(arg == '-callloop-maxlen'):
6687 sysvals.callloopmaxlen = getArgFloat('-callloop-maxlen', args, 0.0, 1.0)
6688 elif(arg == '-cmd'):
6695 elif(arg == '-expandcg'):
6697 elif(arg == '-srgap'):
6699 elif(arg == '-maxfail'):
6700 sysvals.maxfail = getArgInt('-maxfail', args, 0, 1000000)
6701 elif(arg == '-multi'):
6705 doError('-multi requires two values', True)
6707 elif(arg == '-o'):
6713 elif(arg == '-config'):
6722 elif(arg == '-fadd'):
6731 elif(arg == '-dmesg'):
6740 elif(arg == '-ftrace'):
6749 elif(arg == '-summary'):
6759 elif(arg == '-filter'):
6765 elif(arg == '-result'):
6777 doError('-dev is not compatible with -f')
6779 doError('-proc is not compatible with -f')
6828 print('[%s - %s]\n%s\n' % out)
6831 # if instructed, re-analyze existing data files
6845 memmode = mode.split('-', 1)[-1] if '-' in mode else 'deep'
6854 if mode.startswith('disk-'):
6855 sysvals.diskmode = mode.split('-', 1)[-1]
6868 s = '-%dm' % sysvals.multitest['time']
6870 s = '-x%d' % sysvals.multitest['count']
6871 sysvals.outdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S'+s)
6883 fmt = 'suspend-%y%m%d-%H%M%S'