int pipe;
};
-static char blkiomon_version[] = "0.2";
+static char blkiomon_version[] = "0.3";
static FILE *ifp;
static int interval = -1;
return NULL;
}
- memset(dstat, 0, sizeof(*dstat));
+ blkiomon_stat_init(&dstat->msg.stat);
return dstat;
}
static struct dstat *blkiomon_get_dstat(__u32 device)
{
struct dstat *dstat;
- struct rb_search search;
+ struct rb_search search = { 0, };
pthread_mutex_lock(&dstat_mutex);
goto out;
dstat->msg.stat.device = device;
- dstat->msg.stat.size_r.min = -1ULL;
- dstat->msg.stat.size_w.min = -1ULL;
- dstat->msg.stat.d2c_r.min = -1ULL;
- dstat->msg.stat.d2c_w.min = -1ULL;
rb_link_node(&dstat->node, search.parent, search.node_ptr);
rb_insert_color(&dstat->node, &dstat_tree[dstat_curr]);
struct blkiomon_stat *p;
__u64 d2c = (bit_c->time - bit_d->time) / 1000; /* ns -> us */
__u32 size = bit_d->bytes;
+ __u64 thrput = size * 1000 / d2c;
dstat = blkiomon_get_dstat(bit_d->device);
if (!dstat)
p = &dstat->msg.stat;
if (BLK_DATADIR(bit_c->action) & BLK_TC_READ) {
+ minmax_account(&p->thrput_r, thrput);
minmax_account(&p->size_r, size);
minmax_account(&p->d2c_r, d2c);
} else if (BLK_DATADIR(bit_c->action) & BLK_TC_WRITE) {
+ minmax_account(&p->thrput_w, thrput);
minmax_account(&p->size_w, size);
minmax_account(&p->d2c_w, d2c);
} else
"-I <interval> | --interval=<interval>\n" \
"[ -h <file> | --human-readable=<file> ]\n" \
"[ -b <file> | --binary=<file> ]\n" \
+ "[ -d <file> | --dump-lldd=<file> ]\n" \
"[ -D <file> | --debug=<file> ]\n" \
- "[ -Q <path name> | --msg-queue-name=<path name>]\n" \
+ "[ -Q <path name> | --msg-queue=<path name>]\n" \
"[ -q <msg queue id> | --msg-queue-id=<msg queue id>]\n" \
"[ -m <msg id> | --msg-id=<msg id>]\n" \
"[ -V | --version ]\n\n" \