Skip to content

Commit 63d9995

Browse files
committed
fixing plotting script for time series
Signed-off-by: Le Xu <[email protected]>
1 parent e82c692 commit 63d9995

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

benchmarks/autoscaling/plot-everything.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def parse_experiment_output(lines):
2828
# required_fields = ['status_code', 'start_time', 'end_time', 'latency', 'throughput',
2929
# 'prompt_tokens', 'output_tokens', 'total_tokens', 'input', 'output']
3030
required_fields = ['status', 'start_time', 'end_time', 'latency', 'throughput',
31-
'prompt_tokens', 'output_tokens', 'total_tokens', 'input', 'output']
31+
'prompt_tokens', 'output_tokens', 'total_tokens', 'input', 'output', 'ttft', 'tpot']
3232
if any(field not in data for field in required_fields):
3333
missingfields = [field not in data for field in required_fields]
3434
print(missingfields)
@@ -178,11 +178,11 @@ def analyze_performance(df):
178178

179179
def plot_combined_visualization(experiment_home_dir, workload_type):
180180
# Create figure
181-
fig = plt.figure(figsize=(12, 12))
181+
fig = plt.figure(figsize=(12, 15))
182182

183183
# Create GridSpec for time series plots
184-
gs_ts = GridSpec(2, 2, figure=fig)
185-
gs_ts.update(top=0.95, bottom=0.45, hspace=0.3, wspace=0.25)
184+
gs_ts = GridSpec(4, 2, figure=fig)
185+
gs_ts.update(top=0.95, bottom=0.4, hspace=0.5, wspace=0.3)
186186

187187
# Create subplots for time series
188188
ax_cdf = fig.add_subplot(gs_ts[0, 0])
@@ -196,6 +196,11 @@ def plot_combined_visualization(experiment_home_dir, workload_type):
196196

197197
ax_cost = fig.add_subplot(gs_ts[1, 1])
198198

199+
ax_ttft = fig.add_subplot(gs_ts[2, 0])
200+
ax_tpot = fig.add_subplot(gs_ts[2, 1])
201+
202+
ax_throughput = fig.add_subplot(gs_ts[3, 0])
203+
199204
# Create 1x4 grid for bar plots
200205
gs_bars = GridSpec(1, 4, figure=fig)
201206
gs_bars.update(top=0.35, bottom=0.1, left=0.1, right=0.9, wspace=0.4)
@@ -308,7 +313,11 @@ def plot_combined_visualization(experiment_home_dir, workload_type):
308313
# ax_latency.scatter(df['end_time'], df['latency'], label=f'{autoscaler}', color=color, marker='.', s=5, alpha=0.3)
309314
ax_rps.plot(df['start_time'], df['rps'], label=label_name, color=color, linewidth=0.5, alpha=0.7)
310315
print(f"Max time: {label_name}, {df['start_time'].max()}")
311-
316+
ax_ttft.plot(df['start_time'], df['ttft'], label=label_name, color=color, linewidth=0.5, alpha=0.7)
317+
ax_tpot.plot(df['start_time'], df['tpot'], label=label_name, color=color, linewidth=0.5, alpha=0.7)
318+
ax_throughput.plot(df['start_time'], df['throughput'], label=label_name, color=color, linewidth=0.5, alpha=0.7)
319+
320+
312321

313322
# 3. Running pods over time
314323
ax_pods.plot(pod_count_df['asyncio_time'], pod_count_df['Running'],
@@ -345,6 +354,21 @@ def plot_combined_visualization(experiment_home_dir, workload_type):
345354
ax_rps.grid(True)
346355
ax_rps.legend()
347356

357+
ax_ttft.set_title("TTFT Over Time")
358+
ax_ttft.set_xlabel("Time (s)")
359+
ax_ttft.set_ylabel("TTFT (s)")
360+
ax_ttft.legend()
361+
362+
ax_tpot.set_title("TPOT Over Time")
363+
ax_tpot.set_xlabel("Time (s)")
364+
ax_tpot.set_ylabel("TPOT (s)")
365+
ax_tpot.legend()
366+
367+
ax_throughput.set_title("Throughput Over Time")
368+
ax_throughput.set_xlabel("Time (s)")
369+
ax_throughput.set_ylabel("Tokens/sec")
370+
ax_throughput.legend()
371+
348372
ax_pods.set_title('Running Pods', fontsize=12)
349373
ax_pods.set_xlabel('Time (seconds)')
350374
ax_pods.set_ylabel('# Running Pods')

0 commit comments

Comments
 (0)