From: Sebastien Godard Date: Sat, 28 May 2011 14:01:41 +0000 (+0200) Subject: sadf updated for USB devices statistics. X-Git-Tag: v10.0.1~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=627f6b2db08300d2b424b40e6f5a40688843748d;p=sysstat sadf updated for USB devices statistics. XML and DTD files updated and cleaned. --- diff --git a/CHANGES b/CHANGES index e2500d1..623562a 100644 --- a/CHANGES +++ b/CHANGES @@ -15,7 +15,10 @@ xxxx/xx/xx: Version 10.0.1 - Sebastien Godard (sysstat orange.fr) "Posix Open" column in /proc/fs/cifs/Stats file. This is now fixed. * [Ivana Varekova]: Close file descriptor in read_uptime() - function (file rd_stats.c). + function (rd_stats.c file). + * Fixed XML output displayed by sadf (hugepages statistics were + included in power management ones). + * DTD and XSD documents updated and cleaned. * NLS updated. Esperanto translation added. 2011/03/15: Version 10.0.0 - Sebastien Godard (sysstat orange.fr) diff --git a/activity.c b/activity.c index d467a54..c559c28 100644 --- a/activity.c +++ b/activity.c @@ -1100,7 +1100,7 @@ struct activity huge_act = { /* CPU weighted frequency */ struct activity pwr_wghfreq_act = { .id = A_PWR_WGHFREQ, - .options = AO_CLOSE_MARKUP, + .options = AO_NULL, .magic = ACTIVITY_MAGIC_BASE, .group = G_POWER, #ifdef SOURCE_SADC @@ -1130,7 +1130,7 @@ struct activity pwr_wghfreq_act = { /* USB devices plugged into the system */ struct activity pwr_usb_act = { .id = A_PWR_USB, - .options = AO_NULL, + .options = AO_CLOSE_MARKUP, .magic = ACTIVITY_MAGIC_BASE, .group = G_POWER, #ifdef SOURCE_SADC diff --git a/rndr_stats.c b/rndr_stats.c index dd79ae9..293bf62 100644 --- a/rndr_stats.c +++ b/rndr_stats.c @@ -2678,7 +2678,58 @@ __print_funct_t render_pwr_wghfreq_stats(struct activity *a, int isdb, char *pre __print_funct_t render_pwr_usb_stats(struct activity *a, int isdb, char *pre, int curr, unsigned long long itv) { -/* -FIXME -*/ + int i; + struct stats_pwr_usb *suc; + char id[9]; + + for (i = 0; i < a->nr; i++) { + suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize); + + if (!suc->bus_nr) + /* Bus#0 doesn't exist: We are at the end of the list */ + break; + + sprintf(id, "%x", suc->vendor_id); + render(isdb, pre, PT_USESTR, + "bus%d\tidvendor", + "%d", + cons(iv, suc->bus_nr, NOVAL), + NOVAL, + NOVAL, + id); + + sprintf(id, "%x", suc->product_id); + render(isdb, pre, PT_USESTR, + "bus%d\tidprod", + NULL, + cons(iv, suc->bus_nr, NOVAL), + NOVAL, + NOVAL, + id); + + render(isdb, pre, PT_USEINT, + "bus%d\tmaxpower", + NULL, + cons(iv, suc->bus_nr, NOVAL), + suc->bmaxpower << 1, + NOVAL, + NULL); + + render(isdb, pre, PT_USESTR, + "bus%d\tmanufact", + NULL, + cons(iv, suc->bus_nr, NOVAL), + NOVAL, + NOVAL, + suc->manufacturer); + + render(isdb, pre, + (DISPLAY_HORIZONTALLY(flags) ? PT_USESTR : PT_USESTR | PT_NEWLIN), + "bus%d\tproduct", + NULL, + cons(iv, suc->bus_nr, NOVAL), + NOVAL, + NOVAL, + suc->product); + } } diff --git a/sadf.h b/sadf.h index e51bc5b..bbba62e 100644 --- a/sadf.h +++ b/sadf.h @@ -14,6 +14,6 @@ #define S_O_DBD_OPTION 5 /* DTD version for XML output */ -#define XML_DTD_VERSION "2.10" +#define XML_DTD_VERSION "2.11" #endif /* _SADF_H */ diff --git a/xml/sysstat.dtd b/xml/sysstat.dtd index db1e44c..7779828 100644 --- a/xml/sysstat.dtd +++ b/xml/sysstat.dtd @@ -1,24 +1,53 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + - + + + - - - - + - - - - - - - + + + - + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + - + - - + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - + - - + - - + - - + + + - - + - - - + - - - - - - - - - - - - - - - - + - - - + - - + - + + + + + + + - - - - + + + + + + + + + + + + + + + + diff --git a/xml/sysstat.xsd b/xml/sysstat.xsd index 9d5c3c9..6cf3624 100644 --- a/xml/sysstat.xsd +++ b/xml/sysstat.xsd @@ -1,179 +1,427 @@ --- XML Schema v2.10 for sysstat. See sadf.h -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + -- XML Schema v2.11 for sysstat. See sadf.h -- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -182,26 +430,10 @@ - - - - - - - - - - - - - - - - - - - - + + + + @@ -210,27 +442,10 @@ - - - - - - - - - - - - - - - - - - - - - + + + + @@ -245,33 +460,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -284,493 +476,240 @@ - - - - - - - - - - - - - - - - - - - - - + + + + - + - - - + + - - - + - + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + - + + + + + - - - - - - + + + + + - - - - - + + + + + + + + + + + + + + + - + + + + + - - - + + + + - + - - - - - + + + + + + + - + + + + + - - - + + + + - + + + + + + + + + - + - + - - - - - - - - - - - - - - - + + + + + + + - + + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xml_stats.c b/xml_stats.c index ac108f5..4d109a0 100644 --- a/xml_stats.c +++ b/xml_stats.c @@ -1972,5 +1972,39 @@ close_xml_markup: __print_funct_t xml_print_pwr_usb_stats(struct activity *a, int curr, int tab, unsigned long long itv) { - /* FIXME */ + int i; + struct stats_pwr_usb *suc; + + if (!IS_SELECTED(a->options) || (a->nr <= 0)) + goto close_xml_markup; + + xml_markup_power_management(tab, OPEN_XML_MARKUP); + tab++; + + xprintf(tab++, ""); + + for (i = 0; i < a->nr; i++) { + suc = (struct stats_pwr_usb *) ((char *) a->buf[curr] + i * a->msize); + + if (!suc->bus_nr) + /* Bus#0 doesn't exist: We are at the end of the list */ + break; + + xprintf(tab, "", + suc->bus_nr, + suc->vendor_id, + suc->product_id, + suc->bmaxpower << 1, + suc->manufacturer, + suc->product); + } + + xprintf(--tab, ""); + tab--; + +close_xml_markup: + if (CLOSE_MARKUP(a->options)) { + xml_markup_power_management(tab, CLOSE_XML_MARKUP); + } } \ No newline at end of file