mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 04:42:12 +00:00
PM / tools: sleepgraph and bootgraph: upgrade to v5.2
bootgraph & sleepgraph: - funnel all prints through the pprint function - remove superfluous print calls, arrange them in single blocks - flush stdout on every print, enables log capture on hang sleepgraph: - in -summary, if all tests have the same host+kernel+mode, add to title - update verbose device detail print to include machine suspend/resume - match tKernSus and tKernRes to pm_prepare/restore_console - fully support multiple suspend/resumes in a single timeline - enable various disk modes (disk-suspend, disk-test_resume, etc) - add warnings when -display (xset) fails Signed-off-by: Todd Brandt <todd.e.brandt@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
5484f03344
commit
18d3f8fc0c
@ -34,6 +34,10 @@ from datetime import datetime, timedelta
|
|||||||
from subprocess import call, Popen, PIPE
|
from subprocess import call, Popen, PIPE
|
||||||
import sleepgraph as aslib
|
import sleepgraph as aslib
|
||||||
|
|
||||||
|
def pprint(msg):
|
||||||
|
print(msg)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
# ----------------- CLASSES --------------------
|
# ----------------- CLASSES --------------------
|
||||||
|
|
||||||
# Class: SystemValues
|
# Class: SystemValues
|
||||||
@ -157,11 +161,11 @@ class SystemValues(aslib.SystemValues):
|
|||||||
return cmdline
|
return cmdline
|
||||||
def manualRebootRequired(self):
|
def manualRebootRequired(self):
|
||||||
cmdline = self.kernelParams()
|
cmdline = self.kernelParams()
|
||||||
print 'To generate a new timeline manually, follow these steps:\n'
|
pprint('To generate a new timeline manually, follow these steps:\n\n'\
|
||||||
print '1. Add the CMDLINE string to your kernel command line.'
|
'1. Add the CMDLINE string to your kernel command line.\n'\
|
||||||
print '2. Reboot the system.'
|
'2. Reboot the system.\n'\
|
||||||
print '3. After reboot, re-run this tool with the same arguments but no command (w/o -reboot or -manual).\n'
|
'3. After reboot, re-run this tool with the same arguments but no command (w/o -reboot or -manual).\n\n'\
|
||||||
print 'CMDLINE="%s"' % cmdline
|
'CMDLINE="%s"' % cmdline)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
def blGrub(self):
|
def blGrub(self):
|
||||||
blcmd = ''
|
blcmd = ''
|
||||||
@ -431,7 +435,7 @@ def parseTraceLog(data):
|
|||||||
if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
|
if len(cg.list) < 1 or cg.invalid or (cg.end - cg.start == 0):
|
||||||
continue
|
continue
|
||||||
if(not cg.postProcess()):
|
if(not cg.postProcess()):
|
||||||
print('Sanity check failed for %s-%d' % (proc, pid))
|
pprint('Sanity check failed for %s-%d' % (proc, pid))
|
||||||
continue
|
continue
|
||||||
# match cg data to devices
|
# match cg data to devices
|
||||||
devname = data.deviceMatch(pid, cg)
|
devname = data.deviceMatch(pid, cg)
|
||||||
@ -442,8 +446,8 @@ def parseTraceLog(data):
|
|||||||
sysvals.vprint('%s callgraph found for %s %s-%d [%f - %f]' %\
|
sysvals.vprint('%s callgraph found for %s %s-%d [%f - %f]' %\
|
||||||
(kind, cg.name, proc, pid, cg.start, cg.end))
|
(kind, cg.name, proc, pid, cg.start, cg.end))
|
||||||
elif len(cg.list) > 1000000:
|
elif len(cg.list) > 1000000:
|
||||||
print 'WARNING: the callgraph found for %s is massive! (%d lines)' %\
|
pprint('WARNING: the callgraph found for %s is massive! (%d lines)' %\
|
||||||
(devname, len(cg.list))
|
(devname, len(cg.list)))
|
||||||
|
|
||||||
# Function: retrieveLogs
|
# Function: retrieveLogs
|
||||||
# Description:
|
# Description:
|
||||||
@ -528,7 +532,7 @@ def createBootGraph(data):
|
|||||||
tMax = data.end
|
tMax = data.end
|
||||||
tTotal = tMax - t0
|
tTotal = tMax - t0
|
||||||
if(tTotal == 0):
|
if(tTotal == 0):
|
||||||
print('ERROR: No timeline data')
|
pprint('ERROR: No timeline data')
|
||||||
return False
|
return False
|
||||||
user_mode = '%.0f'%(data.tUserMode*1000)
|
user_mode = '%.0f'%(data.tUserMode*1000)
|
||||||
last_init = '%.0f'%(tTotal*1000)
|
last_init = '%.0f'%(tTotal*1000)
|
||||||
@ -734,7 +738,7 @@ def updateCron(restore=False):
|
|||||||
op.close()
|
op.close()
|
||||||
res = call([cmd, cronfile])
|
res = call([cmd, cronfile])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print 'Exception: %s' % str(e)
|
pprint('Exception: %s' % str(e))
|
||||||
shutil.move(backfile, cronfile)
|
shutil.move(backfile, cronfile)
|
||||||
res = -1
|
res = -1
|
||||||
if res != 0:
|
if res != 0:
|
||||||
@ -750,7 +754,7 @@ def updateGrub(restore=False):
|
|||||||
call(sysvals.blexec, stderr=PIPE, stdout=PIPE,
|
call(sysvals.blexec, stderr=PIPE, stdout=PIPE,
|
||||||
env={'PATH': '.:/sbin:/usr/sbin:/usr/bin:/sbin:/bin'})
|
env={'PATH': '.:/sbin:/usr/sbin:/usr/bin:/sbin:/bin'})
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print 'Exception: %s\n' % str(e)
|
pprint('Exception: %s\n' % str(e))
|
||||||
return
|
return
|
||||||
# extract the option and create a grub config without it
|
# extract the option and create a grub config without it
|
||||||
sysvals.rootUser(True)
|
sysvals.rootUser(True)
|
||||||
@ -797,7 +801,7 @@ def updateGrub(restore=False):
|
|||||||
res = call(sysvals.blexec)
|
res = call(sysvals.blexec)
|
||||||
os.remove(grubfile)
|
os.remove(grubfile)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print 'Exception: %s' % str(e)
|
pprint('Exception: %s' % str(e))
|
||||||
res = -1
|
res = -1
|
||||||
# cleanup
|
# cleanup
|
||||||
shutil.move(tempfile, grubfile)
|
shutil.move(tempfile, grubfile)
|
||||||
@ -821,7 +825,7 @@ def updateKernelParams(restore=False):
|
|||||||
def doError(msg, help=False):
|
def doError(msg, help=False):
|
||||||
if help == True:
|
if help == True:
|
||||||
printHelp()
|
printHelp()
|
||||||
print 'ERROR: %s\n' % msg
|
pprint('ERROR: %s\n' % msg)
|
||||||
sysvals.outputResult({'error':msg})
|
sysvals.outputResult({'error':msg})
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
@ -829,52 +833,51 @@ def doError(msg, help=False):
|
|||||||
# Description:
|
# Description:
|
||||||
# print out the help text
|
# print out the help text
|
||||||
def printHelp():
|
def printHelp():
|
||||||
print('')
|
pprint('\n%s v%s\n'\
|
||||||
print('%s v%s' % (sysvals.title, sysvals.version))
|
'Usage: bootgraph <options> <command>\n'\
|
||||||
print('Usage: bootgraph <options> <command>')
|
'\n'\
|
||||||
print('')
|
'Description:\n'\
|
||||||
print('Description:')
|
' This tool reads in a dmesg log of linux kernel boot and\n'\
|
||||||
print(' This tool reads in a dmesg log of linux kernel boot and')
|
' creates an html representation of the boot timeline up to\n'\
|
||||||
print(' creates an html representation of the boot timeline up to')
|
' the start of the init process.\n'\
|
||||||
print(' the start of the init process.')
|
'\n'\
|
||||||
print('')
|
' If no specific command is given the tool reads the current dmesg\n'\
|
||||||
print(' If no specific command is given the tool reads the current dmesg')
|
' and/or ftrace log and creates a timeline\n'\
|
||||||
print(' and/or ftrace log and creates a timeline')
|
'\n'\
|
||||||
print('')
|
' Generates output files in subdirectory: boot-yymmdd-HHMMSS\n'\
|
||||||
print(' Generates output files in subdirectory: boot-yymmdd-HHMMSS')
|
' HTML output: <hostname>_boot.html\n'\
|
||||||
print(' HTML output: <hostname>_boot.html')
|
' raw dmesg output: <hostname>_boot_dmesg.txt\n'\
|
||||||
print(' raw dmesg output: <hostname>_boot_dmesg.txt')
|
' raw ftrace output: <hostname>_boot_ftrace.txt\n'\
|
||||||
print(' raw ftrace output: <hostname>_boot_ftrace.txt')
|
'\n'\
|
||||||
print('')
|
'Options:\n'\
|
||||||
print('Options:')
|
' -h Print this help text\n'\
|
||||||
print(' -h Print this help text')
|
' -v Print the current tool version\n'\
|
||||||
print(' -v Print the current tool version')
|
' -verbose Print extra information during execution and analysis\n'\
|
||||||
print(' -verbose Print extra information during execution and analysis')
|
' -addlogs Add the dmesg log to the html output\n'\
|
||||||
print(' -addlogs Add the dmesg log to the html output')
|
' -result fn Export a results table to a text file for parsing.\n'\
|
||||||
print(' -result fn Export a results table to a text file for parsing.')
|
' -o name Overrides the output subdirectory name when running a new test\n'\
|
||||||
print(' -o name Overrides the output subdirectory name when running a new test')
|
' default: boot-{date}-{time}\n'\
|
||||||
print(' default: boot-{date}-{time}')
|
' [advanced]\n'\
|
||||||
print(' [advanced]')
|
' -fstat Use ftrace to add function detail and statistics (default: disabled)\n'\
|
||||||
print(' -fstat Use ftrace to add function detail and statistics (default: disabled)')
|
' -f/-callgraph Add callgraph detail, can be very large (default: disabled)\n'\
|
||||||
print(' -f/-callgraph Add callgraph detail, can be very large (default: disabled)')
|
' -maxdepth N limit the callgraph data to N call levels (default: 2)\n'\
|
||||||
print(' -maxdepth N limit the callgraph data to N call levels (default: 2)')
|
' -mincg ms Discard all callgraphs shorter than ms milliseconds (e.g. 0.001 for us)\n'\
|
||||||
print(' -mincg ms Discard all callgraphs shorter than ms milliseconds (e.g. 0.001 for us)')
|
' -timeprec N Number of significant digits in timestamps (0:S, 3:ms, [6:us])\n'\
|
||||||
print(' -timeprec N Number of significant digits in timestamps (0:S, 3:ms, [6:us])')
|
' -expandcg pre-expand the callgraph data in the html output (default: disabled)\n'\
|
||||||
print(' -expandcg pre-expand the callgraph data in the html output (default: disabled)')
|
' -func list Limit ftrace to comma-delimited list of functions (default: do_one_initcall)\n'\
|
||||||
print(' -func list Limit ftrace to comma-delimited list of functions (default: do_one_initcall)')
|
' -cgfilter S Filter the callgraph output in the timeline\n'\
|
||||||
print(' -cgfilter S Filter the callgraph output in the timeline')
|
' -cgskip file Callgraph functions to skip, off to disable (default: cgskip.txt)\n'\
|
||||||
print(' -cgskip file Callgraph functions to skip, off to disable (default: cgskip.txt)')
|
' -bl name Use the following boot loader for kernel params (default: grub)\n'\
|
||||||
print(' -bl name Use the following boot loader for kernel params (default: grub)')
|
' -reboot Reboot the machine automatically and generate a new timeline\n'\
|
||||||
print(' -reboot Reboot the machine automatically and generate a new timeline')
|
' -manual Show the steps to generate a new timeline manually (used with -reboot)\n'\
|
||||||
print(' -manual Show the steps to generate a new timeline manually (used with -reboot)')
|
'\n'\
|
||||||
print('')
|
'Other commands:\n'\
|
||||||
print('Other commands:')
|
' -flistall Print all functions capable of being captured in ftrace\n'\
|
||||||
print(' -flistall Print all functions capable of being captured in ftrace')
|
' -sysinfo Print out system info extracted from BIOS\n'\
|
||||||
print(' -sysinfo Print out system info extracted from BIOS')
|
' [redo]\n'\
|
||||||
print(' [redo]')
|
' -dmesg file Create HTML output using dmesg input (used with -ftrace)\n'\
|
||||||
print(' -dmesg file Create HTML output using dmesg input (used with -ftrace)')
|
' -ftrace file Create HTML output using ftrace input (used with -dmesg)\n'\
|
||||||
print(' -ftrace file Create HTML output using ftrace input (used with -dmesg)')
|
'' % (sysvals.title, sysvals.version))
|
||||||
print('')
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# ----------------- MAIN --------------------
|
# ----------------- MAIN --------------------
|
||||||
@ -895,7 +898,7 @@ if __name__ == '__main__':
|
|||||||
printHelp()
|
printHelp()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif(arg == '-v'):
|
elif(arg == '-v'):
|
||||||
print("Version %s" % sysvals.version)
|
pprint("Version %s" % sysvals.version)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif(arg == '-verbose'):
|
elif(arg == '-verbose'):
|
||||||
sysvals.verbose = True
|
sysvals.verbose = True
|
||||||
@ -1016,7 +1019,7 @@ if __name__ == '__main__':
|
|||||||
print f
|
print f
|
||||||
elif cmd == 'checkbl':
|
elif cmd == 'checkbl':
|
||||||
sysvals.getBootLoader()
|
sysvals.getBootLoader()
|
||||||
print 'Boot Loader: %s\n%s' % (sysvals.bootloader, sysvals.blexec)
|
pprint('Boot Loader: %s\n%s' % (sysvals.bootloader, sysvals.blexec))
|
||||||
elif(cmd == 'sysinfo'):
|
elif(cmd == 'sysinfo'):
|
||||||
sysvals.printSystemInfo(True)
|
sysvals.printSystemInfo(True)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -27,6 +27,7 @@ ktime_get
|
|||||||
# console calls
|
# console calls
|
||||||
printk
|
printk
|
||||||
dev_printk
|
dev_printk
|
||||||
|
__dev_printk
|
||||||
console_unlock
|
console_unlock
|
||||||
|
|
||||||
# memory handling
|
# memory handling
|
||||||
|
@ -105,7 +105,7 @@ override-dev-timeline-functions: true
|
|||||||
# example: [color=#CC00CC]
|
# example: [color=#CC00CC]
|
||||||
#
|
#
|
||||||
# arglist: A list of arguments from registers/stack addresses. See URL:
|
# arglist: A list of arguments from registers/stack addresses. See URL:
|
||||||
# https://www.kernel.org/doc/Documentation/trace/kprobetrace.rst
|
# https://www.kernel.org/doc/Documentation/trace/kprobetrace.txt
|
||||||
#
|
#
|
||||||
# example: cpu=%di:s32
|
# example: cpu=%di:s32
|
||||||
#
|
#
|
||||||
@ -170,7 +170,7 @@ pm_restore_console:
|
|||||||
# example: [color=#CC00CC]
|
# example: [color=#CC00CC]
|
||||||
#
|
#
|
||||||
# arglist: A list of arguments from registers/stack addresses. See URL:
|
# arglist: A list of arguments from registers/stack addresses. See URL:
|
||||||
# https://www.kernel.org/doc/Documentation/trace/kprobetrace.rst
|
# https://www.kernel.org/doc/Documentation/trace/kprobetrace.txt
|
||||||
#
|
#
|
||||||
# example: port=+36(%di):s32
|
# example: port=+36(%di):s32
|
||||||
#
|
#
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user