]> granicus.if.org Git - sysstat/commitdiff
Added reporting of FC stats in XML format.
authorSteve Kay <stevekay@gmail.com>
Tue, 7 Apr 2015 21:13:55 +0000 (14:13 -0700)
committerSteve Kay <stevekay@gmail.com>
Tue, 7 Apr 2015 21:13:55 +0000 (14:13 -0700)
xml_stats.c
xml_stats.h

index 3ab461c4c53fe5df1760989046f000bab06c8572..d73b909c7534d988a25028db5985c171950ec8cc 100644 (file)
@@ -2058,3 +2058,43 @@ __print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab
 
        xprintf(--tab, "</filesystems>");
 }
+
+/*
+ ***************************************************************************
+ * Display Fibre Channel HBA statistics in XML.
+ *
+ * IN:
+ * @a          Activity structure with statistics.
+ * @curr       Index in array for current sample statistics.
+ * @tab                Indentation in XML output.
+ * @itv                Interval of time in jiffies.
+ ***************************************************************************
+ */
+__print_funct_t xml_print_fc_stats(struct activity *a, int curr, int tab,
+                                          unsigned long long itv)
+{
+       int i;
+       struct stats_fc *sfcc, *sfcp;
+
+       xprintf(tab, "<fc>");
+       tab++;
+
+       for (i = 0; i < a->nr; i++) {
+
+               sfcc = (struct stats_fc *) ((char *) a->buf[curr] + i * a->msize);
+               sfcp = (struct stats_fc *) ((char *) a->buf[!curr] + i * a->msize);
+
+               xprintf(tab, "<hba name=\"%s\" "
+                       "rxframes=\"%.2f\" "
+                       "txframes=\"%.2f\" "
+                       "rxwords=\"%.2f\" "
+                       "txwords=\"%.2f\"/>",
+                       sfcc->hba_name,
+                       S_VALUE(sfcp->f_rxframes, sfcc->f_rxframes, itv),
+                       S_VALUE(sfcp->f_txframes, sfcc->f_txframes, itv),
+                       S_VALUE(sfcp->f_rxwords,  sfcc->f_rxwords,  itv),
+                       S_VALUE(sfcp->f_txwords,  sfcc->f_rxwords,  itv));
+       }
+
+       xprintf(--tab, "</fc>");
+}
index 05266b324de642052c66e3a8499c05389dc241a7..715ae6536a5f780591c95f532dbb987e28933184 100644 (file)
@@ -89,5 +89,7 @@ extern __print_funct_t xml_print_pwr_usb_stats
        (struct activity *, int, int, unsigned long long);
 extern __print_funct_t xml_print_filesystem_stats
        (struct activity *, int, int, unsigned long long);
+extern __print_funct_t xml_print_fc_stats
+       (struct activity *, int, int, unsigned long long);
 
 #endif /* _XML_STATS_H */