[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4 of 4 RFC] blktap3/sring: stats for the shared ring between tapdisk and the front-end
This patch introduces stats for the shared ring between tapdisk and the front-end. I suspect that the stats regarding the ring between tapdisk and blktap don't make sense any more, so the stats introduced by this patch could be consolidated into the existing ones. Signed-off-by: Thanos Makatos <thanos.makatos@xxxxxxxxxx> diff -r 8e86ca826085 -r 587c35050d21 tools/blktap3/drivers/sring/td-stats.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/blktap3/drivers/sring/td-stats.c Tue Mar 12 12:56:02 2013 +0000 @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2012 Citrix Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ + +#include "td-stats.h" +#include "td-blkif.h" +#include "td-ctx.h" + +static inline void +__tapdisk_xenblkif_stats(struct td_xenblkif * blkif, td_stats_t * st) +{ + tapdisk_stats_field(st, "pool", blkif->ctx->pool); + tapdisk_stats_field(st, "domid", "d", blkif->domid); + tapdisk_stats_field(st, "devid", "d", blkif->devid); + + tapdisk_stats_field(st, "reqs", "["); + tapdisk_stats_val(st, "llu", blkif->stats.reqs.in); + tapdisk_stats_val(st, "llu", blkif->stats.reqs.out); + tapdisk_stats_leave(st, ']'); + + tapdisk_stats_field(st, "kicks", "["); + tapdisk_stats_val(st, "llu", blkif->stats.kicks.in); + tapdisk_stats_val(st, "llu", blkif->stats.kicks.out); + tapdisk_stats_leave(st, ']'); + + tapdisk_stats_field(st, "errors", "{"); + tapdisk_stats_field(st, "msg", "llu", blkif->stats.errors.msg); + tapdisk_stats_field(st, "map", "llu", blkif->stats.errors.map); + tapdisk_stats_field(st, "vbq", "llu", blkif->stats.errors.vbd); + tapdisk_stats_field(st, "img", "llu", blkif->stats.errors.img); + tapdisk_stats_leave(st, ']'); +} + +void +tapdisk_xenblkif_stats(td_vbd_t * vbd, td_stats_t * st) +{ + struct td_xenblkif *blkif; + struct td_xenio_ctx *ctx; + int matches; + + tapdisk_xenio_for_each_ctx(ctx) { + tapdisk_xenio_for_each_blkif(blkif, ctx) { + if (blkif->vbd == vbd) { + matches = 1; + break; + } + } + } + if (!matches) + return; + + tapdisk_stats_field(st, "xen-blkifs", "["); + + tapdisk_xenio_for_each_ctx(ctx) { + tapdisk_xenio_for_each_blkif(blkif, ctx) { + if (blkif->vbd != vbd) + continue; + + tapdisk_stats_enter(st, '{'); + __tapdisk_xenblkif_stats(blkif, st); + tapdisk_stats_leave(st, '}'); + } + } + + tapdisk_stats_leave(st, ']'); +} diff -r 8e86ca826085 -r 587c35050d21 tools/blktap3/drivers/sring/td-stats.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/blktap3/drivers/sring/td-stats.h Tue Mar 12 12:56:02 2013 +0000 @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 Citrix Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + */ + +#ifndef __TD_STATS_H__ +#define __TD_STATS_H__ + +struct td_xenblkif_stats { + struct { + unsigned long long in; + unsigned long long out; + } reqs; + struct { + unsigned long long in; + unsigned long long out; + } kicks; + struct { + unsigned long long msg; + unsigned long long map; + unsigned long long vbd; + unsigned long long img; + } errors; +}; +#endif /* __TD_STATS_H__ */ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |