Skip to contentSkip to conversation

tools/xentop: Display '-' when stats are not available.

PATCH In review Ronan Abhamon 2 participants 2 messages Feb 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/xentop: Display '-' when stats are not available.

From: Pritha Srivastava <[email protected]>

Displaying 0 is misleading.

---
 tools/xenstat/libxenstat/src/xenstat.c       |   6 +
 tools/xenstat/libxenstat/src/xenstat.h       |   5 +
 tools/xenstat/libxenstat/src/xenstat_linux.c |  47 +++---
 tools/xenstat/libxenstat/src/xenstat_priv.h  |   1 +
 tools/xenstat/xentop/xentop.c                | 161 ++++++++++++++-----
 5 files changed, 158 insertions(+), 62 deletions(-)
tools/xenstat/libxenstat/src/xenstat.c +6 -0
index fbe44f3c56..8b856b32a3 100644
@@ -729,6 +729,12 @@ unsigned long long xenstat_vbd_wr_sects(xenstat_vbd * vbd)
 	return vbd->wr_sects;
 }
 
+/* Returns error while getting stats (1 if error happened, 0 otherwise) */
+bool xenstat_vbd_error(xenstat_vbd * vbd)
+{
+	return vbd->error;
+}
+
 /*
  * Tmem functions
  */
tools/xenstat/libxenstat/src/xenstat.h +5 -0
index 47ec60e14d..9f5053dd92 100644
@@ -20,6 +20,8 @@
 #ifndef XENSTAT_H
 #define XENSTAT_H
 
+#include <stdbool.h>
+
 /* Opaque handles */
 typedef struct xenstat_handle xenstat_handle;
 typedef struct xenstat_domain xenstat_domain;
@@ -193,6 +195,9 @@ unsigned long long xenstat_vbd_wr_reqs(xenstat_vbd * vbd);
 unsigned long long xenstat_vbd_rd_sects(xenstat_vbd * vbd);
 unsigned long long xenstat_vbd_wr_sects(xenstat_vbd * vbd);
 
+/* Returns error while getting stats (1 if error happened, 0 otherwise) */
+bool xenstat_vbd_error(xenstat_vbd * vbd);
+
 /*
  * Tmem functions - extract tmem information
  */
tools/xenstat/libxenstat/src/xenstat_linux.c +21 -26

70 lines not on this page · raw message

tools/xenstat/libxenstat/src/xenstat_priv.h +1 -0
index 74e0774a5e..ebfcd0fff6 100644
@@ -98,6 +98,7 @@ struct xenstat_network {
 struct xenstat_vbd {
 	unsigned int back_type;
 	unsigned int dev;
+	unsigned int error;
 	unsigned long long oo_reqs;
 	unsigned long long rd_reqs;
 	unsigned long long wr_reqs;
tools/xenstat/xentop/xentop.c +125 -36

278 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel