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

Function SlowLog_New

src/slow_log/slow_log.c:126–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126SlowLog *SlowLog_New(void) {
127 SlowLog *slowlog = rm_malloc(sizeof(SlowLog));
128
129 // Redis main thread + writer threads + reader threads.
130 int thread_count = ThreadPools_ThreadCount() + 1;
131
132 slowlog->count = thread_count;
133 slowlog->locks = rm_malloc(sizeof(pthread_mutex_t) * thread_count);
134 slowlog->lookup = rm_malloc(sizeof(rax*) * thread_count);
135 slowlog->min_heap = rm_malloc(sizeof(heap_t*) * thread_count);
136
137 for(int i = 0; i < thread_count; i++) {
138 slowlog->lookup[i] = raxNew();
139 slowlog->min_heap[i] = Heap_new(_slowlog_elem_compare, NULL);
140 int res = pthread_mutex_init(slowlog->locks + i, NULL);
141 ASSERT(res == 0);
142 }
143
144 return slowlog;
145}
146
147void SlowLog_Add
148(

Callers 2

SlowLog_ReplayFunction · 0.85
GraphContext_NewFunction · 0.85

Calls 3

rm_mallocFunction · 0.85
ThreadPools_ThreadCountFunction · 0.85
Heap_newFunction · 0.85

Tested by

no test coverage detected