import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

# Load the data
df = pd.read_csv('../data/resources.txt', sep='\s+')

df['util'] = df['nodeMem']/df['Mem']*100

counts, bins = np.histogram(df['util'], bins=30)

# Plot the histogram
plt.barh(bins[:-1], counts, height=(bins[1]-bins[0]), edgecolor='black')

# Add titles and labels
plt.title("Distribution of tenants based on maximum memory utilization")
plt.ylabel('Memory Utilization')
plt.xlabel('Number of Tenants')

# Save the plot as a PNG file
plt.savefig('../img/memUtil.png')

# Show the plot
plt.show()
