Home | History | Annotate | Download | only in blktrace

Lines Matching refs:dstat

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