Page MenuHomeFreeBSD

D49394.diff
No OneTemporary

D49394.diff

Index: benchmarks/Makefile
===================================================================
--- benchmarks/Makefile
+++ benchmarks/Makefile
@@ -118,5 +118,6 @@
SUBDIR += vkpeak
SUBDIR += webbench
SUBDIR += wrk
+ SUBDIR += wrk2
.include <bsd.port.subdir.mk>
Index: benchmarks/wrk2/Makefile
===================================================================
--- /dev/null
+++ benchmarks/wrk2/Makefile
@@ -0,0 +1,43 @@
+PORTNAME= wrk2
+DISTVERSION= g20210506
+CATEGORIES= benchmarks
+
+MAINTAINER= dch@FreeBSD.org
+COMMENT= Constant throughput, correct latency recording variant of wrk, in C
+WWW= https://github.com/giltene/wrk2
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+USES= gmake luajit ssl
+USE_GCC= yes:build
+
+USE_GITHUB= yes
+GH_ACCOUNT= giltene
+GH_TAGNAME= 44a94c1
+
+EXTRACT_AFTER_ARGS= --exclude deps/luajit
+
+PLIST_FILES= bin/${PORTNAME}
+
+PORTDOCS= README.md
+
+OPTIONS_DEFINE= DOCS
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|%%LUAJIT_INCDIR%%|${LUAJIT_INCDIR}|g' \
+ ${WRKSRC}/Makefile
+
+post-build:
+ @${MV} ${WRKSRC}/wrk ${WRKSRC}/wrk2
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} \
+ ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+
+post-install-DOCS-on:
+ (cd ${WRKSRC} && \
+ ${COPYTREE_SHARE} README.md ${STAGEDIR}${DOCSDIR})
+
+.include <bsd.port.mk>
Index: benchmarks/wrk2/distinfo
===================================================================
--- /dev/null
+++ benchmarks/wrk2/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1742043463
+SHA256 (giltene-wrk2-g20210506-44a94c1_GH0.tar.gz) = 42607c6a6a54230b093a2d9378080a81e7d5f54b79c8e97a48644d5f2b40acc5
+SIZE (giltene-wrk2-g20210506-44a94c1_GH0.tar.gz) = 1025543
Index: benchmarks/wrk2/files/patch-Makefile
===================================================================
--- /dev/null
+++ benchmarks/wrk2/files/patch-Makefile
@@ -0,0 +1,58 @@
+--- Makefile.orig 2019-09-24 04:46:42 UTC
++++ Makefile
+@@ -1,5 +1,5 @@ CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
+ CFLAGS := -std=c99 -Wall -O2 -D_REENTRANT
+-LIBS := -lpthread -lm -lcrypto -lssl
++LIBS := -lpthread -lm -lcrypto -lssl -lluajit-5.1
+
+ TARGET := $(shell uname -s | tr '[A-Z]' '[a-z]' 2>/dev/null || echo unknown)
+
+@@ -18,7 +18,7 @@ else ifeq ($(TARGET), freebsd)
+ LIBS += -ldl
+ LDFLAGS += -Wl,-E
+ else ifeq ($(TARGET), freebsd)
+- CFLAGS += -D_DECLARE_C99_LDBL_MATH
++ CFLAGS += -D_DECLARE_C99_LDBL_MATH -I%%LUAJIT_INCDIR%%
+ LDFLAGS += -Wl,-E
+ endif
+
+@@ -29,37 +29,27 @@ OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/byt
+ ODIR := obj
+ OBJ := $(patsubst %.c,$(ODIR)/%.o,$(SRC)) $(ODIR)/bytecode.o
+
+-LDIR = deps/luajit/src
+-LIBS := -lluajit $(LIBS)
+-CFLAGS += -I$(LDIR)
+-LDFLAGS += -L$(LDIR)
+-
+ all: $(BIN)
+
+ clean:
+ $(RM) $(BIN) obj/*
+- @$(MAKE) -C deps/luajit clean
+
+ $(BIN): $(OBJ)
+ @echo LINK $(BIN)
+ @$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+-$(OBJ): config.h Makefile $(LDIR)/libluajit.a | $(ODIR)
++$(OBJ): config.h Makefile | $(ODIR)
+
+ $(ODIR):
+ @mkdir -p $@
+
+ $(ODIR)/bytecode.o: src/wrk.lua
+ @echo LUAJIT $<
+- @$(SHELL) -c 'cd $(LDIR) && ./luajit -b $(CURDIR)/$< $(CURDIR)/$@'
++ @$(SHELL) -c 'luajit -b $(CURDIR)/$< $(CURDIR)/$@'
+
+ $(ODIR)/%.o : %.c
+ @echo CC $<
+ @$(CC) $(CFLAGS) -c -o $@ $<
+-
+-$(LDIR)/libluajit.a:
+- @echo Building LuaJIT...
+- @$(MAKE) -C $(LDIR) BUILDMODE=static
+
+ .PHONY: all clean
+ .SUFFIXES:
Index: benchmarks/wrk2/files/patch-src_script.c
===================================================================
--- /dev/null
+++ benchmarks/wrk2/files/patch-src_script.c
@@ -0,0 +1,48 @@
+--- src/script.c.orig 2019-09-24 04:46:42 UTC
++++ src/script.c
+@@ -2,6 +2,7 @@
+
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/time.h>
+ #include "script.h"
+ #include "http_parser.h"
+ #include "stats.h"
+@@ -27,19 +28,19 @@ static int push_url_part(lua_State *, char *, struct h
+ static void set_field(lua_State *, int, char *, int);
+ static int push_url_part(lua_State *, char *, struct http_parser_url *, enum http_parser_url_fields);
+
+-static const struct luaL_reg addrlib[] = {
++static const struct luaL_Reg addrlib[] = {
+ { "__tostring", script_addr_tostring },
+ { "__gc" , script_addr_gc },
+ { NULL, NULL }
+ };
+
+-static const struct luaL_reg statslib[] = {
++static const struct luaL_Reg statslib[] = {
+ { "__index", script_stats_get },
+ { "__len", script_stats_len },
+ { NULL, NULL }
+ };
+
+-static const struct luaL_reg threadlib[] = {
++static const struct luaL_Reg threadlib[] = {
+ { "__index", script_thread_index },
+ { "__newindex", script_thread_newindex },
+ { NULL, NULL }
+@@ -51,11 +52,11 @@ lua_State *script_create(char *file, char *url, char *
+ (void) luaL_dostring(L, "wrk = require \"wrk\"");
+
+ luaL_newmetatable(L, "wrk.addr");
+- luaL_register(L, NULL, addrlib);
++ luaL_newlib(L, addrlib);
+ luaL_newmetatable(L, "wrk.stats");
+- luaL_register(L, NULL, statslib);
++ luaL_newlib(L, statslib);
+ luaL_newmetatable(L, "wrk.thread");
+- luaL_register(L, NULL, threadlib);
++ luaL_newlib(L, threadlib);
+
+ struct http_parser_url parts = {};
+ script_parse_url(url, &parts);
Index: benchmarks/wrk2/pkg-descr
===================================================================
--- /dev/null
+++ benchmarks/wrk2/pkg-descr
@@ -0,0 +1,16 @@
+wrk2 is a modern HTTP benchmarking tool capable of generating significant
+load when run on a single multi-core CPU. It combines a multithreaded
+design with scalable event notification systems to efficiently simulate
+thousands of connections.
+
+Unlike the original wrk, wrk2 is designed to produce a constant throughput
+load, and to accurately record latency statistics even at high throughput
+levels. It maintains a per-thread and per-connection state for recording
+accurate latency statistics across high connection counts and large time
+ranges.
+
+Key features:
+- Constant throughput load generation
+- Accurate latency recording and reporting
+- Multithreaded design for high performance
+- LuaJIT scripting for HTTP request generation and response processing
Index: benchmarks/wrk2/pkg-plist
===================================================================
--- /dev/null
+++ benchmarks/wrk2/pkg-plist
@@ -0,0 +1 @@
+bin/wrk2

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 2, 11:17 PM (1 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34605146
Default Alt Text
D49394.diff (6 KB)

Event Timeline