From 78ff94e6047938b5dbe4b4a321b9dd7c848b19ac Mon Sep 17 00:00:00 2001 From: yhirose Date: Tue, 9 Jun 2026 20:54:24 -0400 Subject: [PATCH] Wait for server startup before running benchmark --- benchmark/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/benchmark/Makefile b/benchmark/Makefile index 6fdd528..8f6d9ce 100644 --- a/benchmark/Makefile +++ b/benchmark/Makefile @@ -7,11 +7,12 @@ CPPHTTPLIB_FLAGS = -DCPPHTTPLIB_THREAD_POOL_COUNT=16 BENCH = bombardier -c 10 -d 5s localhost:8080 MONITOR = ali http://localhost:8080 +WAIT = while ! nc -z localhost 8080 >/dev/null 2>&1; do sleep 0.05; done # cpp-httplib bench: server @echo "--------------------\n cpp-httplib latest\n--------------------\n" - @./server & export PID=$$!; $(BENCH); kill $${PID} + @./server & export PID=$$!; $(WAIT); $(BENCH); kill $${PID} @echo "" monitor: server @@ -26,7 +27,7 @@ server : cpp-httplib/main.cpp ../httplib.h # crow bench-crow: server-crow @echo "-------------\n Crow v1.3.1\n-------------\n" - @./server-crow & export PID=$$!; $(BENCH); kill $${PID} + @./server-crow & export PID=$$!; $(WAIT); $(BENCH); kill $${PID} @echo "" monitor-crow: server-crow