You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
4.5 KiB
144 lines
4.5 KiB
Index: src/Makefile |
|
--- src/Makefile.orig 2018-04-24 22:44:08.000000000 +0200 |
|
+++ src/Makefile 2018-04-25 07:41:50.328925000 +0200 |
|
@@ -2,32 +2,35 @@ |
|
# find the OS |
|
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
|
|
|
-CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc') |
|
+CC:=cc |
|
export CC |
|
|
|
# if DEBUG env var is set, we compile with "debug" cflags |
|
-DEBUGFLAGS = -g -ggdb -O3 |
|
+DEBUGFLAGS = -O2 |
|
ifeq ($(DEBUG), 1) |
|
- DEBUGFLAGS = -g -ggdb -O0 |
|
+ DEBUGFLAGS = |
|
endif |
|
|
|
# Default CFLAGS |
|
-CFLAGS += -Wall -Wno-unused-function -Wno-unused-variable -Wno-unused-result -fPIC \ |
|
- -Werror=implicit-function-declaration \ |
|
+CFLAGS += -Wno-unused-function -Wno-unused-variable -Wno-unused-result -fPIC \ |
|
-D_GNU_SOURCE -std=gnu99 -I"$(shell pwd)" -DREDIS_MODULE_TARGET \ |
|
-DREDISMODULE_EXPERIMENTAL_API |
|
CFLAGS += $(DEBUGFLAGS) |
|
|
|
LINKER=$(CC) |
|
# Compile flags for non-osx / osx |
|
-ifneq ($(uname_S),Darwin) |
|
+ifeq ($(uname_S),Linux) |
|
SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions -ldl -lpthread |
|
CFLAGS += -Wfree-nonheap-object |
|
else |
|
+ifeq ($(uname_S),FreeBSD) |
|
+ SHOBJ_LDFLAGS ?= -shared -Bsymbolic -Bsymbolic-functions -pthread |
|
+else |
|
LINKER = $(LD) |
|
CFLAGS += -mmacosx-version-min=10.6 |
|
SHOBJ_LDFLAGS ?= -macosx_version_min 10.6 -exported_symbol _RedisModule_OnLoad -bundle -undefined dynamic_lookup -ldl -lpthread |
|
endif |
|
+endif |
|
export CFLAGS |
|
|
|
|
|
Index: src/buffer.c |
|
--- src/buffer.c.orig 2018-04-24 22:44:08.000000000 +0200 |
|
+++ src/buffer.c 2018-04-25 07:41:50.329113000 +0200 |
|
@@ -1,3 +1,4 @@ |
|
+#include <sys/types.h> |
|
#include "buffer.h" |
|
#include "rmalloc.h" |
|
#include <assert.h> |
|
Index: src/concurrent_ctx.c |
|
--- src/concurrent_ctx.c.orig 2018-04-24 22:44:08.000000000 +0200 |
|
+++ src/concurrent_ctx.c 2018-04-25 07:41:50.329321000 +0200 |
|
@@ -121,7 +121,11 @@ |
|
/** Check the elapsed timer, and release the lock if enough time has passed */ |
|
int ConcurrentSearch_CheckTimer(ConcurrentSearchCtx *ctx) { |
|
static struct timespec now; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &now); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &now); |
|
+#endif |
|
|
|
long long durationNS = (long long)1000000000 * (now.tv_sec - ctx->lastTime.tv_sec) + |
|
(now.tv_nsec - ctx->lastTime.tv_nsec); |
|
@@ -143,7 +147,11 @@ |
|
} |
|
|
|
void ConcurrentSearchCtx_ResetClock(ConcurrentSearchCtx *ctx) { |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &ctx->lastTime); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &ctx->lastTime); |
|
+#endif |
|
ctx->ticker = 0; |
|
} |
|
|
|
@@ -227,4 +235,4 @@ |
|
ConcurrentSearch_CloseKeys(ctx); |
|
RedisModule_ThreadSafeContextUnlock(ctx->ctx); |
|
ctx->isLocked = 0; |
|
-} |
|
\ No newline at end of file |
|
+} |
|
Index: src/module.c |
|
--- src/module.c.orig 2018-04-24 22:44:08.000000000 +0200 |
|
+++ src/module.c 2018-04-25 17:56:43.896863000 +0200 |
|
@@ -525,7 +525,11 @@ |
|
} |
|
} |
|
req->plan->opts.chunksize = num; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &req->plan->execCtx.startTime); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &req->plan->execCtx.startTime); |
|
+#endif |
|
|
|
RedisModule_ReplyWithArray(outputCtx, 2); |
|
AggregateRequest_Run(req, outputCtx); |
|
Index: src/query_plan.c |
|
--- src/query_plan.c.orig 2018-04-24 22:44:08.000000000 +0200 |
|
+++ src/query_plan.c 2018-04-25 17:57:26.172681000 +0200 |
|
@@ -186,7 +186,11 @@ |
|
if (RSGlobalConfig.queryTimeoutMS > 0) { |
|
// Check the elapsed processing time |
|
static struct timespec now; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &now); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &now); |
|
+#endif |
|
|
|
long long durationNS = (long long)1000000000 * (now.tv_sec - q->execCtx.startTime.tv_sec) + |
|
(now.tv_nsec - q->execCtx.startTime.tv_nsec); |
|
@@ -258,7 +262,11 @@ |
|
.sctx = plan->ctx, |
|
.conc = plan->conc, |
|
}; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &plan->execCtx.startTime); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &plan->execCtx.startTime); |
|
+#endif |
|
if (plan->conc) { |
|
ConcurrentSearchCtx_Init(ctx->redisCtx, plan->conc); |
|
if (plan->ctx->key) { |
|
Index: src/rmutil/sdsalloc.h |
|
--- src/rmutil/sdsalloc.h.orig 2018-04-24 22:44:08.000000000 +0200 |
|
+++ src/rmutil/sdsalloc.h 2018-04-25 07:41:50.329496000 +0200 |
|
@@ -36,11 +36,7 @@ |
|
* the include of your alternate allocator if needed (not needed in order |
|
* to use the default libc allocator). */ |
|
|
|
-#if defined(__MACH__) |
|
#include <stdlib.h> |
|
-#else |
|
-#include <malloc.h> |
|
-#endif |
|
//#include "zmalloc.h" |
|
#define s_malloc malloc |
|
#define s_realloc realloc
|
|
|