|
|
|
|
Index: src/aggregate/aggregate_exec.c
|
|
|
|
|
--- src/aggregate/aggregate_exec.c.orig 2018-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/aggregate/aggregate_exec.c 2018-08-10 20:49:22.796195000 +0200
|
|
|
|
|
@@ -108,7 +108,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/buffer.c
|
|
|
|
|
--- src/buffer.c.orig 2018-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/buffer.c 2018-08-10 20:49:22.796323000 +0200
|
|
|
|
|
@@ -1,3 +1,4 @@
|
|
|
|
|
+#include <sys/types.h>
|
|
|
|
|
#include "buffer.h"
|
|
|
|
|
#include "rmalloc.h"
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
Index: src/buffer.h
|
|
|
|
|
--- src/buffer.h.orig 2018-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/buffer.h 2018-08-10 20:50:18.664777000 +0200
|
|
|
|
|
@@ -5,6 +5,8 @@
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
+#include <sys/types.h>
|
|
|
|
|
+#include <inttypes.h>
|
|
|
|
|
|
|
|
|
|
#define BUFFER_READ 0
|
|
|
|
|
#define BUFFER_WRITE 1
|
|
|
|
|
Index: src/concurrent_ctx.c
|
|
|
|
|
--- src/concurrent_ctx.c.orig 2018-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/concurrent_ctx.c 2018-08-10 20:49:22.796464000 +0200
|
|
|
|
|
@@ -126,7 +126,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);
|
|
|
|
|
@@ -148,7 +152,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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -232,4 +240,4 @@
|
|
|
|
|
ConcurrentSearch_CloseKeys(ctx);
|
|
|
|
|
RedisModule_ThreadSafeContextUnlock(ctx->ctx);
|
|
|
|
|
ctx->isLocked = 0;
|
|
|
|
|
-}
|
|
|
|
|
\ No newline at end of file
|
|
|
|
|
+}
|
|
|
|
|
Index: src/cursor.c
|
|
|
|
|
--- src/cursor.c.orig 2018-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/cursor.c 2018-08-10 20:49:22.796593000 +0200
|
|
|
|
|
@@ -8,7 +8,11 @@
|
|
|
|
|
|
|
|
|
|
static uint64_t curTimeNs() {
|
|
|
|
|
struct timespec tv;
|
|
|
|
|
+#ifdef CLOCK_MONOTONIC_RAW
|
|
|
|
|
+ clock_gettime(CLOCK_MONOTONIC_RAW, &tv);
|
|
|
|
|
+#else
|
|
|
|
|
clock_gettime(CLOCK_MONOTONIC, &tv);
|
|
|
|
|
+#endif
|
|
|
|
|
return tv.tv_nsec + (tv.tv_sec * 1000000000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Index: src/query_plan.c
|
|
|
|
|
--- src/query_plan.c.orig 2018-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/query_plan.c 2018-08-10 20:49:22.796729000 +0200
|
|
|
|
|
@@ -194,7 +194,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);
|
|
|
|
|
@@ -289,7 +293,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-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/rmutil/sdsalloc.h 2018-08-10 20:49:22.796841000 +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
|
|
|
|
|
Index: src/tests/test_quantile.c
|
|
|
|
|
--- src/tests/test_quantile.c.orig 2018-08-06 14:34:21.000000000 +0200
|
|
|
|
|
+++ src/tests/test_quantile.c 2018-08-10 20:49:22.796954000 +0200
|
|
|
|
|
@@ -5,6 +5,7 @@
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
+#include <inttypes.h>
|
|
|
|
|
|
|
|
|
|
static FILE *fp;
|
|
|
|
|
static Buffer buf;
|
|
|
|
|
@@ -48,4 +49,4 @@
|
|
|
|
|
TESTFUNC(testBasic);
|
|
|
|
|
|
|
|
|
|
Buffer_Free(&buf);
|
|
|
|
|
-})
|
|
|
|
|
\ No newline at end of file
|
|
|
|
|
+})
|