The visualization was six unrelated widgets - a histogram, a timeline, an error-rate bar, percentile bars, a fill gauge, plus a dashboard, heatmap and "real-time monitor" charting simulated CPU/memory/disk data. Colour was decorative and inconsistent, and the result did not read as a benchmark tool. Replace all of it with one drawing primitive: a vertical column chart with a zero-based labelled y-axis, a baseline and a labelled x-axis. Four charts share that shape - throughput over time (failures stacked in red), response time over time, response time distribution, and response time percentiles. Colour now carries meaning only: cyan is data, amber is the tail (p95+), red is failure. Charts size themselves to the terminal width. The summary keeps every number it had, laid out as aligned key/value blocks under section rules, with the ApacheBench percentile table as a 3-column grid. Fixes found along the way: - "Latency over the run" plotted the sorted durations, so it was always a monotonic ramp rather than a timeline. Requests now record a start offset relative to the run, so the time-axis charts show what actually happened. - The throughput gauge was scaled against a hardcoded 1000.0 req/s, so it read a near-zero percentage regardless of the target. - The live progress line recomputed statistics over every completed request on every completion, an O(n^2) cost inside the benchmark loop. It is now throttled to ~20 Hz and skipped entirely when stdout is not a terminal. Colour and the progress bar are gated on isatty(), so redirected output is plain, greppable text with no escape codes. A heavy tail (p50 57 ms, max 1525 ms) previously collapsed the distribution into a single column. The chart now clips its axis at p95 when the maximum dwarfs it and states so beneath the chart; well-behaved runs are never clipped and the full range stays in the footer either way. Also drop 77 lines of dead simulation code from main.c, wire graphs.c into the Makefile, untrack the built binary, and add a .gitignore. Builds warning-free at -Wall -Wextra; valgrind clean on the loaded, single-request and all-failed paths. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GCMSMcgcwnH9a8hhaLsg6j
42 lines
926 B
Makefile
42 lines
926 B
Makefile
# retoor <retoor@molodetz.nl>
|
|
|
|
CC = gcc
|
|
CFLAGS = -Wall -Wextra -O2
|
|
CFLAGS_DEBUG = -Wall -Wextra -g -O0
|
|
LDFLAGS = -lssl -lcrypto -lm
|
|
|
|
TARGET = abr
|
|
TEST_URL = https://example.com/
|
|
PYTHON = python3
|
|
|
|
all: $(TARGET)
|
|
|
|
$(TARGET): main.o graphs.o
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
graphs.o: graphs.c graphs.h
|
|
$(CC) $(CFLAGS) -c graphs.c
|
|
|
|
main.o: main.c graphs.h
|
|
$(CC) $(CFLAGS) -c main.c
|
|
|
|
debug: clean
|
|
$(CC) $(CFLAGS_DEBUG) -o $(TARGET) main.c graphs.c $(LDFLAGS)
|
|
|
|
valgrind: debug
|
|
valgrind --leak-check=full --show-leak-kinds=definite,indirect,possible --errors-for-leak-kinds=definite,indirect,possible --error-exitcode=1 ./$(TARGET) -n 5 -c 2 -i $(TEST_URL)
|
|
|
|
clean:
|
|
rm -f $(TARGET) main.o graphs.o
|
|
|
|
py-install:
|
|
$(PYTHON) -m pip install -r requirements.txt
|
|
|
|
py-run:
|
|
$(PYTHON) abr.py -n 5 -c 2 -i $(TEST_URL)
|
|
|
|
py-test:
|
|
$(PYTHON) abr.py -n 10 -c 5 -i $(TEST_URL)
|
|
|
|
.PHONY: all clean debug valgrind py-install py-run py-test
|