MCPcopy Index your code
hub / github.com/ElementsProject/lightning / add_level

Function add_level

ccan/ccan/timer/timer.c:156–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156static void add_level(struct timers *timers, unsigned int level)
157{
158 struct timer_level *l;
159 struct timer *t;
160 unsigned int i;
161 struct list_head from_far;
162
163 l = timer_alloc(timers, sizeof(*l));
164 if (!l)
165 return;
166
167 for (i = 0; i < ARRAY_SIZE(l->list); i++)
168 list_head_init(&l->list[i]);
169 timers->level[level] = l;
170
171 list_head_init(&from_far);
172 timers_far_get(timers, &from_far,
173 timers->base + (1ULL << ((level+1)*TIMER_LEVEL_BITS)) - 1);
174
175 while ((t = list_pop(&from_far, struct timer, list)) != NULL)
176 timer_add_raw(timers, t);
177}
178
179/* We don't need to search past the first at level 0, since the
180 * bucket range is 1; they're all the same. */

Callers 3

timer_fast_forwardFunction · 0.85
timers_expireFunction · 0.85
mainFunction · 0.85

Calls 3

list_head_initFunction · 0.85
timers_far_getFunction · 0.85
timer_add_rawFunction · 0.85

Tested by 1

mainFunction · 0.68