forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge back earlier power management tools updates for v5.4.
- Loading branch information
Showing
4 changed files
with
391 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
p m - g r a p h | ||
|
||
pm-graph: suspend/resume/boot timing analysis tools | ||
Version: 5.4 | ||
Version: 5.5 | ||
Author: Todd Brandt <[email protected]> | ||
Home Page: https://01.org/pm-graph | ||
|
||
|
@@ -18,6 +18,10 @@ | |
- upstream version in git: | ||
https://github.com/intel/pm-graph/ | ||
|
||
Requirements: | ||
- runs with python2 or python3, choice is made by /usr/bin/python link | ||
- python2 now requires python-configparser be installed | ||
|
||
Table of Contents | ||
- Overview | ||
- Setup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
#!/usr/bin/python2 | ||
#!/usr/bin/python | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
# | ||
# Tool for analyzing boot timing | ||
# Copyright (c) 2013, Intel Corporation. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms and conditions of the GNU General Public License, | ||
# version 2, as published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# Authors: | ||
# Todd Brandt <[email protected]> | ||
# | ||
|
@@ -81,7 +90,7 @@ def kernelParams(self): | |
cmdline = 'initcall_debug log_buf_len=32M' | ||
if self.useftrace: | ||
if self.cpucount > 0: | ||
bs = min(self.memtotal / 2, 2*1024*1024) / self.cpucount | ||
bs = min(self.memtotal // 2, 2*1024*1024) // self.cpucount | ||
else: | ||
bs = 131072 | ||
cmdline += ' trace_buf_size=%dK trace_clock=global '\ | ||
|
@@ -137,13 +146,13 @@ def cronjobCmdString(self): | |
if arg in ['-h', '-v', '-cronjob', '-reboot', '-verbose']: | ||
continue | ||
elif arg in ['-o', '-dmesg', '-ftrace', '-func']: | ||
args.next() | ||
next(args) | ||
continue | ||
elif arg == '-result': | ||
cmdline += ' %s "%s"' % (arg, os.path.abspath(args.next())) | ||
cmdline += ' %s "%s"' % (arg, os.path.abspath(next(args))) | ||
continue | ||
elif arg == '-cgskip': | ||
file = self.configFile(args.next()) | ||
file = self.configFile(next(args)) | ||
cmdline += ' %s "%s"' % (arg, os.path.abspath(file)) | ||
continue | ||
cmdline += ' '+arg | ||
|
@@ -292,11 +301,11 @@ def parseKernelLog(): | |
tp = aslib.TestProps() | ||
devtemp = dict() | ||
if(sysvals.dmesgfile): | ||
lf = open(sysvals.dmesgfile, 'r') | ||
lf = open(sysvals.dmesgfile, 'rb') | ||
else: | ||
lf = Popen('dmesg', stdout=PIPE).stdout | ||
for line in lf: | ||
line = line.replace('\r\n', '') | ||
line = aslib.ascii(line).replace('\r\n', '') | ||
# grab the stamp and sysinfo | ||
if re.match(tp.stampfmt, line): | ||
tp.stamp = line | ||
|
@@ -649,7 +658,7 @@ def createBootGraph(data): | |
statinfo += '\t"%s": [\n\t\t"%s",\n' % (n, devstats[n]['info']) | ||
if 'fstat' in devstats[n]: | ||
funcs = devstats[n]['fstat'] | ||
for f in sorted(funcs, key=funcs.get, reverse=True): | ||
for f in sorted(funcs, key=lambda k:(funcs[k], k), reverse=True): | ||
if funcs[f][0] < 0.01 and len(funcs) > 10: | ||
break | ||
statinfo += '\t\t"%f|%s|%d",\n' % (funcs[f][0], f, funcs[f][1]) | ||
|
@@ -729,7 +738,7 @@ def updateCron(restore=False): | |
op.write('@reboot python %s\n' % sysvals.cronjobCmdString()) | ||
op.close() | ||
res = call([cmd, cronfile]) | ||
except Exception, e: | ||
except Exception as e: | ||
pprint('Exception: %s' % str(e)) | ||
shutil.move(backfile, cronfile) | ||
res = -1 | ||
|
@@ -745,7 +754,7 @@ def updateGrub(restore=False): | |
try: | ||
call(sysvals.blexec, stderr=PIPE, stdout=PIPE, | ||
env={'PATH': '.:/sbin:/usr/sbin:/usr/bin:/sbin:/bin'}) | ||
except Exception, e: | ||
except Exception as e: | ||
pprint('Exception: %s\n' % str(e)) | ||
return | ||
# extract the option and create a grub config without it | ||
|
@@ -792,7 +801,7 @@ def updateGrub(restore=False): | |
op.close() | ||
res = call(sysvals.blexec) | ||
os.remove(grubfile) | ||
except Exception, e: | ||
except Exception as e: | ||
pprint('Exception: %s' % str(e)) | ||
res = -1 | ||
# cleanup | ||
|
@@ -866,6 +875,7 @@ def printHelp(): | |
'Other commands:\n'\ | ||
' -flistall Print all functions capable of being captured in ftrace\n'\ | ||
' -sysinfo Print out system info extracted from BIOS\n'\ | ||
' -which exec Print an executable path, should function even without PATH\n'\ | ||
' [redo]\n'\ | ||
' -dmesg file Create HTML output using dmesg input (used with -ftrace)\n'\ | ||
' -ftrace file Create HTML output using ftrace input (used with -dmesg)\n'\ | ||
|
@@ -907,13 +917,13 @@ def printHelp(): | |
sysvals.mincglen = aslib.getArgFloat('-mincg', args, 0.0, 10000.0) | ||
elif(arg == '-cgfilter'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No callgraph functions supplied', True) | ||
sysvals.setCallgraphFilter(val) | ||
elif(arg == '-cgskip'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No file supplied', True) | ||
if val.lower() in switchoff: | ||
|
@@ -924,7 +934,7 @@ def printHelp(): | |
doError('%s does not exist' % cgskip) | ||
elif(arg == '-bl'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No boot loader name supplied', True) | ||
if val.lower() not in ['grub']: | ||
|
@@ -937,7 +947,7 @@ def printHelp(): | |
sysvals.max_graph_depth = aslib.getArgInt('-maxdepth', args, 0, 1000) | ||
elif(arg == '-func'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No filter functions supplied', True) | ||
sysvals.useftrace = True | ||
|
@@ -946,7 +956,7 @@ def printHelp(): | |
sysvals.setGraphFilter(val) | ||
elif(arg == '-ftrace'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No ftrace file supplied', True) | ||
if(os.path.exists(val) == False): | ||
|
@@ -959,7 +969,7 @@ def printHelp(): | |
sysvals.cgexp = True | ||
elif(arg == '-dmesg'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No dmesg file supplied', True) | ||
if(os.path.exists(val) == False): | ||
|
@@ -968,13 +978,13 @@ def printHelp(): | |
sysvals.dmesgfile = val | ||
elif(arg == '-o'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No subdirectory name supplied', True) | ||
sysvals.testdir = sysvals.setOutputFolder(val) | ||
elif(arg == '-result'): | ||
try: | ||
val = args.next() | ||
val = next(args) | ||
except: | ||
doError('No result file supplied', True) | ||
sysvals.result = val | ||
|
@@ -986,6 +996,17 @@ def printHelp(): | |
# remaining options are only for cron job use | ||
elif(arg == '-cronjob'): | ||
sysvals.iscronjob = True | ||
elif(arg == '-which'): | ||
try: | ||
val = next(args) | ||
except: | ||
doError('No executable supplied', True) | ||
out = sysvals.getExec(val) | ||
if not out: | ||
print('%s not found' % val) | ||
sys.exit(1) | ||
print(out) | ||
sys.exit(0) | ||
else: | ||
doError('Invalid argument: '+arg, True) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.