Skip to content

Commit 5c0b2a2

Browse files
committed
server: bench: fix graph, fix output artifact
1 parent 799317b commit 5c0b2a2

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.github/workflows/bench.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,6 @@ jobs:
174174
name: benchmark-results
175175
compression-level: 9
176176
path: |
177-
examples/server/bench/**/.png
178-
examples/server/bench/**/.json
179-
examples/server/bench/**/.log
177+
examples/server/bench/*.png
178+
examples/server/bench/*.json
179+
examples/server/bench/*.log

examples/server/bench/bench.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import argparse
2-
import base64
32
import json
43
import os
54
import re
@@ -13,6 +12,8 @@
1312
from contextlib import closing
1413
from datetime import datetime
1514

15+
import matplotlib
16+
import matplotlib.dates
1617
import matplotlib.pyplot as plt
1718
import requests
1819

@@ -109,6 +110,10 @@ def main(args_in: list[str] | None = None) -> None:
109110
for metric in metrics:
110111
resp = requests.get(f"http://localhost:9090/api/v1/query_range",
111112
params={'query': 'llamacpp:' + metric, 'start': start_time, 'end': end_time, 'step': 2})
113+
114+
with open(f"{metric}.json", 'w') as metric_json:
115+
metric_json.write(resp.text)
116+
112117
if resp.status_code != 200:
113118
print(f"bench: unable to extract prometheus metric {metric}: {resp.text}")
114119
else:
@@ -131,6 +136,8 @@ def main(args_in: list[str] | None = None) -> None:
131136
f"parallel={args.parallel} ctx-size={args.ctx_size} ngl={args.n_gpu_layers} batch-size={args.batch_size} ubatch-size={args.ubatch_size}\n"
132137
f"pp={args.max_prompt_tokens} pp+tg={args.max_tokens}\n"
133138
f"branch={args.branch} commit={args.commit}", fontsize=14, wrap=True)
139+
plt.gca().xaxis.set_major_locator(matplotlib.dates.MinuteLocator())
140+
plt.gca().xaxis.set_major_formatter(matplotlib.dates.DateFormatter("%Y%m%d %H:%M:%S"))
134141
plt.gcf().autofmt_xdate()
135142

136143
# Remove borders

0 commit comments

Comments
 (0)