@@ -86,7 +86,7 @@ def ascii(text):
86
86
# store system values and test parameters
87
87
class SystemValues :
88
88
title = 'SleepGraph'
89
- version = '5.11 '
89
+ version = '5.12 '
90
90
ansi = False
91
91
rs = 0
92
92
display = ''
@@ -1181,8 +1181,8 @@ def turbostat(self, s0ixready):
1181
1181
cmd = self .getExec ('turbostat' )
1182
1182
rawout = keyline = valline = ''
1183
1183
fullcmd = '%s -q -S echo freeze > %s' % (cmd , self .powerfile )
1184
- fp = Popen (['sh' , '-c' , fullcmd ], stdout = PIPE , stderr = PIPE ). stderr
1185
- for line in fp :
1184
+ fp = Popen (['sh' , '-c' , fullcmd ], stdout = PIPE , stderr = PIPE )
1185
+ for line in fp . stderr :
1186
1186
line = ascii (line )
1187
1187
rawout += line
1188
1188
if keyline and valline :
@@ -1191,13 +1191,13 @@ def turbostat(self, s0ixready):
1191
1191
keyline = line .strip ().split ()
1192
1192
elif keyline :
1193
1193
valline = line .strip ().split ()
1194
- fp .close ()
1194
+ fp .wait ()
1195
1195
if not keyline or not valline or len (keyline ) != len (valline ):
1196
1196
errmsg = 'unrecognized turbostat output:\n ' + rawout .strip ()
1197
1197
self .vprint (errmsg )
1198
1198
if not self .verbose :
1199
1199
pprint (errmsg )
1200
- return ''
1200
+ return ( fp . returncode , '' )
1201
1201
if self .verbose :
1202
1202
pprint (rawout .strip ())
1203
1203
out = []
@@ -1207,7 +1207,7 @@ def turbostat(self, s0ixready):
1207
1207
if key == 'SYS%LPI' and not s0ixready and re .match ('^[0\.]*$' , val ):
1208
1208
continue
1209
1209
out .append ('%s=%s' % (key , val ))
1210
- return '|' .join (out )
1210
+ return ( fp . returncode , '|' .join (out ) )
1211
1211
def netfixon (self , net = 'both' ):
1212
1212
cmd = self .getExec ('netfix' )
1213
1213
if not cmd :
@@ -4343,7 +4343,8 @@ def createHTMLSummarySimple(testruns, htmlfile, title):
4343
4343
list [mode ]['data' ].append ([data ['host' ], data ['kernel' ],
4344
4344
data ['time' ], tVal [0 ], tVal [1 ], data ['url' ], res ,
4345
4345
data ['issues' ], data ['sus_worst' ], data ['sus_worsttime' ],
4346
- data ['res_worst' ], data ['res_worsttime' ], pkgpc10 , syslpi , wifi ])
4346
+ data ['res_worst' ], data ['res_worsttime' ], pkgpc10 , syslpi , wifi ,
4347
+ (data ['fullmode' ] if 'fullmode' in data else mode )])
4347
4348
idx = len (list [mode ]['data' ]) - 1
4348
4349
if res .startswith ('fail in' ):
4349
4350
res = 'fail'
@@ -4449,7 +4450,7 @@ def createHTMLSummarySimple(testruns, htmlfile, title):
4449
4450
elif idx == iMed [i ]:
4450
4451
tHigh [i ] = ' id="%smed" class=medval title="Median"' % tag
4451
4452
html += td .format ("%d" % (list [mode ]['data' ].index (d ) + 1 )) # row
4452
- html += td .format (mode ) # mode
4453
+ html += td .format (d [ 15 ]) # mode
4453
4454
html += td .format (d [0 ]) # host
4454
4455
html += td .format (d [1 ]) # kernel
4455
4456
html += td .format (d [2 ]) # time
@@ -5524,14 +5525,17 @@ def executeSuspend(quiet=False):
5524
5525
if ((mode == 'freeze' ) or (sv .memmode == 's2idle' )) \
5525
5526
and sv .haveTurbostat ():
5526
5527
# execution will pause here
5527
- turbo = sv .turbostat (s0ixready )
5528
+ retval , turbo = sv .turbostat (s0ixready )
5529
+ if retval != 0 :
5530
+ tdata ['error' ] = 'turbostat returned %d' % retval
5528
5531
if turbo :
5529
5532
tdata ['turbo' ] = turbo
5530
5533
else :
5531
5534
pf = open (sv .powerfile , 'w' )
5532
5535
pf .write (mode )
5533
5536
# execution will pause here
5534
5537
try :
5538
+ pf .flush ()
5535
5539
pf .close ()
5536
5540
except Exception as e :
5537
5541
tdata ['error' ] = str (e )
@@ -5702,6 +5706,40 @@ def getModes():
5702
5706
fp .close ()
5703
5707
return modes
5704
5708
5709
+ def dmidecode_backup (out , fatal = False ):
5710
+ cpath , spath , info = '/proc/cpuinfo' , '/sys/class/dmi/id' , {
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' ,
5725
+ }
5726
+ for key in info :
5727
+ if key not in out :
5728
+ val = sysvals .getVal (os .path .join (spath , info [key ])).strip ()
5729
+ if val and val .lower () != 'to be filled by o.e.m.' :
5730
+ out [key ] = val
5731
+ if 'processor-version' not in out and os .path .exists (cpath ):
5732
+ with open (cpath , 'r' ) as fp :
5733
+ for line in fp :
5734
+ m = re .match ('^model\s*name\s*\:\s*(?P<c>.*)' , line )
5735
+ if m :
5736
+ out ['processor-version' ] = m .group ('c' ).strip ()
5737
+ break
5738
+ if fatal and len (out ) < 1 :
5739
+ doError ('dmidecode failed to get info from %s or %s' % \
5740
+ (sysvals .mempath , spath ))
5741
+ return out
5742
+
5705
5743
# Function: dmidecode
5706
5744
# Description:
5707
5745
# Read the bios tables and pull out system info
@@ -5712,6 +5750,8 @@ def getModes():
5712
5750
# A dict object with all available key/values
5713
5751
def dmidecode (mempath , fatal = False ):
5714
5752
out = dict ()
5753
+ if (not (os .path .exists (mempath ) and os .access (mempath , os .R_OK ))):
5754
+ return dmidecode_backup (out , fatal )
5715
5755
5716
5756
# the list of values to retrieve, with hardcoded (type, idx)
5717
5757
info = {
@@ -5727,24 +5767,14 @@ def dmidecode(mempath, fatal=False):
5727
5767
'baseboard-version' : (2 , 6 ),
5728
5768
'baseboard-serial-number' : (2 , 7 ),
5729
5769
'chassis-manufacturer' : (3 , 4 ),
5730
- 'chassis-type' : (3 , 5 ),
5731
5770
'chassis-version' : (3 , 6 ),
5732
5771
'chassis-serial-number' : (3 , 7 ),
5733
5772
'processor-manufacturer' : (4 , 7 ),
5734
5773
'processor-version' : (4 , 16 ),
5735
5774
}
5736
- if (not os .path .exists (mempath )):
5737
- if (fatal ):
5738
- doError ('file does not exist: %s' % mempath )
5739
- return out
5740
- if (not os .access (mempath , os .R_OK )):
5741
- if (fatal ):
5742
- doError ('file is not readable: %s' % mempath )
5743
- return out
5744
5775
5745
5776
# by default use legacy scan, but try to use EFI first
5746
- memaddr = 0xf0000
5747
- memsize = 0x10000
5777
+ memaddr , memsize = 0xf0000 , 0x10000
5748
5778
for ep in ['/sys/firmware/efi/systab' , '/proc/efi/systab' ]:
5749
5779
if not os .path .exists (ep ) or not os .access (ep , os .R_OK ):
5750
5780
continue
@@ -5765,11 +5795,7 @@ def dmidecode(mempath, fatal=False):
5765
5795
fp .seek (memaddr )
5766
5796
buf = fp .read (memsize )
5767
5797
except :
5768
- if (fatal ):
5769
- doError ('DMI table is unreachable, sorry' )
5770
- else :
5771
- pprint ('WARNING: /dev/mem is not readable, ignoring DMI data' )
5772
- return out
5798
+ return dmidecode_backup (out , fatal )
5773
5799
fp .close ()
5774
5800
5775
5801
# search for either an SM table or DMI table
@@ -5785,22 +5811,15 @@ def dmidecode(mempath, fatal=False):
5785
5811
break
5786
5812
i += 16
5787
5813
if base == 0 and length == 0 and num == 0 :
5788
- if (fatal ):
5789
- doError ('Neither SMBIOS nor DMI were found' )
5790
- else :
5791
- return out
5814
+ return dmidecode_backup (out , fatal )
5792
5815
5793
5816
# read in the SM or DMI table
5794
5817
try :
5795
5818
fp = open (mempath , 'rb' )
5796
5819
fp .seek (base )
5797
5820
buf = fp .read (length )
5798
5821
except :
5799
- if (fatal ):
5800
- doError ('DMI table is unreachable, sorry' )
5801
- else :
5802
- pprint ('WARNING: /dev/mem is not readable, ignoring DMI data' )
5803
- return out
5822
+ return dmidecode_backup (out , fatal )
5804
5823
fp .close ()
5805
5824
5806
5825
# scan the table for the values we want
@@ -6272,7 +6291,10 @@ def find_in_html(html, start, end, firstonly=True):
6272
6291
return out
6273
6292
6274
6293
def data_from_html (file , outpath , issues , fulldetail = False ):
6275
- html = open (file , 'r' ).read ()
6294
+ try :
6295
+ html = open (file , 'r' ).read ()
6296
+ except :
6297
+ html = ascii (open (file , 'rb' ).read ())
6276
6298
sysvals .htmlfile = os .path .relpath (file , outpath )
6277
6299
# extract general info
6278
6300
suspend = find_in_html (html , 'Kernel Suspend' , 'ms' )
@@ -6307,8 +6329,9 @@ def data_from_html(file, outpath, issues, fulldetail=False):
6307
6329
d .end = 999999999
6308
6330
d .dmesgtext = log .split ('\n ' )
6309
6331
tp = d .extractErrorInfo ()
6310
- for msg in tp .msglist :
6311
- sysvals .errorSummary (issues , msg )
6332
+ if len (issues ) < 100 :
6333
+ for msg in tp .msglist :
6334
+ sysvals .errorSummary (issues , msg )
6312
6335
if stmp [2 ] == 'freeze' :
6313
6336
extra = d .turbostatInfo ()
6314
6337
elist = dict ()
@@ -6325,6 +6348,11 @@ def data_from_html(file, outpath, issues, fulldetail=False):
6325
6348
line = find_in_html (log , '# netfix ' , '\n ' )
6326
6349
if line :
6327
6350
extra ['netfix' ] = line
6351
+ line = find_in_html (log , '# command ' , '\n ' )
6352
+ if line :
6353
+ m = re .match ('.* -m (?P<m>\S*).*' , line )
6354
+ if m :
6355
+ extra ['fullmode' ] = m .group ('m' )
6328
6356
low = find_in_html (html , 'freeze time: <b>' , ' ms</b>' )
6329
6357
for lowstr in ['waking' , '+' ]:
6330
6358
if not low :
0 commit comments