From 33cd9e4fdfa7e3dad8718a7c1f98badbf15e109d Mon Sep 17 00:00:00 2001
From: Florian Fischer <florian.fischer@muhq.space>
Date: Thu, 5 Aug 2021 18:28:24 +0200
Subject: [PATCH] add sqpoll variants

---
 Makefile | 25 ++++++++++++++++++++-----
 eval.py  |  7 +++++++
 2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 2515e79..f905095 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ MAKEFILES = $(shell dirname $(shell find . -name Makefile \
                                -not -path "./haystack/*"))
 
 EMPER_ROOT := emper
-EMPER_VARIANTS := vanilla pipe pipe-no-completer no-completer
+EMPER_VARIANTS := vanilla pipe pipe-no-completer no-completer sqpoll-single sqpoll
 EMPER_PREP_TARGETS := $(addprefix $(EMPER_ROOT)/build-,$(EMPER_VARIANTS))
 EMPER_BUILD_TARGETS := $(addprefix emper-,$(EMPER_VARIANTS))
 
@@ -34,19 +34,34 @@ $(MAKEFILES):
 
 COMMON_EMPER_MESON_ARGS := --buildtype=release --fatal-meson-warnings -Dstats=true
 
-$(EMPER_ROOT)/build-vanilla:
+.PHONY: checkout-master
+checkout-master:
+	git -C $(EMPER_ROOT) checkout master
+
+.PHONY: checkout-sqpoll
+checkout-sqpoll: muhq-remote
+	git -C $(EMPER_ROOT) fetch origin merge-requests/210/head:sqpoll && \
+	git -C $(EMPER_ROOT) checkout sqpoll
+
+$(EMPER_ROOT)/build-vanilla: checkout-master
 	meson setup $(COMMON_EMPER_MESON_ARGS) $@ $(EMPER_ROOT)
 
-$(EMPER_ROOT)/build-pipe:
+$(EMPER_ROOT)/build-pipe: checkout-master
 	meson setup $(COMMON_EMPER_MESON_ARGS) -Dworker_sleep_strategy=pipe $@ $(EMPER_ROOT)
 
-$(EMPER_ROOT)/build-pipe-no-completer:
+$(EMPER_ROOT)/build-pipe-no-completer: checkout-master
 	meson setup $(COMMON_EMPER_MESON_ARGS) -Dio_completer_behavior=none \
 	            -Dworker_sleep_strategy=pipe $@ $(EMPER_ROOT)
 
-$(EMPER_ROOT)/build-no-completer:
+$(EMPER_ROOT)/build-no-completer: checkout-master
 	meson setup $(COMMON_EMPER_MESON_ARGS) -Dio_completer_behavior=none $@ $(EMPER_ROOT)
 
+$(EMPER_ROOT)/build-sqpoll: checkout-sqpoll
+	meson setup $(COMMON_EMPER_MESON_ARGS) -Dio_uring_sq_poller=each $@ $(EMPER_ROOT)
+
+$(EMPER_ROOT)/build-sqpoll-single: checkout-sqpoll
+	meson setup $(COMMON_EMPER_MESON_ARGS) -Dio_uring_sq_poller=one $@ $(EMPER_ROOT)
+
 
 define buildEmper
 emper-$(1): $(EMPER_ROOT)/build-$(1)
diff --git a/eval.py b/eval.py
index 429a1ab..dbc5a91 100755
--- a/eval.py
+++ b/eval.py
@@ -47,6 +47,13 @@ TARGETS = {
         f'{ROOT_DIR}/emper/build-pipe-no-completer/apps/fsearch/fsearch {{NEEDLE}}',
         'env': {'EMPER_WORKER_COUNT=12'}
     },
+    'emper-sqpoll': {
+        'cmd': f'{ROOT_DIR}/emper/build-sqpoll/apps/fsearch/fsearch {{NEEDLE}}'
+    },
+    'emper-sqpoll-single': {
+        'cmd':
+        f'{ROOT_DIR}/emper/build-sqpoll-single/apps/fsearch/fsearch {{NEEDLE}}'
+    },
     'ripgrep': {
         'cmd': 'rg -l -F -uuu {NEEDLE} .'
     },
-- 
GitLab