2 * blktrace output analysis: generate a timeline & gather statistics
4 * Copyright (C) 2006 Alan D. Brunelle <Alan.Brunelle@hp.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 typedef struct avg_info *ai_dip_t;
25 ai_dip_t dip_q2q_avg(struct d_info *dip) { return &dip->avgs.q2q; }
26 ai_dip_t dip_q2c_avg(struct d_info *dip) { return &dip->avgs.q2c; }
27 ai_dip_t dip_q2a_avg(struct d_info *dip) { return &dip->avgs.q2a; }
28 ai_dip_t dip_q2i_avg(struct d_info *dip) { return &dip->avgs.q2i; }
29 ai_dip_t dip_i2d_avg(struct d_info *dip) { return &dip->avgs.i2d; }
30 ai_dip_t dip_d2c_avg(struct d_info *dip) { return &dip->avgs.d2c; }
32 typedef struct avg_info *ai_pip_t;
33 ai_pip_t pip_q2q_avg(struct p_info *pip) { return &pip->avgs.q2q; }
34 ai_pip_t pip_q2c_avg(struct p_info *pip) { return &pip->avgs.q2c; }
35 ai_pip_t pip_q2a_avg(struct p_info *pip) { return &pip->avgs.q2a; }
36 ai_pip_t pip_q2i_avg(struct p_info *pip) { return &pip->avgs.q2i; }
37 ai_pip_t pip_i2d_avg(struct p_info *pip) { return &pip->avgs.i2d; }
38 ai_pip_t pip_d2c_avg(struct p_info *pip) { return &pip->avgs.d2c; }
40 void output_section_hdr(FILE *ofp, char *hdr)
42 fprintf(ofp, "==================== ");
44 fprintf(ofp, " ====================\n\n");
47 void output_hdr(FILE *ofp, char *hdr)
49 fprintf(ofp, "%15s %13s %13s %13s %11s\n",
50 hdr, "MIN", "AVG", "MAX", "N" );
51 fprintf(ofp, "--------------- ------------- ------------- ------------- -----------\n");
54 void __output_avg(FILE *ofp, char *hdr, struct avg_info *ap)
57 ap->avg = BIT_TIME(ap->total) / (double)ap->n;
58 fprintf(ofp, "%-15s %13.9f %13.9f %13.9f %11d\n", hdr,
59 BIT_TIME(ap->min), ap->avg, BIT_TIME(ap->max), ap->n);
63 void output_hdr2(FILE *ofp, char*hdr)
65 fprintf(ofp, "%15s %13s %13s %13s %13s %13s %13s\n", hdr, "Q2Q", "Q2A", "Q2I", "I2D", "D2C", "Q2C");
66 fprintf(ofp, "--------------- ------------- ------------- ------------- ------------- ------------- -------------\n");
69 static inline char *avg2string(struct avg_info *ap, char *string)
72 sprintf(string, "%13.9f", ap->avg);
78 void __output_avg2(FILE *ofp, char *hdr, struct avgs_info *ap)
80 char c1[16], c2[16], c3[16], c4[16], c5[16], c6[16];
82 if (ap->q2q.n > 0 || ap->q2a.n > 0 || ap->q2i.n > 0 ||
83 ap->i2d.n > 0 || ap->d2c.n > 0 || ap->q2c.n > 0) {
84 fprintf(ofp, "%-15s %13s %13s %13s %13s %13s %13s\n", hdr,
85 avg2string(&ap->q2q,c1), avg2string(&ap->q2a,c2),
86 avg2string(&ap->q2i,c3), avg2string(&ap->i2d,c4),
87 avg2string(&ap->d2c,c5), avg2string(&ap->q2c,c6));
91 void __pip_output_avg2(struct p_info *pip, void *arg)
93 __output_avg2((FILE *)arg, pip->name, &pip->avgs);
96 void __dip_output_avg2(struct d_info *dip, void *arg)
99 __output_avg2((FILE *)arg, make_dev_hdr(dev_info, 15, dip), &dip->avgs);
102 char *make_dev_hdr(char *pad, size_t len, struct d_info *dip)
104 if (dip->map == NULL)
105 snprintf(pad, len, "(%3d,%3d)",
106 MAJOR(dip->device), MINOR(dip->device));
108 snprintf(pad, len, "%s", dip->map->device);
115 ai_dip_t (*func)(struct d_info *);
117 void __output_dip_avg(struct d_info *dip, void *arg)
119 struct __oda *odap = arg;
120 ai_dip_t ap = odap->func(dip);
123 ap->avg = BIT_TIME(ap->total) / (double)ap->n;
124 __output_avg(odap->ofp, make_dev_hdr(dev_info, 15, dip), ap);
128 void output_dip_avg(FILE *ofp, char *hdr, ai_dip_t (*func)(struct d_info *))
130 struct __oda oda = { .ofp = ofp, .func = func};
131 output_hdr(ofp, hdr);
132 dip_foreach_out(__output_dip_avg, &oda);
141 void __output_q2d_histo(struct d_info *dip, void *arg)
143 struct __q2d *q2dp = arg;
145 if (q2d_ok(dip->q2d_priv)) {
147 FILE *ofp = q2dp->ofp;
149 fprintf(q2dp->ofp, "%10s | ", make_dev_hdr(scratch, 15, dip));
150 q2d_display(ofp, dip->q2d_priv);
151 q2d_acc(q2dp->q2d_all, dip->q2d_priv);
156 void output_q2d_histo(FILE *ofp)
158 struct __q2d __q2d = {
160 .q2d_all = q2d_init(),
164 fprintf(ofp, "%10s | ", "DEV");
165 q2d_display_header(ofp);
166 fprintf(ofp, "--------- | ");
167 q2d_display_dashes(ofp);
168 dip_foreach_out(__output_q2d_histo, &__q2d);
171 fprintf(ofp, "========== | ");
172 q2d_display_dashes(ofp);
173 fprintf(ofp, "%10s | ", "AVG");
174 q2d_display(ofp, __q2d.q2d_all);
181 unsigned long long nq, nd, blkmin, blkmax, total;
183 void __output_dip_merge_ratio(struct d_info *dip, void *arg)
187 double ratio, q2c_n, d2c_n;
189 if (dip->n_qs == 0 || dip->n_ds == 0)
191 else if (dip->n_qs < dip->n_ds)
192 dip->n_qs = dip->n_ds;
196 if (q2c_n > 0.0 && d2c_n > 0.0) {
200 ratio = q2c_n / d2c_n;
201 blks_avg = (double)dip->avgs.blks.total / d2c_n;
203 "%10s | %8llu %8llu %7.1lf | %8llu %8llu %8llu %8llu\n",
204 make_dev_hdr(scratch, 15, dip),
205 (unsigned long long)dip->n_qs,
206 (unsigned long long)dip->n_ds,
208 (unsigned long long)dip->avgs.blks.min,
209 (unsigned long long)blks_avg,
210 (unsigned long long)dip->avgs.blks.max,
211 (unsigned long long)dip->avgs.blks.total);
213 if (n_merges++ == 0) {
214 merge_data.blkmin = dip->avgs.blks.min;
215 merge_data.blkmax = dip->avgs.blks.max;
218 merge_data.nq += dip->n_qs;
219 merge_data.nd += dip->n_ds;
220 merge_data.total += dip->avgs.blks.total;
221 if (dip->avgs.blks.min < merge_data.blkmin)
222 merge_data.blkmin = dip->avgs.blks.min;
223 if (dip->avgs.blks.max > merge_data.blkmax)
224 merge_data.blkmax = dip->avgs.blks.max;
228 void output_dip_merge_ratio(FILE *ofp)
230 fprintf(ofp, "%10s | %8s %8s %7s | %8s %8s %8s %8s\n", "DEV", "#Q", "#D", "Ratio", "BLKmin", "BLKavg", "BLKmax", "Total");
231 fprintf(ofp, "---------- | -------- -------- ------- | -------- -------- -------- --------\n");
232 dip_foreach_out(__output_dip_merge_ratio, ofp);
234 fprintf(ofp, "---------- | -------- -------- ------- | -------- -------- -------- --------\n");
235 fprintf(ofp, "%10s | %8s %8s %7s | %8s %8s %8s %8s\n", "DEV", "#Q", "#D", "Ratio", "BLKmin", "BLKavg", "BLKmax", "Total");
237 "%10s | %8llu %8llu %7.1lf | %8llu %8llu %8llu %8llu\n",
238 "TOTAL", merge_data.nq, merge_data.nd,
239 (float)merge_data.nq / (float)merge_data.nd,
241 merge_data.total / merge_data.nd,
242 merge_data.blkmax, merge_data.total);
247 #define AVG(a,b) (100.0 * ((double)(a) / (double)(b)))
248 #define CALC_AVG(ap) (ap)->avg = ((ap)->n == 0 ? 0.0 : \
249 (BIT_TIME((ap)->total) / \
251 char *q2i_v_q2C(struct d_info *dip, char *s)
255 if (dip->avgs.q2i.n == 0) return " ";
257 q2c = dip->avgs.q2i.avg + dip->avgs.i2d.avg + dip->avgs.d2c.avg;
258 sprintf(s, "%5.1lf%%", AVG(dip->avgs.q2i.avg, q2c));
263 char *i2d_v_q2C(struct d_info *dip, char *s)
267 if (dip->avgs.d2c.n == 0) return " ";
269 q2c = dip->avgs.q2i.avg + dip->avgs.i2d.avg + dip->avgs.d2c.avg;
270 sprintf(s, "%5.1lf%%", AVG(dip->avgs.i2d.avg, q2c));
275 char *d2c_v_q2C(struct d_info *dip, char *s)
279 if (dip->avgs.d2c.n == 0) return " ";
281 q2c = dip->avgs.q2i.avg + dip->avgs.i2d.avg + dip->avgs.d2c.avg;
282 sprintf(s, "%5.1lf%%", AVG(dip->avgs.d2c.avg, q2c));
287 void __output_dip_prep_ohead(struct d_info *dip, void *arg)
290 char s1[16], s2[16], s3[16];
292 if ((dip->avgs.q2i.n > 0 && dip->avgs.i2d.n > 0 &&
293 dip->avgs.d2c.n > 0)) {
294 CALC_AVG(&dip->avgs.q2i);
295 CALC_AVG(&dip->avgs.i2d);
296 CALC_AVG(&dip->avgs.d2c);
298 fprintf((FILE *)arg, "%10s | %6s %6s %6s\n",
299 make_dev_hdr(dev_info, 15, dip),
300 q2i_v_q2C(dip, s1), i2d_v_q2C(dip, s2),
305 void output_dip_prep_ohead(FILE *ofp)
307 fprintf(ofp, "%10s | %6s %6s %6s\n", "DEV", "Q2I", "I2D", "D2C");
308 fprintf(ofp, "---------- | ------ ------ ------\n");
309 dip_foreach_out(__output_dip_prep_ohead, ofp);
313 struct seek_mode_info {
314 struct seek_mode_info *next;
319 long long nseeks, median;
321 struct seek_mode_info *head;
325 void output_seek_mode_info(FILE *ofp, struct o_seek_info *sip)
327 struct seek_mode_info *p, *this, *new_list = NULL;
329 ASSERT(sip->head != NULL);
330 while ((this = sip->head) != NULL) {
331 sip->head = this->next;
334 if (new_list == NULL || this->nseeks > new_list->nseeks)
336 else if (this->nseeks == new_list->nseeks) {
337 assert(this->nseeks == new_list->nseeks);
338 for (p = new_list; p != NULL; p = p->next)
339 if (p->mode == this->mode)
343 this->nseeks += p->nseeks;
345 this->next = new_list;
350 fprintf(ofp, "%10s | %15lld %15.1lf %15lld | %lld(%d)",
351 "Average", sip->nseeks, sip->mean / sip->nseeks,
352 sip->median / sip->nseeks, new_list->mode, new_list->nseeks);
354 for (p = new_list->next; p != NULL; p = p->next)
355 fprintf(ofp, " %lld(%d)", p->mode, p->nseeks);
358 void add_seek_mode_info(struct o_seek_info *sip, struct mode *mp)
361 long long *lp = mp->modes;
362 struct seek_mode_info *smip;
365 for (i = 0; i < mp->nmds; i++, lp++) {
366 for (smip = sip->head; smip; smip = smip->next) {
367 if (smip->mode == *lp) {
368 smip->nseeks += mp->most_seeks;
373 struct seek_mode_info *new = malloc(sizeof(*new));
375 new->next = sip->head;
378 new->nseeks = mp->most_seeks;
385 static void do_output_dip_seek_info(struct d_info *dip, FILE *ofp, int is_q2q)
393 void *handle = is_q2q ? dip->q2q_handle : dip->seek_handle;
395 nseeks = seeki_nseeks(handle);
397 mean = seeki_mean(handle);
398 median = seeki_median(handle);
399 nmodes = seeki_mode(handle, &m);
401 fprintf(ofp, "%10s | %15lld %15.1lf %15lld | %lld(%d)",
402 make_dev_hdr(dev_info, 15, dip), nseeks, mean, median,
403 nmodes > 0 ? m.modes[0] : 0, m.most_seeks);
404 for (i = 1; i < nmodes; i++)
405 fprintf(ofp, " %lld", m.modes[i]);
408 seek_info.nseeks += nseeks;
409 seek_info.mean += (nseeks * mean);
410 seek_info.median += (nseeks * median);
411 add_seek_mode_info(&seek_info, &m);
416 void __output_dip_seek_info(struct d_info *dip, void *arg)
418 do_output_dip_seek_info(dip, (FILE *)arg, 0);
421 void __output_dip_q2q_seek_info(struct d_info *dip, void *arg)
423 do_output_dip_seek_info(dip, (FILE *)arg, 1);
426 void output_dip_seek_info(FILE *ofp)
429 memset(&seek_info, 0, sizeof(seek_info));
431 fprintf(ofp, "%10s | %15s %15s %15s | %-15s\n", "DEV", "NSEEKS",
432 "MEAN", "MEDIAN", "MODE");
433 fprintf(ofp, "---------- | --------------- --------------- --------------- | ---------------\n");
434 dip_foreach_out(__output_dip_seek_info, ofp);
436 fprintf(ofp, "---------- | --------------- --------------- --------------- | ---------------\n");
437 fprintf(ofp, "%10s | %15s %15s %15s | %-15s\n",
438 "Overall", "NSEEKS", "MEAN", "MEDIAN", "MODE");
439 output_seek_mode_info(ofp, &seek_info);
445 void output_dip_q2q_seek_info(FILE *ofp)
448 memset(&seek_info, 0, sizeof(seek_info));
450 fprintf(ofp, "%10s | %15s %15s %15s | %-15s\n", "DEV", "NSEEKS",
451 "MEAN", "MEDIAN", "MODE");
452 fprintf(ofp, "---------- | --------------- --------------- --------------- | ---------------\n");
453 dip_foreach_out(__output_dip_q2q_seek_info, ofp);
455 fprintf(ofp, "---------- | --------------- --------------- --------------- | ---------------\n");
456 fprintf(ofp, "%10s | %15s %15s %15s | %-15s\n",
457 "Overall", "NSEEKS", "MEAN", "MEDIAN", "MODE");
458 output_seek_mode_info(ofp, &seek_info);
466 ai_pip_t (*func)(struct p_info *);
469 void __output_pip_avg(struct p_info *pip, void *arg)
471 struct __opa *opap = arg;
472 ai_pip_t ap = opap->func(pip);
476 snprintf(proc_name, 15, pip->name);
478 ap->avg = BIT_TIME(ap->total) / (double)ap->n;
479 __output_avg(opap->ofp, proc_name, ap);
483 void output_pip_avg(FILE *ofp, char *hdr, ai_pip_t (*func)(struct p_info *))
485 struct __opa opa = { .ofp = ofp, .func = func };
487 output_hdr(ofp, hdr);
488 pip_foreach_out(__output_pip_avg, &opa);
492 void output_dip_avgs(FILE *ofp)
494 output_hdr2(ofp,"Dev");
495 dip_foreach_out(__dip_output_avg2, ofp);
499 void output_pip_avgs(FILE *ofp)
501 output_hdr2(ofp,"Exe");
502 pip_foreach_out(__pip_output_avg2, ofp);
508 long n_plugs, n_timer_unplugs;
512 void __dip_output_plug(struct d_info *dip, void *arg)
518 if (dip->nplugs > 0) {
519 if (dip->is_plugged) dip_unplug(dip->device, dip->end_time, 0);
520 delta = dip->end_time - dip->start_time;
521 pct = 100.0 * ((dip->plugged_time / delta) / delta);
523 fprintf(ofp, "%10s | %10d(%10d) | %13.9lf%%\n",
524 make_dev_hdr(dev_info, 15, dip),
525 dip->nplugs, dip->n_timer_unplugs, pct);
528 plug_info.n_plugs += dip->nplugs;
529 plug_info.n_timer_unplugs += dip->n_timer_unplugs;
530 plug_info.t_percent += pct;
534 void __dip_output_plug_all(FILE *ofp, struct plug_info *p)
536 fprintf(ofp, "---------- | ---------- ---------- | ----------------\n");
537 fprintf(ofp, "%10s | %10s %10s | %s\n",
538 "Overall", "# Plugs", "# Timer Us", "% Time Q Plugged");
539 fprintf(ofp, "%10s | %10ld(%10ld) | %13.9lf%%\n", "Average",
540 p->n_plugs / n_plugs, p->n_timer_unplugs / n_plugs,
541 p->t_percent / n_plugs);
545 void output_plug_info(FILE *ofp)
547 fprintf(ofp, "%10s | %10s %10s | %s\n",
548 "DEV", "# Plugs", "# Timer Us", "% Time Q Plugged");
549 fprintf(ofp, "---------- | ---------- ---------- | ----------------\n");
550 dip_foreach_out(__dip_output_plug, ofp);
552 __dip_output_plug_all(ofp, &plug_info);
562 void __dip_output_actQ(struct d_info *dip, void *arg)
564 if (dip->n_qs > 0 && !remapper_dev(dip->device)) {
566 double a_actQs = (double)dip->t_act_q / (double)dip->n_qs;
568 fprintf((FILE *)arg, "%10s | %13.1lf\n",
569 make_dev_hdr(dev_info, 15, dip), a_actQs);
572 actQ_info.t_qs += dip->n_qs;
573 actQ_info.t_act_qs += dip->t_act_q;
577 void __dip_output_actQ_all(FILE *ofp, struct actQ_info *p)
579 fprintf(ofp, "---------- | -------------\n");
580 fprintf(ofp, "%10s | %13s\n", "Overall", "Avgs Reqs @ Q");
581 fprintf(ofp, "%10s | %13.1lf\n", "Average",
582 (double)p->t_act_qs / (double)p->t_qs);
585 void output_actQ_info(FILE *ofp)
587 fprintf(ofp, "%10s | %13s\n", "DEV", "Avg Reqs @ Q");
588 fprintf(ofp, "---------- | -------------\n");
589 dip_foreach_out(__dip_output_actQ, ofp);
591 __dip_output_actQ_all(ofp, &actQ_info);
595 void output_histos(void)
601 if (output_name == NULL) return;
603 sprintf(fname, "%s_qhist.dat", output_name);
604 ofp = fopen(fname, "w");
610 fprintf(ofp, "# BTT histogram data\n");
611 fprintf(ofp, "# Q buckets\n");
612 for (i = 0; i < (N_HIST_BKTS-1); i++)
613 fprintf(ofp, "%4d %lld\n", (i+1), (long long)q_histo[i]);
614 fprintf(ofp, "\n# Q bucket for > %d\n%4d %lld\n", (int)N_HIST_BKTS-1,
615 N_HIST_BKTS-1, (long long)q_histo[N_HIST_BKTS-1]);
618 sprintf(fname, "%s_dhist.dat", output_name);
619 ofp = fopen(fname, "w");
624 fprintf(ofp, "# D buckets\n");
625 for (i = 0; i < (N_HIST_BKTS-1); i++)
626 fprintf(ofp, "%4d %lld\n", (i+1), (long long)d_histo[i]);
627 fprintf(ofp, "\n# D bucket for > %d\n%4d %lld\n", (int)N_HIST_BKTS-1,
628 N_HIST_BKTS-1, (long long)d_histo[N_HIST_BKTS-1]);
632 int output_avgs(FILE *ofp)
634 if (output_all_data) {
635 if (exes == NULL || *exes != '\0') {
636 output_section_hdr(ofp, "Per Process");
637 output_pip_avg(ofp, "Q2Q", pip_q2q_avg);
638 output_pip_avg(ofp, "Q2A", pip_q2a_avg);
639 output_pip_avg(ofp, "Q2I", pip_q2i_avg);
640 output_pip_avg(ofp, "I2D", pip_i2d_avg);
641 output_pip_avg(ofp, "D2C", pip_d2c_avg);
642 output_pip_avg(ofp, "Q2C", pip_q2c_avg);
645 output_section_hdr(ofp, "Per Device");
646 output_dip_avg(ofp, "Q2Q", dip_q2q_avg);
647 output_dip_avg(ofp, "Q2A", dip_q2a_avg);
648 output_dip_avg(ofp, "Q2I", dip_q2i_avg);
649 output_dip_avg(ofp, "I2D", dip_i2d_avg);
650 output_dip_avg(ofp, "D2C", dip_d2c_avg);
651 output_dip_avg(ofp, "Q2C", dip_q2c_avg);
654 output_section_hdr(ofp, "All Devices");
655 output_hdr(ofp, "ALL");
656 __output_avg(ofp, "Q2Q", &all_avgs.q2q);
657 __output_avg(ofp, "Q2A", &all_avgs.q2a);
658 __output_avg(ofp, "Q2I", &all_avgs.q2i);
659 __output_avg(ofp, "I2D", &all_avgs.i2d);
660 __output_avg(ofp, "D2C", &all_avgs.d2c);
661 __output_avg(ofp, "Q2C", &all_avgs.q2c);
664 output_section_hdr(ofp, "Device Overhead");
665 output_dip_prep_ohead(ofp);
667 if (output_all_data) {
668 if (exes == NULL || *exes != '\0') {
669 output_section_hdr(ofp, "Per Process (avgs)");
670 output_pip_avgs(ofp);
673 output_section_hdr(ofp, "Per Device (avgs)");
674 output_dip_avgs(ofp);
677 output_section_hdr(ofp, "Device Merge Information");
678 output_dip_merge_ratio(ofp);
680 output_section_hdr(ofp, "Device Q2Q Seek Information");
681 output_dip_q2q_seek_info(ofp);
683 output_section_hdr(ofp, "Device D2D Seek Information");
684 output_dip_seek_info(ofp);
686 output_section_hdr(ofp, "Plug Information");
687 output_plug_info(ofp);
689 output_section_hdr(ofp, "Active Requests At Q Information");
690 output_actQ_info(ofp);
694 if (output_all_data) {
695 output_section_hdr(ofp, "Q2D Histogram");
696 output_q2d_histo(ofp);
702 void __output_ranges(FILE *ofp, struct list_head *head_p, float base)
704 struct range_info *rip;
706 float limit = base + 0.4;
708 __list_for_each(p, head_p) {
709 rip = list_entry(p, struct range_info, head);
710 fprintf(ofp, "%13.9lf %5.1f\n", BIT_TIME(rip->start), base);
711 fprintf(ofp, "%13.9lf %5.1f\n", BIT_TIME(rip->start), limit);
712 fprintf(ofp, "%13.9lf %5.1f\n", BIT_TIME(rip->end), limit);
713 fprintf(ofp, "%13.9lf %5.1f\n", BIT_TIME(rip->end), base);
717 int output_regions(FILE *ofp, char *header, struct region_info *reg,
720 if (list_len(®->qranges) == 0 && list_len(®->cranges) == 0)
723 fprintf(ofp, "# %16s : q activity\n", header);
724 __output_ranges(ofp, ®->qranges, base);
727 fprintf(ofp, "# %16s : c activity\n", header);
728 __output_ranges(ofp, ®->cranges, base + 0.5);
738 void __output_dev(struct d_info *dip, void *arg)
741 struct __od *odp = arg;
743 sprintf(header, "%d,%d", MAJOR(dip->device), MINOR(dip->device));
744 if (output_regions(odp->ofp, header, &dip->regions, odp->base))
748 float output_devs(FILE *ofp, float base)
750 struct __od od = { .ofp = ofp, .base = base };
752 fprintf(ofp, "# Per device\n" );
753 dip_foreach_out(__output_dev, &od);
757 static inline int exe_match(char *exe, char *name)
759 return (exe == NULL) || (strstr(name, exe) != NULL);
766 void __output_procs(struct p_info *pip, void *arg)
768 struct __op *opp = arg;
769 output_regions(opp->ofp, pip->name, &pip->regions, opp->base);
773 float output_procs(FILE *ofp, float base)
775 struct __op op = { .ofp = ofp, .base = base };
777 fprintf(ofp, "# Per process\n" );
778 pip_foreach_out(__output_procs, &op);
782 int output_ranges(FILE *ofp)
786 fprintf(ofp, "# %s\n", "Total System");
787 if (output_regions(ofp, "Total System", &all_regions, base))
791 base = output_devs(ofp, base);
793 base = output_procs(ofp, base);