Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
avg_cpu_sender_zmq = pd.read_csv('sender_usage.csv')['cpu_percent'].mean()
avg_mem_sender_zmq = pd.read_csv('sender_usage.csv')['memory_mb'].mean()

# In a real test, you would also measure the receiver. For simplicity, we plot sender.
# avg_cpu_receiver_zmq = pd.read_csv('receiver_zmq_usage.csv')['cpu_percent'].mean()
# avg_mem_receiver_zmq = pd.read_csv('receiver_zmq_usage.csv')['memory_mb'].mean()

# Create placeholder data for Mediator until you run the test
avg_cpu_sender_mediator = 25.5 # Example value
avg_mem_sender_mediator = 60.2 # Example value
avg_mem_sender_mediator = 60.2 # Example value

except FileNotFoundError:
print("One or more CSV files not found. Using placeholder data.")
# Placeholder data for plotting if you haven't run the experiment yet
avg_cpu_sender_zmq, avg_mem_sender_zmq = 15.0, 45.0
avg_cpu_sender_mediator, avg_mem_sender_mediator = 25.5, 60.2

Expand All @@ -30,13 +24,16 @@
df_plot = pd.DataFrame(data)

# Create the grouped bar chart
plt.figure(figsize=(10, 7))
plt.figure(figsize=(8.27, 11.69)) # A4 size in inches (210mm x 297mm)
sns.barplot(x='Metric', y='Value', hue='Protocol', data=df_plot, palette={'Mediator': '#F44336', 'ZeroMQ': '#4CAF50'})

plt.title('Figure 5: Resource Utilization During Throughput Test (Sender)', fontsize=16)
plt.xlabel('Performance Metric', fontsize=12)
plt.ylabel('Average Usage', fontsize=12)
plt.legend(title='Protocol')
plt.xlabel('Performance Metric', fontsize=14)
plt.ylabel('Average Usage', fontsize=14)
plt.legend(title='Protocol', fontsize=12, title_fontsize=12)
plt.grid(axis='y', linestyle='--', alpha=0.7)

plt.show()
plt.tight_layout()

# Save to PDF
plt.savefig("resource_utilization.pdf", format="pdf")
plt.show()
Binary file added measurements/CPU/resource_utilization.pdf
Binary file not shown.
47 changes: 47 additions & 0 deletions measurements/Latency/latencyDistributionComparison.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

def generate_comparison_plot():
"""
Loads latency data for ZeroMQ and Mediator protocols,
and generates a comparative violin plot saved as A4 PDF.
"""
try:
df_zmq = pd.read_csv('zeromq_latencies.csv')
df_zmq['Protocol'] = 'ZeroMQ'

df_mediator = pd.read_csv('mediator_latencies.csv')
df_mediator['Protocol'] = 'Mediator'

except FileNotFoundError as e:
print("Error: Missing latency CSV file(s). Place 'zeromq_latencies.csv' and 'mediator_latencies.csv' in the same directory.")
print(f"Details: {e}")
return

df_combined = pd.concat([df_zmq, df_mediator], ignore_index=True)

print("Generating plot...")
plt.figure(figsize=(8.27, 11.69)) # A4 size in inches

sns.violinplot(
x='Protocol',
y='Latency (ms)',
data=df_combined,
palette={'ZeroMQ': '#4CAF50', 'Mediator': '#F44336'}
)

plt.xlabel('Communication Protocol', fontsize=14)
plt.ylabel('Round-Trip Latency (ms)', fontsize=14)
plt.xticks(fontsize=12)
plt.yticks(fontsize=12)
plt.grid(True, which='major', linestyle='--', linewidth=0.5, color='grey')

plt.tight_layout()
plt.savefig('latency_comparison.pdf', format='pdf')
print("Plot saved as 'latency_comparison.pdf'")

plt.show()

if __name__ == '__main__':
generate_comparison_plot()
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,35 @@
# Load the collected data
try:
df_zmq = pd.read_csv('zeromq_latencies.csv')
df_zmq['Protocol'] = 'ZeroMQ' # Add a column to identify the protocol
df_zmq['Protocol'] = 'ZeroMQ'
except FileNotFoundError:
print("Error: zeromq_latencies.csv not found. Please run the experiment first.")
exit()

# It's good practice to filter out extreme outliers if they exist,
# for example, values over a certain threshold that might be due to a one-off system lag.
# For now, we will plot all the data.

# Create the plot
plt.figure(figsize=(8, 7))
sns.violinplot(x='Protocol', y='Latency (ms)', data=df_zmq, palette=['#4CAF50'])
plt.figure(figsize=(8.27, 11.69)) # A4 size in inches

sns.violinplot(
x='Protocol',
y='Latency (ms)',
data=df_zmq,
palette=['#4CAF50']
)

# Add details to the plot
plt.title('Latency Distribution of ZeroMQ Protocol', fontsize=16)
plt.xlabel('')
plt.ylabel('Round-Trip Latency (ms)', fontsize=12)
plt.ylabel('Round-Trip Latency (ms)', fontsize=14)
plt.grid(True, linestyle='--', alpha=0.6)
plt.xticks(fontsize=12)
plt.yticks(fontsize=12)

plt.tight_layout()

# Save to PDF
plt.savefig('zmq_latency.pdf', format='pdf')
print("Plot saved as 'zmq_latency.pdf'")

# Calculate and print statistics to include in your paper
# Calculate and print stats for your paper
median_val = df_zmq['Latency (ms)'].median()
mean_val = df_zmq['Latency (ms)'].mean()
std_val = df_zmq['Latency (ms)'].std()
Expand Down
Binary file added measurements/Latency/latency_comparison.pdf
Binary file not shown.
53 changes: 0 additions & 53 deletions measurements/Latency/plot_fig3(1).py

This file was deleted.

Binary file added measurements/Latency/zmq_latency.pdf
Binary file not shown.
41 changes: 41 additions & 0 deletions measurements/Throughput/maximumThroughputComaprison.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import matplotlib.pyplot as plt

# --- Enter your collected data here ---
throughput_mediator = 15.7 # messages/sec
throughput_zmq = 25432.1 # messages/sec
# -------------------------------------

protocols = ['Mediator', 'ZeroMQ']
values = [throughput_mediator, throughput_zmq]
colors = ['#F44336', '#4CAF50']

plt.figure(figsize=(8.27, 11.69)) # A4 size in inches

bars = plt.bar(protocols, values, color=colors)

# Add plot details
plt.ylabel('Throughput (Messages/Second)', fontsize=14)
plt.title('Figure 6: Maximum Throughput Comparison', fontsize=18, pad=25)
plt.xticks(fontsize=12)
plt.yscale('log') # log scale for large differences
plt.grid(axis='y', linestyle='--', alpha=0.7)

# Add text labels on top of the bars
for bar in bars:
yval = bar.get_height()
plt.text(
bar.get_x() + bar.get_width() / 2.0,
yval,
f'{yval:,.0f}',
va='bottom',
ha='center',
fontsize=12
)

plt.tight_layout()

# Save the figure as PDF
plt.savefig('throughput_comparison.pdf', format='pdf')
print("Plot saved as 'throughput_comparison.pdf'")

plt.show()
34 changes: 0 additions & 34 deletions measurements/Throughput/plot_fig4.py

This file was deleted.

Binary file added measurements/Throughput/throughput_comparison.pdf
Binary file not shown.