MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / InfoFunc

Function InfoFunc

src/debug.c:43–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void InfoFunc
44(
45 RedisModuleInfoCtx *ctx,
46 int for_crash_report
47) {
48 // make sure information is requested for crash report
49 if(!for_crash_report) return;
50
51 // pause all working threads
52 // NOTE: pausing is not an atomic action;
53 // other threads can potentially change states before being interrupted.
54 ThreadPools_Pause();
55
56 // #readers + #writers + Redis main thread
57 uint32_t n = ThreadPools_ThreadCount() + 1;
58 CommandCtx* commands[n];
59 Globals_GetCommandCtxs(commands, &n);
60
61 RedisModule_InfoAddSection(ctx, "executing commands");
62
63 for(int i = 0; i < n; i++) {
64 CommandCtx *cmd = commands[i];
65 ASSERT(cmd != NULL);
66
67 int rc __attribute__((unused));
68 char *command_desc = NULL;
69 rc = asprintf(&command_desc, "%s %s", cmd->command_name, cmd->query);
70 RedisModule_InfoAddFieldCString(ctx, "command", command_desc);
71
72 free(command_desc);
73 CommandCtx_Free(cmd);
74 }
75}
76
77void crashHandler
78(

Callers

nothing calls this directly

Calls 4

ThreadPools_PauseFunction · 0.85
ThreadPools_ThreadCountFunction · 0.85
Globals_GetCommandCtxsFunction · 0.85
CommandCtx_FreeFunction · 0.85

Tested by

no test coverage detected