1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[opt-viewer] Print allocated memory per remark in opt-stats.py

If heapy is installed print the "average" in-memory remark size.  This is
estimated by dividing the total heap size by the number of unique remarks.

llvm-svn: 308537
This commit is contained in:
Adam Nemet 2017-07-19 22:04:58 +00:00
parent 961ab77c75
commit c8a609b98e

View File

@ -13,6 +13,13 @@ import operator
from collections import defaultdict
from multiprocessing import cpu_count, Pool
try:
from guppy import hpy
hp = hpy()
except ImportError:
print("Memory consumption not shown because guppy is not installed")
hp = None
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
@ -53,7 +60,12 @@ if __name__ == '__main__':
byname[r.Pass + "/" + r.Name] += 1
total = len(all_remarks)
print("{:24s} {:10d}\n".format("Total number of remarks", total))
print("{:24s} {:10d}".format("Total number of remarks", total))
if hp:
h = hp.heap()
print("{:24s} {:10d}".format("Memory per remark",
h.size / len(all_remarks)))
print('\n')
print("Top 10 remarks by pass:")
for (passname, count) in sorted(bypass.items(), key=operator.itemgetter(1),