/bitcoin/depends/work/build/x86_64-pc-linux-gnu/libevent/2.1.12-stable-7656baec08e/minheap-internal.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson |
3 | | * |
4 | | * Copyright (c) 2006 Maxim Yegorushkin <maxim.yegorushkin@gmail.com> |
5 | | * |
6 | | * Redistribution and use in source and binary forms, with or without |
7 | | * modification, are permitted provided that the following conditions |
8 | | * are met: |
9 | | * 1. Redistributions of source code must retain the above copyright |
10 | | * notice, this list of conditions and the following disclaimer. |
11 | | * 2. Redistributions in binary form must reproduce the above copyright |
12 | | * notice, this list of conditions and the following disclaimer in the |
13 | | * documentation and/or other materials provided with the distribution. |
14 | | * 3. The name of the author may not be used to endorse or promote products |
15 | | * derived from this software without specific prior written permission. |
16 | | * |
17 | | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | | */ |
28 | | #ifndef MINHEAP_INTERNAL_H_INCLUDED_ |
29 | | #define MINHEAP_INTERNAL_H_INCLUDED_ |
30 | | |
31 | | #include "event2/event-config.h" |
32 | | #include "evconfig-private.h" |
33 | | #include "event2/event.h" |
34 | | #include "event2/event_struct.h" |
35 | | #include "event2/util.h" |
36 | | #include "util-internal.h" |
37 | | #include "mm-internal.h" |
38 | | |
39 | | typedef struct min_heap |
40 | | { |
41 | | struct event** p; |
42 | | unsigned n, a; |
43 | | } min_heap_t; |
44 | | |
45 | | static inline void min_heap_ctor_(min_heap_t* s); |
46 | | static inline void min_heap_dtor_(min_heap_t* s); |
47 | | static inline void min_heap_elem_init_(struct event* e); |
48 | | static inline int min_heap_elt_is_top_(const struct event *e); |
49 | | static inline int min_heap_empty_(min_heap_t* s); |
50 | | static inline unsigned min_heap_size_(min_heap_t* s); |
51 | | static inline struct event* min_heap_top_(min_heap_t* s); |
52 | | static inline int min_heap_reserve_(min_heap_t* s, unsigned n); |
53 | | static inline int min_heap_push_(min_heap_t* s, struct event* e); |
54 | | static inline struct event* min_heap_pop_(min_heap_t* s); |
55 | | static inline int min_heap_adjust_(min_heap_t *s, struct event* e); |
56 | | static inline int min_heap_erase_(min_heap_t* s, struct event* e); |
57 | | static inline void min_heap_shift_up_(min_heap_t* s, unsigned hole_index, struct event* e); |
58 | | static inline void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e); |
59 | | static inline void min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e); |
60 | | |
61 | | #define min_heap_elem_greater(a, b) \ |
62 | 9.43M | (evutil_timercmp(&(a)->ev_timeout, &(b)->ev_timeout, >)) |
63 | | |
64 | 11.0k | void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; } Unexecuted instantiation: buffer.c:min_heap_ctor_ Unexecuted instantiation: bufferevent.c:min_heap_ctor_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_ctor_ Line | Count | Source | 64 | 11.0k | void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; } |
Unexecuted instantiation: evmap.c:min_heap_ctor_ Unexecuted instantiation: signal.c:min_heap_ctor_ Unexecuted instantiation: select.c:min_heap_ctor_ Unexecuted instantiation: poll.c:min_heap_ctor_ Unexecuted instantiation: epoll.c:min_heap_ctor_ |
65 | 11.0k | void min_heap_dtor_(min_heap_t* s) { if (s->p) mm_free(s->p); } Unexecuted instantiation: buffer.c:min_heap_dtor_ Unexecuted instantiation: bufferevent.c:min_heap_dtor_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_dtor_ Line | Count | Source | 65 | 11.0k | void min_heap_dtor_(min_heap_t* s) { if (s->p) mm_free(s->p); } Branch (65:42): [True: 11.0k, False: 0]
|
Unexecuted instantiation: evmap.c:min_heap_dtor_ Unexecuted instantiation: signal.c:min_heap_dtor_ Unexecuted instantiation: select.c:min_heap_dtor_ Unexecuted instantiation: poll.c:min_heap_dtor_ Unexecuted instantiation: epoll.c:min_heap_dtor_ Branch (65:42): [True: 11.0k, False: 0]
|
66 | 11.8M | void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = -1; } Unexecuted instantiation: buffer.c:min_heap_elem_init_ Unexecuted instantiation: bufferevent.c:min_heap_elem_init_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_elem_init_ event.c:min_heap_elem_init_ Line | Count | Source | 66 | 11.8M | void min_heap_elem_init_(struct event* e) { e->ev_timeout_pos.min_heap_idx = -1; } |
Unexecuted instantiation: evmap.c:min_heap_elem_init_ Unexecuted instantiation: signal.c:min_heap_elem_init_ Unexecuted instantiation: select.c:min_heap_elem_init_ Unexecuted instantiation: poll.c:min_heap_elem_init_ Unexecuted instantiation: epoll.c:min_heap_elem_init_ |
67 | 11.8M | int min_heap_empty_(min_heap_t* s) { return 0u == s->n; } Unexecuted instantiation: buffer.c:min_heap_empty_ Unexecuted instantiation: bufferevent.c:min_heap_empty_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_empty_ Line | Count | Source | 67 | 11.8M | int min_heap_empty_(min_heap_t* s) { return 0u == s->n; } |
Unexecuted instantiation: evmap.c:min_heap_empty_ Unexecuted instantiation: signal.c:min_heap_empty_ Unexecuted instantiation: select.c:min_heap_empty_ Unexecuted instantiation: poll.c:min_heap_empty_ Unexecuted instantiation: epoll.c:min_heap_empty_ |
68 | 7.07M | unsigned min_heap_size_(min_heap_t* s) { return s->n; } Unexecuted instantiation: buffer.c:min_heap_size_ Unexecuted instantiation: bufferevent.c:min_heap_size_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_size_ Line | Count | Source | 68 | 7.07M | unsigned min_heap_size_(min_heap_t* s) { return s->n; } |
Unexecuted instantiation: evmap.c:min_heap_size_ Unexecuted instantiation: signal.c:min_heap_size_ Unexecuted instantiation: select.c:min_heap_size_ Unexecuted instantiation: poll.c:min_heap_size_ Unexecuted instantiation: epoll.c:min_heap_size_ |
69 | 23.5M | struct event* min_heap_top_(min_heap_t* s) { return s->n ? *s->p : 0; } Unexecuted instantiation: buffer.c:min_heap_top_ Unexecuted instantiation: bufferevent.c:min_heap_top_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_top_ Line | Count | Source | 69 | 23.5M | struct event* min_heap_top_(min_heap_t* s) { return s->n ? *s->p : 0; } Branch (69:53): [True: 18.8M, False: 4.75M]
|
Unexecuted instantiation: evmap.c:min_heap_top_ Unexecuted instantiation: signal.c:min_heap_top_ Unexecuted instantiation: select.c:min_heap_top_ Unexecuted instantiation: poll.c:min_heap_top_ Unexecuted instantiation: epoll.c:min_heap_top_ Branch (69:53): [True: 18.8M, False: 4.75M]
|
70 | | |
71 | | int min_heap_push_(min_heap_t* s, struct event* e) |
72 | 18.8M | { |
73 | 18.8M | if (s->n == UINT32_MAX || min_heap_reserve_(s, s->n + 1)) Branch (73:6): [True: 0, False: 18.8M]
Branch (73:28): [True: 0, False: 18.8M]
|
74 | 0 | return -1; |
75 | 18.8M | min_heap_shift_up_(s, s->n++, e); |
76 | 18.8M | return 0; |
77 | 18.8M | } Unexecuted instantiation: buffer.c:min_heap_push_ Unexecuted instantiation: bufferevent.c:min_heap_push_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_push_ Line | Count | Source | 72 | 18.8M | { | 73 | 18.8M | if (s->n == UINT32_MAX || min_heap_reserve_(s, s->n + 1)) Branch (73:6): [True: 0, False: 18.8M]
Branch (73:28): [True: 0, False: 18.8M]
| 74 | 0 | return -1; | 75 | 18.8M | min_heap_shift_up_(s, s->n++, e); | 76 | 18.8M | return 0; | 77 | 18.8M | } |
Unexecuted instantiation: evmap.c:min_heap_push_ Unexecuted instantiation: signal.c:min_heap_push_ Unexecuted instantiation: select.c:min_heap_push_ Unexecuted instantiation: poll.c:min_heap_push_ Unexecuted instantiation: epoll.c:min_heap_push_ |
78 | | |
79 | | struct event* min_heap_pop_(min_heap_t* s) |
80 | 0 | { |
81 | 0 | if (s->n) |
82 | 0 | { |
83 | 0 | struct event* e = *s->p; |
84 | 0 | min_heap_shift_down_(s, 0u, s->p[--s->n]); |
85 | 0 | e->ev_timeout_pos.min_heap_idx = -1; |
86 | 0 | return e; |
87 | 0 | } |
88 | 0 | return 0; |
89 | 0 | } Unexecuted instantiation: buffer.c:min_heap_pop_ Unexecuted instantiation: bufferevent.c:min_heap_pop_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_pop_ Unexecuted instantiation: event.c:min_heap_pop_ Unexecuted instantiation: evmap.c:min_heap_pop_ Unexecuted instantiation: signal.c:min_heap_pop_ Unexecuted instantiation: select.c:min_heap_pop_ Unexecuted instantiation: poll.c:min_heap_pop_ Unexecuted instantiation: epoll.c:min_heap_pop_ |
90 | | |
91 | | int min_heap_elt_is_top_(const struct event *e) |
92 | 18.8M | { |
93 | 18.8M | return e->ev_timeout_pos.min_heap_idx == 0; |
94 | 18.8M | } Unexecuted instantiation: buffer.c:min_heap_elt_is_top_ Unexecuted instantiation: bufferevent.c:min_heap_elt_is_top_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_elt_is_top_ event.c:min_heap_elt_is_top_ Line | Count | Source | 92 | 18.8M | { | 93 | 18.8M | return e->ev_timeout_pos.min_heap_idx == 0; | 94 | 18.8M | } |
Unexecuted instantiation: evmap.c:min_heap_elt_is_top_ Unexecuted instantiation: signal.c:min_heap_elt_is_top_ Unexecuted instantiation: select.c:min_heap_elt_is_top_ Unexecuted instantiation: poll.c:min_heap_elt_is_top_ Unexecuted instantiation: epoll.c:min_heap_elt_is_top_ |
95 | | |
96 | | int min_heap_erase_(min_heap_t* s, struct event* e) |
97 | 18.8M | { |
98 | 18.8M | if (-1 != e->ev_timeout_pos.min_heap_idx) Branch (98:6): [True: 18.8M, False: 0]
|
99 | 18.8M | { |
100 | 18.8M | struct event *last = s->p[--s->n]; |
101 | 18.8M | unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2; |
102 | | /* we replace e with the last element in the heap. We might need to |
103 | | shift it upward if it is less than its parent, or downward if it is |
104 | | greater than one or both its children. Since the children are known |
105 | | to be less than the parent, it can't need to shift both up and |
106 | | down. */ |
107 | 18.8M | if (e->ev_timeout_pos.min_heap_idx > 0 && min_heap_elem_greater(s->p[parent], last)) Branch (107:7): [True: 4.71M, False: 14.1M]
|
108 | 0 | min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, last); |
109 | 18.8M | else |
110 | 18.8M | min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, last); |
111 | 18.8M | e->ev_timeout_pos.min_heap_idx = -1; |
112 | 18.8M | return 0; |
113 | 18.8M | } |
114 | 0 | return -1; |
115 | 18.8M | } Unexecuted instantiation: buffer.c:min_heap_erase_ Unexecuted instantiation: bufferevent.c:min_heap_erase_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_erase_ Line | Count | Source | 97 | 18.8M | { | 98 | 18.8M | if (-1 != e->ev_timeout_pos.min_heap_idx) Branch (98:6): [True: 18.8M, False: 0]
| 99 | 18.8M | { | 100 | 18.8M | struct event *last = s->p[--s->n]; | 101 | 18.8M | unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2; | 102 | | /* we replace e with the last element in the heap. We might need to | 103 | | shift it upward if it is less than its parent, or downward if it is | 104 | | greater than one or both its children. Since the children are known | 105 | | to be less than the parent, it can't need to shift both up and | 106 | | down. */ | 107 | 18.8M | if (e->ev_timeout_pos.min_heap_idx > 0 && min_heap_elem_greater(s->p[parent], last)) Branch (107:7): [True: 4.71M, False: 14.1M]
| 108 | 0 | min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, last); | 109 | 18.8M | else | 110 | 18.8M | min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, last); | 111 | 18.8M | e->ev_timeout_pos.min_heap_idx = -1; | 112 | 18.8M | return 0; | 113 | 18.8M | } | 114 | 0 | return -1; | 115 | 18.8M | } |
Unexecuted instantiation: evmap.c:min_heap_erase_ Unexecuted instantiation: signal.c:min_heap_erase_ Unexecuted instantiation: select.c:min_heap_erase_ Unexecuted instantiation: poll.c:min_heap_erase_ Unexecuted instantiation: epoll.c:min_heap_erase_ |
116 | | |
117 | | int min_heap_adjust_(min_heap_t *s, struct event *e) |
118 | 0 | { |
119 | 0 | if (-1 == e->ev_timeout_pos.min_heap_idx) { |
120 | 0 | return min_heap_push_(s, e); |
121 | 0 | } else { |
122 | 0 | unsigned parent = (e->ev_timeout_pos.min_heap_idx - 1) / 2; |
123 | 0 | /* The position of e has changed; we shift it up or down |
124 | 0 | * as needed. We can't need to do both. */ |
125 | 0 | if (e->ev_timeout_pos.min_heap_idx > 0 && min_heap_elem_greater(s->p[parent], e)) |
126 | 0 | min_heap_shift_up_unconditional_(s, e->ev_timeout_pos.min_heap_idx, e); |
127 | 0 | else |
128 | 0 | min_heap_shift_down_(s, e->ev_timeout_pos.min_heap_idx, e); |
129 | 0 | return 0; |
130 | 0 | } |
131 | 0 | } Unexecuted instantiation: buffer.c:min_heap_adjust_ Unexecuted instantiation: bufferevent.c:min_heap_adjust_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_adjust_ Unexecuted instantiation: event.c:min_heap_adjust_ Unexecuted instantiation: evmap.c:min_heap_adjust_ Unexecuted instantiation: signal.c:min_heap_adjust_ Unexecuted instantiation: select.c:min_heap_adjust_ Unexecuted instantiation: poll.c:min_heap_adjust_ Unexecuted instantiation: epoll.c:min_heap_adjust_ |
132 | | |
133 | | int min_heap_reserve_(min_heap_t* s, unsigned n) |
134 | 25.9M | { |
135 | 25.9M | if (s->a < n) Branch (135:6): [True: 11.0k, False: 25.9M]
|
136 | 11.0k | { |
137 | 11.0k | struct event** p; |
138 | 11.0k | unsigned a = s->a ? s->a * 2 : 8; Branch (138:16): [True: 0, False: 11.0k]
|
139 | 11.0k | if (a < n) Branch (139:7): [True: 0, False: 11.0k]
|
140 | 0 | a = n; |
141 | | #if (SIZE_MAX == UINT32_MAX) |
142 | | if (a > SIZE_MAX / sizeof *p) |
143 | | return -1; |
144 | | #endif |
145 | 11.0k | if (!(p = (struct event**)mm_realloc(s->p, a * sizeof *p))) Branch (145:7): [True: 0, False: 11.0k]
|
146 | 0 | return -1; |
147 | 11.0k | s->p = p; |
148 | 11.0k | s->a = a; |
149 | 11.0k | } |
150 | 25.9M | return 0; |
151 | 25.9M | } Unexecuted instantiation: buffer.c:min_heap_reserve_ Unexecuted instantiation: bufferevent.c:min_heap_reserve_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_reserve_ event.c:min_heap_reserve_ Line | Count | Source | 134 | 25.9M | { | 135 | 25.9M | if (s->a < n) Branch (135:6): [True: 11.0k, False: 25.9M]
| 136 | 11.0k | { | 137 | 11.0k | struct event** p; | 138 | 11.0k | unsigned a = s->a ? s->a * 2 : 8; Branch (138:16): [True: 0, False: 11.0k]
| 139 | 11.0k | if (a < n) Branch (139:7): [True: 0, False: 11.0k]
| 140 | 0 | a = n; | 141 | | #if (SIZE_MAX == UINT32_MAX) | 142 | | if (a > SIZE_MAX / sizeof *p) | 143 | | return -1; | 144 | | #endif | 145 | 11.0k | if (!(p = (struct event**)mm_realloc(s->p, a * sizeof *p))) Branch (145:7): [True: 0, False: 11.0k]
| 146 | 0 | return -1; | 147 | 11.0k | s->p = p; | 148 | 11.0k | s->a = a; | 149 | 11.0k | } | 150 | 25.9M | return 0; | 151 | 25.9M | } |
Unexecuted instantiation: evmap.c:min_heap_reserve_ Unexecuted instantiation: signal.c:min_heap_reserve_ Unexecuted instantiation: select.c:min_heap_reserve_ Unexecuted instantiation: poll.c:min_heap_reserve_ Unexecuted instantiation: epoll.c:min_heap_reserve_ |
152 | | |
153 | | void min_heap_shift_up_unconditional_(min_heap_t* s, unsigned hole_index, struct event* e) |
154 | 0 | { |
155 | 0 | unsigned parent = (hole_index - 1) / 2; |
156 | 0 | do |
157 | 0 | { |
158 | 0 | (s->p[hole_index] = s->p[parent])->ev_timeout_pos.min_heap_idx = hole_index; |
159 | 0 | hole_index = parent; |
160 | 0 | parent = (hole_index - 1) / 2; |
161 | 0 | } while (hole_index && min_heap_elem_greater(s->p[parent], e)); Branch (161:14): [True: 0, False: 0]
|
162 | 0 | (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index; |
163 | 0 | } Unexecuted instantiation: buffer.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: bufferevent.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: event.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: evmap.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: signal.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: select.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: poll.c:min_heap_shift_up_unconditional_ Unexecuted instantiation: epoll.c:min_heap_shift_up_unconditional_ |
164 | | |
165 | | void min_heap_shift_up_(min_heap_t* s, unsigned hole_index, struct event* e) |
166 | 18.8M | { |
167 | 18.8M | unsigned parent = (hole_index - 1) / 2; |
168 | 18.8M | while (hole_index && min_heap_elem_greater(s->p[parent], e)) Branch (168:12): [True: 4.71M, False: 14.1M]
|
169 | 0 | { |
170 | 0 | (s->p[hole_index] = s->p[parent])->ev_timeout_pos.min_heap_idx = hole_index; |
171 | 0 | hole_index = parent; |
172 | 0 | parent = (hole_index - 1) / 2; |
173 | 0 | } |
174 | 18.8M | (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index; |
175 | 18.8M | } Unexecuted instantiation: buffer.c:min_heap_shift_up_ Unexecuted instantiation: bufferevent.c:min_heap_shift_up_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_shift_up_ event.c:min_heap_shift_up_ Line | Count | Source | 166 | 18.8M | { | 167 | 18.8M | unsigned parent = (hole_index - 1) / 2; | 168 | 18.8M | while (hole_index && min_heap_elem_greater(s->p[parent], e)) Branch (168:12): [True: 4.71M, False: 14.1M]
| 169 | 0 | { | 170 | 0 | (s->p[hole_index] = s->p[parent])->ev_timeout_pos.min_heap_idx = hole_index; | 171 | 0 | hole_index = parent; | 172 | 0 | parent = (hole_index - 1) / 2; | 173 | 0 | } | 174 | 18.8M | (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index; | 175 | 18.8M | } |
Unexecuted instantiation: evmap.c:min_heap_shift_up_ Unexecuted instantiation: signal.c:min_heap_shift_up_ Unexecuted instantiation: select.c:min_heap_shift_up_ Unexecuted instantiation: poll.c:min_heap_shift_up_ Unexecuted instantiation: epoll.c:min_heap_shift_up_ |
176 | | |
177 | | void min_heap_shift_down_(min_heap_t* s, unsigned hole_index, struct event* e) |
178 | 18.8M | { |
179 | 18.8M | unsigned min_child = 2 * (hole_index + 1); |
180 | 18.8M | while (min_child <= s->n) Branch (180:12): [True: 0, False: 18.8M]
|
181 | 0 | { |
182 | 0 | min_child -= min_child == s->n || min_heap_elem_greater(s->p[min_child], s->p[min_child - 1]); Branch (182:15): [True: 0, False: 0]
|
183 | 0 | if (!(min_heap_elem_greater(e, s->p[min_child]))) Branch (183:6): [True: 0, False: 0]
|
184 | 0 | break; |
185 | 0 | (s->p[hole_index] = s->p[min_child])->ev_timeout_pos.min_heap_idx = hole_index; |
186 | 0 | hole_index = min_child; |
187 | 0 | min_child = 2 * (hole_index + 1); |
188 | 0 | } |
189 | 18.8M | (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index; |
190 | 18.8M | } Unexecuted instantiation: buffer.c:min_heap_shift_down_ Unexecuted instantiation: bufferevent.c:min_heap_shift_down_ Unexecuted instantiation: bufferevent_ratelim.c:min_heap_shift_down_ event.c:min_heap_shift_down_ Line | Count | Source | 178 | 18.8M | { | 179 | 18.8M | unsigned min_child = 2 * (hole_index + 1); | 180 | 18.8M | while (min_child <= s->n) Branch (180:12): [True: 0, False: 18.8M]
| 181 | 0 | { | 182 | 0 | min_child -= min_child == s->n || min_heap_elem_greater(s->p[min_child], s->p[min_child - 1]); Branch (182:15): [True: 0, False: 0]
| 183 | 0 | if (!(min_heap_elem_greater(e, s->p[min_child]))) Branch (183:6): [True: 0, False: 0]
| 184 | 0 | break; | 185 | 0 | (s->p[hole_index] = s->p[min_child])->ev_timeout_pos.min_heap_idx = hole_index; | 186 | 0 | hole_index = min_child; | 187 | 0 | min_child = 2 * (hole_index + 1); | 188 | 0 | } | 189 | 18.8M | (s->p[hole_index] = e)->ev_timeout_pos.min_heap_idx = hole_index; | 190 | 18.8M | } |
Unexecuted instantiation: evmap.c:min_heap_shift_down_ Unexecuted instantiation: signal.c:min_heap_shift_down_ Unexecuted instantiation: select.c:min_heap_shift_down_ Unexecuted instantiation: poll.c:min_heap_shift_down_ Unexecuted instantiation: epoll.c:min_heap_shift_down_ |
191 | | |
192 | | #endif /* MINHEAP_INTERNAL_H_INCLUDED_ */ |