[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5 of 6 v2] 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>

---
Changed since v1:
  * Simplify sring stats procuring since the VBD now points to the internal
    sring structure.
  * Introduce declaration of function tapdisk_xenblkif_stats.

diff --git a/tools/blktap3/drivers/sring/td-stats.c 
b/tools/blktap3/drivers/sring/td-stats.c
new file mode 100644
--- /dev/null
+++ b/tools/blktap3/drivers/sring/td-stats.c
@@ -0,0 +1,60 @@
+/*
+ * 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-ctx.h"
+
+static inline void
+__tapdisk_xenblkif_stats(struct td_xenblkif * blkif, td_stats_t * st)
+{
+    assert(blkif);
+    assert(st);
+    assert(blkif->ctx);
+
+    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(struct td_xenblkif * blkif, td_stats_t * st)
+{
+    tapdisk_stats_field(st, "xen-blkifs", "[");
+    tapdisk_stats_enter(st, '{');
+    __tapdisk_xenblkif_stats(blkif, st);
+    tapdisk_stats_leave(st, '}');
+    tapdisk_stats_leave(st, ']');
+}
diff --git a/tools/blktap3/drivers/sring/td-stats.h 
b/tools/blktap3/drivers/sring/td-stats.h
new file mode 100644
--- /dev/null
+++ b/tools/blktap3/drivers/sring/td-stats.h
@@ -0,0 +1,46 @@
+/*
+ * 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;
+};
+
+#include "td-blkif.h"
+struct td_xenblkif;
+
+void
+tapdisk_xenblkif_stats(struct td_xenblkif * blkif, td_stats_t * st);
+
+#endif /* __TD_STATS_H__ */

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.