|
|
|
|
Index: src/aggregate/aggregate_exec.c
|
|
|
|
|
--- src/aggregate/aggregate_exec.c.orig 2019-01-31 20:10:05.000000000 +0100
|
|
|
|
|
+++ src/aggregate/aggregate_exec.c 2019-02-01 17:14:27.982364000 +0100
|
|
|
|
|
@@ -110,7 +110,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 2019-01-31 20:10:05.000000000 +0100
|
|
|
|
|
+++ src/buffer.c 2019-02-01 17:14:27.982610000 +0100
|
|
|
|
|
@@ -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 2019-01-31 20:10:05.000000000 +0100
|
|
|
|
|
+++ src/buffer.h 2019-02-01 17:14:27.982857000 +0100
|
|
|
|
|
@@ -6,6 +6,8 @@
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdint.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 2019-01-31 20:10:05.000000000 +0100
|
|
|
|
|
+++ src/concurrent_ctx.c 2019-02-01 17:14:27.983194000 +0100
|
|
|
|
|
@@ -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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Index: src/cursor.c
|
|
|
|
|
--- src/cursor.c.orig 2019-01-31 20:10:05.000000000 +0100
|
|
|
|
|
+++ src/cursor.c 2019-02-01 17:14:27.983543000 +0100
|
|
|
|
|
@@ -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 2019-01-31 20:10:05.000000000 +0100
|
|
|
|
|
+++ src/query_plan.c 2019-02-01 17:14:27.983822000 +0100
|
|
|
|
|
@@ -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);
|
|
|
|
|
@@ -294,7 +298,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 2019-02-01 17:14:27.984099000 +0100
|
|
|
|
|
+++ src/rmutil/sdsalloc.h 2019-02-01 17:15:59.806779000 +0100
|
|
|
|
|
@@ -36,12 +36,7 @@
|
|
|
|
|
* the include of your alternate allocator if needed (not needed in order
|
|
|
|
|
* to use the default libc allocator). */
|
|
|
|
|
|
|
|
|
|
-#if defined(__MACH__) || defined(__FreeBSD__)
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
-#else
|
|
|
|
|
-#include <malloc.h>
|
|
|
|
|
-#endif
|
|
|
|
|
-//#include "zmalloc.h"
|
|
|
|
|
#define s_malloc malloc
|
|
|
|
|
#define s_realloc realloc
|
|
|
|
|
#define s_free free
|
|
|
|
|
Index: src/tests/test_quantile.c
|
|
|
|
|
--- src/tests/test_quantile.c.orig 2019-01-31 20:10:05.000000000 +0100
|
|
|
|
|
+++ src/tests/test_quantile.c 2019-02-01 17:14:27.984456000 +0100
|
|
|
|
|
@@ -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
|
|
|
|
|
+})
|