MCPcopy Create free account
hub / github.com/RedisGears/RedisGears / RedisGearsPy_ProfileReset

Function RedisGearsPy_ProfileReset

plugins/python/redisgears_python.c:6432–6453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6430}
6431
6432static int RedisGearsPy_ProfileReset(RedisModuleCtx *ctx, RedisModuleString **argv, int argc){
6433 if (argc != 1){
6434 return RedisModule_WrongArity(ctx);
6435 }
6436
6437 const char* strId = RedisModule_StringPtrLen(argv[0], NULL);
6438
6439 PythonSessionCtx* s = PythonSessionCtx_Get(strId);
6440 if (!s) {
6441 RedisModule_ReplyWithError(ctx, "session does not exists");
6442 return REDISMODULE_OK;
6443 }
6444
6445 PythonExecutionCtx pectx = PythonExecutionCtx_New(s, NULL);
6446 RedisGearsPy_Lock(&pectx);
6447 GearsPyDecRef(s->profiler);
6448 s->profiler = PyObject_CallFunction(profileCreateFunction, NULL);
6449 RedisGearsPy_Unlock(&pectx);
6450 PythonSessionCtx_Free(s);
6451 RedisModule_ReplyWithSimpleString(ctx, "OK");
6452 return REDISMODULE_OK;
6453}
6454
6455static int RedisGearsPy_ProfileStats(RedisModuleCtx *ctx, RedisModuleString **argv, int argc){
6456 if (argc < 0 || argc > 2){

Callers 1

RedisGearsPy_ProfileFunction · 0.85

Calls 5

PythonSessionCtx_GetFunction · 0.85
RedisGearsPy_LockFunction · 0.85
GearsPyDecRefFunction · 0.85
RedisGearsPy_UnlockFunction · 0.85
PythonSessionCtx_FreeFunction · 0.85

Tested by

no test coverage detected