Esempio n. 1
0
void __output_dip_avg(struct d_info *dip, void *arg)
{
	struct __oda *odap = arg;
	ai_dip_t ap = odap->func(dip);
	if (ap->n > 0) {
		char dev_info[15];
		ap->avg = BIT_TIME(ap->total) / (double)ap->n;
		__output_avg(odap->ofp, make_dev_hdr(dev_info, 15, dip, 1),
				ap, 0);
	}
}
Esempio n. 2
0
void __output_q2d_histo(struct d_info *dip, void *arg)
{
	struct __q2d *q2dp = arg;

	if (q2d_ok(dip->q2d_priv)) {
		char dev_info[15];
		FILE *ofp = q2dp->ofp;

		fprintf(q2dp->ofp, "%10s | ",
					make_dev_hdr(dev_info, 15, dip, 1));
		q2d_display(ofp, dip->q2d_priv);
		q2d_acc(q2dp->q2d_all, dip->q2d_priv);
		q2dp->n++;
	}
}
Esempio n. 3
0
static void trace_message(struct io *iop)
{
	char scratch[15];
	char msg[iop->t.pdu_len + 1];

	if (!io_setup(iop, IOP_M))
		return;

	memcpy(msg, iop->pdu, iop->t.pdu_len);
	msg[iop->t.pdu_len] = '\0';

	fprintf(msgs_ofp, "%s %5d.%09lu %s\n",
		make_dev_hdr(scratch, 15, iop->dip, 1),
		(int)SECONDS(iop->t.time),
		(unsigned long)NANO_SECONDS(iop->t.time), msg);
}
Esempio n. 4
0
void __output_dip_prep_ohead(struct d_info *dip, void *arg)
{
	if (dip->avgs.q2c.n > 0 && dip->avgs.q2c.total > 0) {
		char dev_info[15];
		struct ohead_data *odp = arg;
		double q2c_total = (double)(dip->avgs.q2c.total);

		fprintf(odp->ofp,
			"%10s | %8.4lf%% %8.4lf%% %8.4lf%% %8.4lf%% %8.4lf%%\n",
			make_dev_hdr(dev_info, 15, dip, 1),
			100.0 * (double)(dip->avgs.q2g.total) / q2c_total,
			100.0 * (double)(dip->avgs.g2i.total) / q2c_total,
			100.0 * (double)(dip->avgs.q2m.total) / q2c_total,
			100.0 * (double)(dip->avgs.i2d.total) / q2c_total,
			100.0 * (double)(dip->avgs.d2c.total) / q2c_total);

		__update_odp(odp, dip, q2g);
		__update_odp(odp, dip, g2i);
		__update_odp(odp, dip, q2m);
		__update_odp(odp, dip, i2d);
		__update_odp(odp, dip, d2c);
		__update_odp(odp, dip, q2c);
	}
}
Esempio n. 5
0
void output_q2d_histo(FILE *ofp)
{
	struct __q2d __q2d = {
		.ofp = ofp,
		.q2d_all = q2d_alloc(),
		.n = 0
	};

	fprintf(ofp, "%10s | ", "DEV");
	q2d_display_header(ofp);
	fprintf(ofp, "--------- | ");
	q2d_display_dashes(ofp);
	dip_foreach_out(__output_q2d_histo, &__q2d);

	if (__q2d.n) {
		fprintf(ofp, "========== | ");
		q2d_display_dashes(ofp);
		fprintf(ofp, "%10s | ", "AVG");
		q2d_display(ofp, __q2d.q2d_all);
		fprintf(ofp, "\n");
	}

	q2d_free(__q2d.q2d_all);
}

int n_merges = 0;
struct {
	unsigned long long nq, nd, blkmin, blkmax, total;
} merge_data;
void __output_dip_merge_ratio(struct d_info *dip, void *arg)
{
	double blks_avg;
	char dev_info[15];
	double ratio, q2c_n, d2c_n;

	if (dip->n_qs == 0 || dip->n_ds == 0)
		return;
	else if (dip->n_qs < dip->n_ds)
		dip->n_qs = dip->n_ds;

	q2c_n = dip->n_qs;
	d2c_n = dip->n_ds;
	if (q2c_n > 0.0 && d2c_n > 0.0) {
		if (q2c_n < d2c_n)
			ratio = 1.0;
		else
			ratio = q2c_n / d2c_n;
		blks_avg = (double)dip->avgs.blks.total / d2c_n;
		fprintf((FILE *)arg,
			"%10s | %8llu %8llu %7.1lf | %8llu %8llu %8llu %8llu\n",
			make_dev_hdr(dev_info, 15, dip, 1),
			(unsigned long long)dip->n_qs,
			(unsigned long long)dip->n_ds,
			ratio,
			(unsigned long long)dip->avgs.blks.min,
			(unsigned long long)blks_avg,
			(unsigned long long)dip->avgs.blks.max,
			(unsigned long long)dip->avgs.blks.total);

		if (easy_parse_avgs) {
			fprintf(xavgs_ofp,
				"DMI %s %llu %llu %.9lf %llu %llu %llu %llu\n",
				make_dev_hdr(dev_info, 15, dip, 0),
				(unsigned long long)dip->n_qs,
				(unsigned long long)dip->n_ds,
				ratio,
				(unsigned long long)dip->avgs.blks.min,
				(unsigned long long)blks_avg,
				(unsigned long long)dip->avgs.blks.max,
				(unsigned long long)dip->avgs.blks.total);
		}

		if (n_merges++ == 0) {
			merge_data.blkmin = dip->avgs.blks.min;
			merge_data.blkmax = dip->avgs.blks.max;
		}

		merge_data.nq += dip->n_qs;
		merge_data.nd += dip->n_ds;
		merge_data.total += dip->avgs.blks.total;
		if (dip->avgs.blks.min < merge_data.blkmin)
			merge_data.blkmin = dip->avgs.blks.min;
		if (dip->avgs.blks.max > merge_data.blkmax)
			merge_data.blkmax = dip->avgs.blks.max;
	}
}