Lines Matching refs:dstat
61 struct dstat { struct
64 struct dstat *next; argument
85 static struct dstat *vacant_dstats_list = NULL;
87 static struct dstat *dstat_list[2] = {};
156 static struct dstat *blkiomon_alloc_dstat(void) in blkiomon_alloc_dstat()
158 struct dstat *dstat; in blkiomon_alloc_dstat() local
161 dstat = vacant_dstats_list; in blkiomon_alloc_dstat()
162 vacant_dstats_list = dstat->next; in blkiomon_alloc_dstat()
164 dstat = malloc(sizeof(*dstat)); in blkiomon_alloc_dstat()
165 if (!dstat) { in blkiomon_alloc_dstat()
171 blkiomon_stat_init(&dstat->msg.stat); in blkiomon_alloc_dstat()
172 return dstat; in blkiomon_alloc_dstat()
175 static struct dstat *blkiomon_find_dstat(struct rb_search *search, __u32 device) in blkiomon_find_dstat()
179 struct dstat *dstat; in blkiomon_find_dstat() local
184 dstat = rb_entry(parent, struct dstat, node); in blkiomon_find_dstat()
186 if (dstat->msg.stat.device < device) in blkiomon_find_dstat()
188 else if (dstat->msg.stat.device > device) in blkiomon_find_dstat()
191 return dstat; in blkiomon_find_dstat()
198 static struct dstat *blkiomon_get_dstat(__u32 device) in blkiomon_get_dstat()
200 struct dstat *dstat; in blkiomon_get_dstat() local
205 dstat = blkiomon_find_dstat(&search, device); in blkiomon_get_dstat()
206 if (dstat) in blkiomon_get_dstat()
209 dstat = blkiomon_alloc_dstat(); in blkiomon_get_dstat()
210 if (!dstat) in blkiomon_get_dstat()
213 dstat->msg.stat.device = device; in blkiomon_get_dstat()
215 rb_link_node(&dstat->node, search.parent, search.node_ptr); in blkiomon_get_dstat()
216 rb_insert_color(&dstat->node, &dstat_tree[dstat_curr]); in blkiomon_get_dstat()
218 dstat->next = dstat_list[dstat_curr]; in blkiomon_get_dstat()
219 dstat_list[dstat_curr] = dstat; in blkiomon_get_dstat()
223 return dstat; in blkiomon_get_dstat()
226 static int blkiomon_output_msg_q(struct dstat *dstat) in blkiomon_output_msg_q() argument
231 dstat->msg.mtype = msg_id; in blkiomon_output_msg_q()
232 return msgsnd(msg_q, &dstat->msg, sizeof(struct blkiomon_stat), 0); in blkiomon_output_msg_q()
235 static int blkiomon_output_binary(struct dstat *dstat) in blkiomon_output_binary() argument
237 struct blkiomon_stat *p = &dstat->msg.stat; in blkiomon_output_binary()
255 static struct dstat *blkiomon_output(struct dstat *head, struct timespec *ts) in blkiomon_output()
257 struct dstat *dstat, *tail = NULL; in blkiomon_output() local
259 for (dstat = head; dstat; dstat = dstat->next) { in blkiomon_output()
260 dstat->msg.stat.time = ts->tv_sec; in blkiomon_output()
261 blkiomon_stat_print(human.fp, &dstat->msg.stat); in blkiomon_output()
262 blkiomon_stat_to_be(&dstat->msg.stat); in blkiomon_output()
263 blkiomon_output_binary(dstat); in blkiomon_output()
264 blkiomon_output_msg_q(dstat); in blkiomon_output()
265 tail = dstat; in blkiomon_output()
273 struct dstat *head, *tail; in blkiomon_interval()
311 struct dstat *dstat; in blkiomon_account() local
317 dstat = blkiomon_get_dstat(bit_d->device); in blkiomon_account()
318 if (!dstat) in blkiomon_account()
320 p = &dstat->msg.stat; in blkiomon_account()