Skip to content

Commit 6f09752

Browse files
Fixed VmaDumpVis.py to respect new "Algorithm" parameter.
1 parent 0591535 commit 6f09752

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

tools/VmaDumpVis/VmaDumpVis.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@
4646
data = {}
4747

4848

49-
def ProcessBlock(dstBlockList, iBlockId, objBlock, bLinearAlgorithm):
49+
def ProcessBlock(dstBlockList, iBlockId, objBlock, sAlgorithm):
5050
iBlockSize = int(objBlock['TotalBytes'])
5151
arrSuballocs = objBlock['Suballocations']
5252
dstBlockObj = {'ID': iBlockId, 'Size':iBlockSize, 'Suballocations':[]}
53-
if bLinearAlgorithm:
54-
dstBlockObj['LinearAlgorithm'] = True
53+
dstBlockObj['Algorithm'] = sAlgorithm
5554
for objSuballoc in arrSuballocs:
5655
dstBlockObj['Suballocations'].append((objSuballoc['Type'], int(objSuballoc['Size']), int(objSuballoc['Usage']) if ('Usage' in objSuballoc) else 0))
5756
dstBlockList.append(dstBlockObj)
@@ -187,18 +186,18 @@ def BytesToStr(iBytes):
187186
iType = int(sType[5:])
188187
typeData = GetDataForMemoryType(iType)
189188
for sBlockId, objBlock in tType[1]['Blocks'].items():
190-
ProcessBlock(typeData['DefaultPoolBlocks'], int(sBlockId), objBlock, False)
189+
ProcessBlock(typeData['DefaultPoolBlocks'], int(sBlockId), objBlock, '')
191190
if 'Pools' in jsonSrc:
192191
objPools = jsonSrc['Pools']
193192
for sPoolId, objPool in objPools.items():
194193
iType = int(objPool['MemoryTypeIndex'])
195194
typeData = GetDataForMemoryType(iType)
196195
objBlocks = objPool['Blocks']
197-
bLinearAlgorithm = 'LinearAlgorithm' in objPool and objPool['LinearAlgorithm']
196+
sAlgorithm = objPool.get('Algorithm', '')
198197
dstBlockArray = []
199198
typeData['CustomPools'][int(sPoolId)] = dstBlockArray
200199
for sBlockId, objBlock in objBlocks.items():
201-
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, bLinearAlgorithm)
200+
ProcessBlock(dstBlockArray, int(sBlockId), objBlock, sAlgorithm)
202201

203202
iImgSizeY, fPixelsPerByte = CalcParams()
204203

@@ -247,11 +246,11 @@ def BytesToStr(iBytes):
247246
index = 0
248247
for iPoolId, listPool in dictMemType['CustomPools'].items():
249248
for objBlock in listPool:
250-
if 'LinearAlgorithm' in objBlock:
251-
linearAlgorithmStr = ' (linear algorithm)';
249+
if 'Algorithm' in objBlock:
250+
sAlgorithm = ' (Algorithm: %s)' % (objBlock['Algorithm']);
252251
else:
253-
linearAlgorithmStr = '';
254-
draw.text((IMG_MARGIN, y), "Custom pool %d%s block %d" % (iPoolId, linearAlgorithmStr, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)
252+
sAlgorithm = '';
253+
draw.text((IMG_MARGIN, y), "Custom pool %d%s block %d" % (iPoolId, sAlgorithm, objBlock['ID']), fill=COLOR_TEXT_H2, font=font)
255254
y += FONT_SIZE + IMG_MARGIN
256255
DrawBlock(draw, y, objBlock)
257256
y += MAP_SIZE + IMG_MARGIN
@@ -273,6 +272,6 @@ def BytesToStr(iBytes):
273272
- Key is integer pool ID. Value is list of objects representing memory blocks, each containing dictionary with:
274273
- Fixed key 'ID'. Value is int.
275274
- Fixed key 'Size'. Value is int.
276-
- Fixed key 'LinearAlgorithm'. Optional. Value is True.
275+
- Fixed key 'Algorithm'. Optional. Value is string.
277276
- Fixed key 'Suballocations'. Value is list of tuples as above.
278277
"""

0 commit comments

Comments
 (0)