import time
TOTAL_OK = 5
ERRER_LEVEL = 1
COLUMN_EVERY_LINE = 16
COLUMN = 16
lineList = []
def test():
lineNumber = 0
previous = [-2 for i in range(COLUMN_EVERY_LINE)]
total = [0 for i in range(COLUMN_EVERY_LINE)]
with open(r'D:\fastbootlog.bin', 'rb') as f:
line = f.read(COLUMN_EVERY_LINE)
while line:
b = [elem for elem in line]
for index in range(len(b)):
if b[index] - previous[index] == ERRER_LEVEL:
total[index] = total[index] + 1
if TOTAL_OK - 1 == total[index]:
lineIndex = lineNumber - TOTAL_OK + 1
byteIndex = lineIndex * 16
lineList.append([byteIndex + 1, hex(byteIndex), index])
print("lineIndex:%d, columnIndex:%d" %(lineIndex, index))
total[index] = 0
#previous[index] = -2
else:
pass
else:
total[index] = 0
previous[index] = b[index]
line = f.read(COLUMN_EVERY_LINE)
lineNumber = lineNumber + 1;
if __name__ == "__main__":
begin=time.time()
test()
print(lineList)
end=time.time()
print("cost time:",end-begin)
00000000: 5a5a 5a5a 1400 0000 32c3 8501 0032 c385 ZZZZ....2....2..
00000010: 0100 3ec2 8c03 0053 5241 4d00 0000 0000 ..>....SRAM.....
00000020: 0000 0000 0000 00c3 bf07 0000 5b4d 5220 ............[MR
00000030: 1159 5041 5353 5d20 3078 3030 3030 3030 .YPASS] 0x000000
00000040: 1230 0d0a 7363 7379 7373 7461 745f 7661 .0..scsysstat_va
00000050: 1375 650b 305d 2e0d 0a6c 6173 745f 6b65 .ue.0]...last_ke
00000060: 1470 6f0c 6e74 302c 7265 626f 6f74 5f74 .po.nt0,reboot_t
00000070: 1570 650d 0d0a 6462 6720 6e6f 7420 6463 .pe...dbg not dc
00000080: 002e 0d0e 0d0a 2078 6c6f 6164 6572 2063 ...... xloader c
00000090: 6869 700f 643a 2030 7833 3639 3033 3130 hip.d: 0x3690310
000000a0: 302c 2073 7461 7274 3a20 3439 366d 732e 0, start: 496ms.
000000b0: 000a 4275 696c 6420 4461 7465 3a20 4a75 ..Build Date: Ju
000000c0: 0120 3239 2032 3031 392c 2032 313a 3531 . 29 2019, 21:51
000000d0: 0234 340d 0a54 6865 206d 6169 6e20 706d .44..The main pm
000000e0: 0320 7072 6573 656e 7421 0d0a 6b72 696e . present!..krin
000000f0: 0439 3020 5b63 6c6b 5f73 6574 7570 5d0d .90 [clk_setup].
00000100: 0550 4c4c 2053 7461 740d 0a50 4c4c 3220 .PLL Stat..PLL2
00000110: 0674 726c 305b 3078 3430 3238 3135 3038 .trl0[0x40281508
00000120: 073d 3078 3034 3930 3332 3036 2c63 7472 .=0x04903206,ctr
00000130: 0831 5b30 7834 3032 3831 3530 635d 3d30 .1[0x4028150c]=0
00000140: 0930 3330 3030 3030 300d 0a50 4c4c 3320 .03000000..PLL3
00000150: 6374 726c 305b 3078 3430 3238 3135 3130 ctrl0[0x40281510
00000160: 5d3d 3078 3034 3930 3166 3036 2c63 7472 ]=0x04901f06,ctr
00000170: 6c31 5b30 7834 3032 3831 3531 305d 3d30 l1[0x40281510]=0
00000180: 7830 3234 3030 3030 300d 0a50 4c4c 3520 x02400000..PLL5
00000190: 6374 726c 305b 3078 3430 3238 3135 3230 ctrl0[0x40281520
000001a0: 5d3d 3078 3034 3930 3237 3036 2c63 7472 ]=0x04902706,ctr
000001b0: 6c31 5b30 7834 3032 3831 3532 345d 3d30 l1[0x40281524]=0
000001c0: 7830 3231 3030 0030 300d 0a50 4c4c 3620 x02100.00..PLL6
000001d0: 6374 726c 305b 0178 3430 3238 3135 3238 ctrl0[.x40281528
000001e0: 5d3d 3078 3034 0230 3263 3036 2c63 7472 ]=0x04.02c06,ctr
000001f0: 6c31 5b30 7834 0332 3831 3532 635d 3d30 l1[0x4.28152c]=0
00000200: 7830 3263 6161 0461 610d 0a50 4c4c 3720 x02caa.aa..PLL7
00000210: 6374 726c 305b 0578 3430 3238 3135 3330 ctrl0[.x40281530
00000220: 5d3d 3078 3034 0630 3231 3036 2c63 7472 ]=0x04.02106,ctr
00000230: 6c31 5b30 7834 3032 3831 3533 345d 3d30 l1[0x40281534]=0
00000240: 7830 3239 3766 6666 660d 0a53 4350 4c4c x0297ffff..SCPLL
00000250: 2063 7472 6c30 5b30 7862 3831 3830 3230 ctrl0[0xb818020
00000260: 305d 3d30 7830 3062 3031 6530 352c 6374 0]=0x00b01e05,ct
00000270: 726c 315b 3078 6238 3138 3032 3034 5d3d rl1[0xb8180204]=
00000280: 3078 3065 6238 3531 6562 0d0a 504c 4c20 0x0eb851eb..PLL
00000290: 6163 7075 2030 7839 3530 205b 3078 3430 acpu 0x950 [0x40
000002a0: 3238 3539 3530 5d3d 3a30 7830 3065 6431 285950]=:0x00ed1
000002b0: 3266 660d 0a50 4c4c 2066 696e 616c 2072 2ff..PLL final r
000002c0: 6567 2030 7834 3663 205b 3078 3430 3238 eg 0x46c [0x4028
000002d0: 3534 3663 5d3a 3078 3030 3337 6666 6666 546c]:0x0037ffff
000002e0: 0d0a 5043 4945 2050 4c4c 2066 696e 616c ..PCIE PLL final
000002f0: 2072 6567 205b 3078 6238 3138 3032 3038 reg [0xb8180208
00000300: 5d3a 3078 3030 3030 3030 3462 0d0a 4849 ]:0x0000004b..HI
00000310: 5345 4520 5345 4320 7265 6720 5b30 7834 SEE SEC reg [0x4
00000320: 0a