Skip to content

Commit 5f04d25

Browse files
committed
Top-N memory consumer feature
1 parent 224078c commit 5f04d25

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

MC/utils/o2dpg_sim_metrics.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,19 @@ def print_statistics(resource_object):
773773
print ("Mean-CPU (cores): ", mean_cpu)
774774
print ("Max-CPU (cores): ", max_cpu)
775775
print ("CPU-efficiency: ", mean_cpu / meta["cpu_limit"])
776+
777+
#(c) Top N memory consumers by name
778+
top_n = 5
779+
top_mem = (
780+
dframe.groupby('name')['pss']
781+
.max() # peak PSS for each component
782+
.sort_values(ascending=False) # sort by memory usage
783+
.head(top_n)
784+
)
785+
786+
print(f"\nTop-{top_n} memory consumers (by peak PSS):")
787+
for comp, mem in top_mem.items():
788+
print(f" {comp:<20s} {mem:10.2f} MB")
776789
print ("---> ")
777790

778791
def stat(args):

0 commit comments

Comments
 (0)