Skip to content

Commit f831a2e

Browse files
committed
Measurements Folder Added
1 parent e1a0bf3 commit f831a2e

40 files changed

+4397
-0
lines changed

measurements/CPU/Figure5.png

37.6 KB
Loading
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd" xmlns:y="http://www.yworks.com/xml/graphml">
3+
<key for="node" id="d6" yfiles.type="nodegraphics"/>
4+
<key for="edge" id="d10" yfiles.type="edgegraphics"/>
5+
<graph edgedefault="directed" id="1751872458057" projectName="client" authorName="saksham">
6+
<node id="89497d28-c120-4d48-aa23-a071261aa603">
7+
<data key="d6">
8+
<y:ShapeNode>
9+
<y:Geometry height="50" width="233" x="487" y="313"/>
10+
<y:Fill color="#ffcc00" opacity="1"/>
11+
<y:BorderStyle color="#000" width="1"/>
12+
<y:NodeLabel>B:funbody_cpu.py</y:NodeLabel>
13+
<y:Shape type="rectangle"/>
14+
</y:ShapeNode>
15+
</data>
16+
</node>
17+
<node id="2196c146-180c-4d14-bbaa-340f76e14809">
18+
<data key="d6">
19+
<y:ShapeNode>
20+
<y:Geometry height="50" width="100" x="107" y="102"/>
21+
<y:Fill color="#ffcc00" opacity="1"/>
22+
<y:BorderStyle color="#000" width="1"/>
23+
<y:NodeLabel>OUT:</y:NodeLabel>
24+
<y:Shape type="rectangle"/>
25+
</y:ShapeNode>
26+
</data>
27+
</node>
28+
<edge id="0" source="89497d28-c120-4d48-aa23-a071261aa603" target="2196c146-180c-4d14-bbaa-340f76e14809">
29+
<data key="d10">
30+
<y:GenericEdge configuration="com.yworks.bpmn.Connection">
31+
<y:LineStyle width="1" type="solid"/>
32+
<y:Arrows source="none" target="delta"/>
33+
<y:EdgeLabel>0x2306_U1</y:EdgeLabel>
34+
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
35+
<y:Point x="274.4881516587678" y="195.00000000000006"/>
36+
</y:Path>
37+
</y:GenericEdge>
38+
</data>
39+
</edge>
40+
<actionHistory>
41+
<tid>1751825758771</tid>
42+
<inverse>
43+
<actionName>DEL_NODE</actionName>
44+
<parameters>WyI4OTQ5N2QyOC1jMTIwLTRkNDgtYWEyMy1hMDcxMjYxYWE2MDMiXQ==</parameters>
45+
</inverse>
46+
<equivalent>
47+
<actionName>ADD_NODE</actionName>
48+
<parameters>WyJCOmZ1bmJvZHlfdGhyb3VnaHB1dF90ZXN0LnB5Iix7IndpZHRoIjoyMzMsImhlaWdodCI6NTAsInNoYXBlIjoicmVjdGFuZ2xlIiwib3BhY2l0eSI6MSwiYmFja2dyb3VuZENvbG9yIjoiI2ZmY2MwMCIsImJvcmRlckNvbG9yIjoiIzAwMCIsImJvcmRlcldpZHRoIjoxfSwib3JkaW4iLHsieCI6NDg3LCJ5IjozMTN9LHt9LCI4OTQ5N2QyOC1jMTIwLTRkNDgtYWEyMy1hMDcxMjYxYWE2MDMiXQ==</parameters>
49+
</equivalent>
50+
<hash>e425a002ed1453f66a4fb1dad3ad2923</hash>
51+
</actionHistory>
52+
<actionHistory>
53+
<tid>1751825761336</tid>
54+
<inverse>
55+
<actionName>SET_POS</actionName>
56+
<parameters>WyI4OTQ5N2QyOC1jMTIwLTRkNDgtYWEyMy1hMDcxMjYxYWE2MDMiLHsieCI6MTAwLCJ5IjoxMDB9LHsieCI6NDg3LCJ5IjozMTN9XQ==</parameters>
57+
</inverse>
58+
<equivalent>
59+
<actionName>SET_POS</actionName>
60+
<parameters>WyI4OTQ5N2QyOC1jMTIwLTRkNDgtYWEyMy1hMDcxMjYxYWE2MDMiLHsieCI6NDg3LCJ5IjozMTN9LHsieCI6MTAwLCJ5IjoxMDB9XQ==</parameters>
61+
</equivalent>
62+
<hash>d7861c7337345a2010806e89311d85bf</hash>
63+
</actionHistory>
64+
<actionHistory>
65+
<tid>1751825767651</tid>
66+
<inverse>
67+
<actionName>DEL_NODE</actionName>
68+
<parameters>WyIyMTk2YzE0Ni0xODBjLTRkMTQtYmJhYS0zNDBmNzZlMTQ4MDkiXQ==</parameters>
69+
</inverse>
70+
<equivalent>
71+
<actionName>ADD_NODE</actionName>
72+
<parameters>WyJPVVQ6Iix7IndpZHRoIjoxMDAsImhlaWdodCI6NTAsInNoYXBlIjoicmVjdGFuZ2xlIiwib3BhY2l0eSI6MSwiYmFja2dyb3VuZENvbG9yIjoiI2ZmY2MwMCIsImJvcmRlckNvbG9yIjoiIzAwMCIsImJvcmRlcldpZHRoIjoxfSwib3JkaW4iLHsieCI6MTA3LCJ5IjoxMDJ9LHt9LCIyMTk2YzE0Ni0xODBjLTRkMTQtYmJhYS0zNDBmNzZlMTQ4MDkiXQ==</parameters>
73+
</equivalent>
74+
<hash>19b85e105d5758f18c55915fbce84663</hash>
75+
</actionHistory>
76+
<actionHistory>
77+
<tid>1751825770936</tid>
78+
<inverse>
79+
<actionName>SET_POS</actionName>
80+
<parameters>WyIyMTk2YzE0Ni0xODBjLTRkMTQtYmJhYS0zNDBmNzZlMTQ4MDkiLHsieCI6MTAwLCJ5IjoxMDB9LHsieCI6MTA3LCJ5IjoxMDJ9XQ==</parameters>
81+
</inverse>
82+
<equivalent>
83+
<actionName>SET_POS</actionName>
84+
<parameters>WyIyMTk2YzE0Ni0xODBjLTRkMTQtYmJhYS0zNDBmNzZlMTQ4MDkiLHsieCI6MTA3LCJ5IjoxMDJ9LHsieCI6MTAwLCJ5IjoxMDB9XQ==</parameters>
85+
</equivalent>
86+
<hash>03b8818572c5800d88c583073a1ef559</hash>
87+
</actionHistory>
88+
<actionHistory>
89+
<tid>1751825773370</tid>
90+
<inverse>
91+
<actionName>DEL_EDGE</actionName>
92+
<parameters>WyI5MWE2MzJkYS0wZDgwLTQ3NzctYmQyZi05MDhiMGY1ZDgwOGQiXQ==</parameters>
93+
</inverse>
94+
<equivalent>
95+
<actionName>ADD_EDGE</actionName>
96+
<parameters>W3sic291cmNlSUQiOiI4OTQ5N2QyOC1jMTIwLTRkNDgtYWEyMy1hMDcxMjYxYWE2MDMiLCJ0YXJnZXRJRCI6IjIxOTZjMTQ2LTE4MGMtNGQxNC1iYmFhLTM0MGY3NmUxNDgwOSIsImxhYmVsIjoiMHgyMzAwX1UxIiwic3R5bGUiOnsidGhpY2tuZXNzIjoxLCJiYWNrZ3JvdW5kQ29sb3IiOm51bGwsInNoYXBlIjoic29saWQifSwiaWQiOiI5MWE2MzJkYS0wZDgwLTQ3NzctYmQyZi05MDhiMGY1ZDgwOGQifV0=</parameters>
97+
</equivalent>
98+
<hash>1dd8b4edaeed282d75d1daeb3195b728</hash>
99+
</actionHistory>
100+
<actionHistory>
101+
<tid>1751826367735</tid>
102+
<inverse>
103+
<actionName>UPDATE_EDGE</actionName>
104+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwMF9VMSIsdHJ1ZV0=</parameters>
105+
</inverse>
106+
<equivalent>
107+
<actionName>UPDATE_EDGE</actionName>
108+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwMV9VMSIsdHJ1ZV0=</parameters>
109+
</equivalent>
110+
<hash>ca298c11df338ea36bce176af0fe3b69</hash>
111+
</actionHistory>
112+
<actionHistory>
113+
<tid>1751826515156</tid>
114+
<inverse>
115+
<actionName>UPDATE_EDGE</actionName>
116+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwMV9VMSIsdHJ1ZV0=</parameters>
117+
</inverse>
118+
<equivalent>
119+
<actionName>UPDATE_EDGE</actionName>
120+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwMl9VMSIsdHJ1ZV0=</parameters>
121+
</equivalent>
122+
<hash>c6ee9fdcb90f48bc1de9bdc44b7da91f</hash>
123+
</actionHistory>
124+
<actionHistory>
125+
<tid>1751826596605</tid>
126+
<inverse>
127+
<actionName>UPDATE_EDGE</actionName>
128+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwMl9VMSIsdHJ1ZV0=</parameters>
129+
</inverse>
130+
<equivalent>
131+
<actionName>UPDATE_EDGE</actionName>
132+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwM19VMSIsdHJ1ZV0=</parameters>
133+
</equivalent>
134+
<hash>b79566da6d5ea6c2cf2cbb618da677d2</hash>
135+
</actionHistory>
136+
<actionHistory>
137+
<tid>1751826901740</tid>
138+
<inverse>
139+
<actionName>UPDATE_EDGE</actionName>
140+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwM19VMSIsdHJ1ZV0=</parameters>
141+
</inverse>
142+
<equivalent>
143+
<actionName>UPDATE_EDGE</actionName>
144+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwNF9VMSIsdHJ1ZV0=</parameters>
145+
</equivalent>
146+
<hash>ba871dc0f4bc75adee32e34c87854508</hash>
147+
</actionHistory>
148+
<actionHistory>
149+
<tid>1751827730897</tid>
150+
<inverse>
151+
<actionName>UPDATE_EDGE</actionName>
152+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwNF9VMSIsdHJ1ZV0=</parameters>
153+
</inverse>
154+
<equivalent>
155+
<actionName>UPDATE_EDGE</actionName>
156+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwNV9VMSIsdHJ1ZV0=</parameters>
157+
</equivalent>
158+
<hash>8bb2b4d5cd9d445722b307d6bdb3d9fd</hash>
159+
</actionHistory>
160+
<actionHistory>
161+
<tid>1751828973865</tid>
162+
<inverse>
163+
<actionName>UPDATE_EDGE</actionName>
164+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwNV9VMSIsdHJ1ZV0=</parameters>
165+
</inverse>
166+
<equivalent>
167+
<actionName>UPDATE_EDGE</actionName>
168+
<parameters>WyI3NmRjNzIxNi0wMzE2LTQ2OWQtOWFhNy1lN2Q3NDAwNGNkOTUiLHsidGhpY2tuZXNzIjoxLCJzaGFwZSI6InNvbGlkIn0sIjB4MjMwNl9VMSIsdHJ1ZV0=</parameters>
169+
</equivalent>
170+
<hash>3609737de0e0d000c3d43a620f592090</hash>
171+
</actionHistory>
172+
<actionHistory>
173+
<tid>1751872486908</tid>
174+
<inverse>
175+
<actionName>UPDATE_NODE</actionName>
176+
<parameters>WyI4OTQ5N2QyOC1jMTIwLTRkNDgtYWEyMy1hMDcxMjYxYWE2MDMiLHsid2lkdGgiOjIzMywiaGVpZ2h0Ijo1MCwib3BhY2l0eSI6MSwic2hhcGUiOiJyZWN0YW5nbGUiLCJiYWNrZ3JvdW5kQ29sb3IiOiIjZmZjYzAwIiwiYm9yZGVyQ29sb3IiOiIjMDAwIiwiYm9yZGVyV2lkdGgiOjF9LCJCOmZ1bmJvZHlfdGhyb3VnaHB1dF90ZXN0LnB5Iix0cnVlXQ==</parameters>
177+
</inverse>
178+
<equivalent>
179+
<actionName>UPDATE_NODE</actionName>
180+
<parameters>WyI4OTQ5N2QyOC1jMTIwLTRkNDgtYWEyMy1hMDcxMjYxYWE2MDMiLHsid2lkdGgiOjIzMywiaGVpZ2h0Ijo1MCwib3BhY2l0eSI6MSwic2hhcGUiOiJyZWN0YW5nbGUiLCJiYWNrZ3JvdW5kQ29sb3IiOiIjZmZjYzAwIiwiYm9yZGVyQ29sb3IiOiIjMDAwIiwiYm9yZGVyV2lkdGgiOjF9LCJCOmZ1bmJvZHlfY3B1LnB5Iix0cnVlXQ==</parameters>
181+
</equivalent>
182+
<hash>a0691587adb56f1c913b278379ea8cd5</hash>
183+
</actionHistory>
184+
</graph>
185+
</graphml>

measurements/CPU/funbody_cpu.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# funbody_throughput_test.py (MODIFIED FOR RESOURCE MONITORING & CORRECTED)
2+
import time
3+
import concore
4+
import os
5+
import json
6+
import threading
7+
import psutil
8+
import csv
9+
10+
# --- MONITORING FUNCTION (to be run in a separate thread) ---
11+
def monitor_resources(stop_event, output_list):
12+
"""Monitors this script's CPU and memory usage."""
13+
process = psutil.Process(os.getpid())
14+
while not stop_event.is_set():
15+
cpu_percent = process.cpu_percent(interval=0.5)
16+
memory_mb = process.memory_info().rss / (1024 * 1024)
17+
output_list.append({'cpu_percent': cpu_percent, 'memory_mb': memory_mb})
18+
19+
print("funbody (Receiver) using ZMQ REP socket for Throughput & Resource Test.")
20+
21+
TEST_DURATION = 10
22+
message_count = 0
23+
test_started = False
24+
resource_records = []
25+
start_time = 0
26+
27+
# --- Start Monitoring ---
28+
stop_monitoring = threading.Event()
29+
monitor_thread = threading.Thread(target=monitor_resources, args=(stop_monitoring, resource_records))
30+
monitor_thread.start()
31+
32+
# --- Main Throughput Test Logic (CORRECTED) ---
33+
concore.init_zmq_port(
34+
port_name=PORT_NAME_B_OUT,
35+
port_type="bind",
36+
address="tcp://0.0.0.0:" + PORT_B_OUT, # Bind to all interfaces on the specified port
37+
socket_type_str="REP"
38+
)
39+
40+
print(f"Receiver waiting for messages on port {PORT_B_OUT}...")
41+
while True:
42+
# Wait for a message
43+
message_str = concore.read(PORT_NAME_B_OUT, "stream", "{}")
44+
45+
# Send an acknowledgment immediately after receiving
46+
concore.write(PORT_NAME_B_OUT, "reply", "{}") # ADDED: Send acknowledgment
47+
48+
if message_str is None:
49+
continue # Or break, depending on desired behavior on timeout
50+
51+
try:
52+
# Since concore.read now handles JSON parsing, this might not be needed
53+
# but we keep it for validation of the message structure.
54+
message_dict = message_str if isinstance(message_str, dict) else json.loads(message_str)
55+
except (json.JSONDecodeError, TypeError):
56+
continue
57+
58+
if isinstance(message_dict, dict) and 'type' in message_dict:
59+
if message_dict['type'] == 'control':
60+
if message_dict['value'] == 'START' and not test_started:
61+
print("START signal received.")
62+
test_started = True
63+
start_time = time.perf_counter()
64+
elif message_dict['value'] == 'STOP' and test_started:
65+
print("STOP signal received.")
66+
break # Exit the loop to end the test
67+
elif message_dict['type'] == 'data' and test_started:
68+
message_count += 1
69+
70+
# --- Stop Monitoring and Save Results ---
71+
stop_monitoring.set()
72+
monitor_thread.join()
73+
concore.terminate_zmq()
74+
75+
if message_count > 0:
76+
end_time = time.perf_counter()
77+
duration = end_time - start_time
78+
throughput = message_count / duration if duration > 0 else 0
79+
print(f"\n--- TEST COMPLETE ---")
80+
print(f"Received {message_count} messages in {duration:.2f} seconds.")
81+
print(f"THROUGHPUT RESULT: {throughput:.2f} messages/second")
82+
83+
if resource_records:
84+
with open('receiver_usage.csv', 'w', newline='') as f:
85+
writer = csv.DictWriter(f, fieldnames=['cpu_percent', 'memory_mb'])
86+
writer.writeheader()
87+
writer.writerows(resource_records)
88+
print("Receiver resource usage saved to receiver_usage.csv")

measurements/CPU/funcall_cpu.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# funcall_throughput_test.py (MODIFIED FOR RESOURCE MONITORING & CORRECTED)
2+
import time
3+
import concore
4+
import os
5+
import json
6+
import threading
7+
import psutil
8+
import csv
9+
10+
# --- MONITORING FUNCTION (to be run in a separate thread) ---
11+
def monitor_resources(stop_event, output_list):
12+
"""Monitors this script's CPU and memory usage."""
13+
process = psutil.Process(os.getpid())
14+
while not stop_event.is_set():
15+
# Get CPU (as a percentage) and Memory (RSS in MB)
16+
cpu_percent = process.cpu_percent(interval=0.5)
17+
memory_mb = process.memory_info().rss / (1024 * 1024)
18+
output_list.append({'cpu_percent': cpu_percent, 'memory_mb': memory_mb})
19+
20+
print("funcall (Sender) using ZMQ REQ socket for Throughput & Resource Test.")
21+
22+
TEST_DURATION = 10
23+
message_count = 0
24+
resource_records = []
25+
26+
# --- Start Monitoring ---
27+
stop_monitoring = threading.Event()
28+
monitor_thread = threading.Thread(target=monitor_resources, args=(stop_monitoring, resource_records))
29+
monitor_thread.start()
30+
31+
# --- Main Throughput Test Logic (CORRECTED) ---
32+
concore.init_zmq_port(
33+
port_name=PORT_NAME_IN_A,
34+
port_type="connect",
35+
address="tcp://192.168.0.109:" + PORT_IN_A, # Use 127.0.0.1 for local, or the receiver's IP
36+
socket_type_str="REQ"
37+
)
38+
print(f"Sender starting. Will send data for {TEST_DURATION} seconds.")
39+
40+
# Send START signal and wait for reply
41+
start_signal = json.dumps({"type": "control", "value": "START"})
42+
concore.write(PORT_NAME_IN_A, "stream", start_signal)
43+
concore.read(PORT_NAME_IN_A, "reply", "{}") # ADDED: Wait for acknowledgment
44+
45+
time.sleep(1)
46+
start_time = time.perf_counter()
47+
48+
# Loop for the test duration
49+
while (time.perf_counter() - start_time) < TEST_DURATION:
50+
data_message = json.dumps({"type": "data", "value": message_count})
51+
concore.write(PORT_NAME_IN_A, "stream", data_message)
52+
concore.read(PORT_NAME_IN_A, "reply", "{}") # ADDED: Wait for acknowledgment
53+
message_count += 1
54+
55+
time.sleep(1)
56+
57+
# Send STOP signal and wait for reply
58+
stop_signal = json.dumps({"type": "control", "value": "STOP"})
59+
concore.write(PORT_NAME_IN_A, "stream", stop_signal)
60+
concore.read(PORT_NAME_IN_A, "reply", "{}") # ADDED: Wait for acknowledgment
61+
62+
print(f"Sender finished. Sent approximately {message_count} messages.")
63+
64+
# --- Stop Monitoring and Save Results ---
65+
stop_monitoring.set()
66+
monitor_thread.join()
67+
concore.terminate_zmq()
68+
69+
if resource_records:
70+
with open('sender_usage.csv', 'w', newline='') as f:
71+
writer = csv.DictWriter(f, fieldnames=['cpu_percent', 'memory_mb'])
72+
writer.writeheader()
73+
writer.writerows(resource_records)
74+
print("Sender resource usage saved to sender_usage.csv")

measurements/CPU/plot_fig5.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import pandas as pd
2+
import seaborn as sns
3+
import matplotlib.pyplot as plt
4+
5+
# Load all data and calculate averages
6+
try:
7+
avg_cpu_sender_zmq = pd.read_csv('sender_usage.csv')['cpu_percent'].mean()
8+
avg_mem_sender_zmq = pd.read_csv('sender_usage.csv')['memory_mb'].mean()
9+
10+
# In a real test, you would also measure the receiver. For simplicity, we plot sender.
11+
# avg_cpu_receiver_zmq = pd.read_csv('receiver_zmq_usage.csv')['cpu_percent'].mean()
12+
# avg_mem_receiver_zmq = pd.read_csv('receiver_zmq_usage.csv')['memory_mb'].mean()
13+
14+
# Create placeholder data for Mediator until you run the test
15+
avg_cpu_sender_mediator = 25.5 # Example value
16+
avg_mem_sender_mediator = 60.2 # Example value
17+
18+
except FileNotFoundError:
19+
print("One or more CSV files not found. Using placeholder data.")
20+
# Placeholder data for plotting if you haven't run the experiment yet
21+
avg_cpu_sender_zmq, avg_mem_sender_zmq = 15.0, 45.0
22+
avg_cpu_sender_mediator, avg_mem_sender_mediator = 25.5, 60.2
23+
24+
# Prepare data for plotting
25+
data = {
26+
'Protocol': ['Mediator', 'ZeroMQ', 'Mediator', 'ZeroMQ'],
27+
'Metric': ['CPU Usage (%)', 'CPU Usage (%)', 'Memory Usage (MB)', 'Memory Usage (MB)'],
28+
'Value': [avg_cpu_sender_mediator, avg_cpu_sender_zmq, avg_mem_sender_mediator, avg_mem_sender_zmq]
29+
}
30+
df_plot = pd.DataFrame(data)
31+
32+
# Create the grouped bar chart
33+
plt.figure(figsize=(10, 7))
34+
sns.barplot(x='Metric', y='Value', hue='Protocol', data=df_plot, palette={'Mediator': '#F44336', 'ZeroMQ': '#4CAF50'})
35+
36+
plt.title('Figure 5: Resource Utilization During Throughput Test (Sender)', fontsize=16)
37+
plt.xlabel('Performance Metric', fontsize=12)
38+
plt.ylabel('Average Usage', fontsize=12)
39+
plt.legend(title='Protocol')
40+
plt.grid(axis='y', linestyle='--', alpha=0.7)
41+
42+
plt.show()

0 commit comments

Comments
 (0)