fix(lab5): protect pipeline objects and verify overload recovery

This commit is contained in:
kolya5544
2026-11-12 04:02:23 +03:00
parent 518c98fd3e
commit 5dbb905364
30 changed files with 2094 additions and 66 deletions
+41
View File
@@ -0,0 +1,41 @@
"""Render the measured matrix vertically so labels remain readable in an A4 report."""
import argparse
import json
from pathlib import Path
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def main():
ap = argparse.ArgumentParser()
ap.add_argument('--input', type=Path, required=True)
ap.add_argument('--output', type=Path, required=True)
args = ap.parse_args()
data = json.loads(args.input.read_text(encoding='utf-8'))
plt.rcParams.update({'font.size': 11})
fig, axes = plt.subplots(3, 1, figsize=(7.8, 9.2))
sizes = ['small', 'medium', 'large']
concs = sorted({r['concurrency'] for r in data['matrix']})
for ax, key, title, unit in zip(axes,
['throughput_per_s', 'p95_s', 'worker_peak_rss_mib'],
['Пропускная способность конвейера', 'p95 времени от приёма до ready', 'Пик RSS worker'],
['файлов/с', 'с', 'MiB']):
for i, conc in enumerate(concs):
values = [next(r[key] for r in data['matrix'] if r['concurrency'] == conc and r['image'] == size) for size in sizes]
ax.bar([j + (i - 1) * .26 for j in range(3)], values, width=.25, label=f'concurrency={conc}')
ax.set_xticks(range(3), ['320×200 PNG', '2400×1600 PNG', '6000×4000 JPEG'])
ax.set_title(title)
ax.set_ylabel(unit)
ax.legend(ncol=3, fontsize=9)
ax.grid(axis='y', alpha=.2)
ax.set_axisbelow(True)
fig.suptitle('ЛР5: worker 1 CPU / 768 MiB, один прогон на точку', fontsize=12)
fig.tight_layout()
fig.savefig(args.output, dpi=160)
plt.close(fig)
if __name__ == '__main__':
main()