diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2009-01-19 13:00:42 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2009-01-19 13:00:42 -0500 |
commit | 76f0bedf427cf43f39a08b28addd9537a9f675af (patch) | |
tree | 67ce11c5ec65fbaf9da1478da7489292498705d3 /tools | |
parent | 590e715d4a986528aa9ca8d3276e368361d1c7c7 (diff) | |
download | seabios-76f0bedf427cf43f39a08b28addd9537a9f675af.tar.gz |
Minor - improve space used reporting in tools/layoutrom.py.
The used space calculation was slightly wrong in cases of non-zero
section alignment. Redo calculation using a more straight-forward
approach.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/layoutrom.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/layoutrom.py b/tools/layoutrom.py index 78489579..bdafec0a 100755 --- a/tools/layoutrom.py +++ b/tools/layoutrom.py @@ -77,10 +77,11 @@ def doLayout(sections, outname): # Attempt to fit other sections into fixed area fixedAddr.sort() canrelocate.sort() - unused = 0 + totalused = 0 for freespace, fixedsectioninfo in fixedAddr: fixedaddr, fixedsection, extrasections = fixedsectioninfo addpos = fixedaddr + fixedsection[0] + totalused += fixedsection[0] nextfixedaddr = addpos + freespace # print "Filling section %x uses %d, next=%x, available=%d" % ( # fixedaddr, fixedsection[0], nextfixedaddr, freespace) @@ -100,7 +101,6 @@ def doLayout(sections, outname): continue canfit = (fitnextaddr, fixedaddrinfo) if canfit is None: - unused += nextfixedaddr - addpos break # Found a section that can fit. fitnextaddr, fixedaddrinfo = canfit @@ -109,13 +109,13 @@ def doLayout(sections, outname): inlist.remove(fitsection) extrasections.append(fitsection) addpos = fitnextaddr - unused += alignpos(addpos, fitsection[1]) - addpos -# print " Adding %s (size %d align %d)" % ( -# fitsection[2], fitsection[0], fitsection[1]) + totalused += fitsection[0] +# print " Adding %s (size %d align %d) pos=%x avail=%d" % ( +# fitsection[2], fitsection[0], fitsection[1] +# , fitnextaddr, nextfixedaddr - fitnextaddr) firstfixed = fixedsections[0][0] total = MAXPOS-firstfixed - totalused = total - unused print "Fixed space: 0x%x-0x%x total: %d used: %d Percent used: %.1f%%" % ( firstfixed, MAXPOS, total, totalused, (float(totalused) / total) * 100.0) |