]> granicus.if.org Git - sysstat/commitdiff
DTD and XSD documents updated.
authorSebastien Godard <sysstat@orange.fr>
Sat, 13 Aug 2011 12:44:43 +0000 (14:44 +0200)
committerSebastien Godard <sysstat@orange.fr>
Sat, 13 Aug 2011 13:01:26 +0000 (15:01 +0200)
A new mark ("utc") has been added in the XML output
generated by sadf -x. This mark has a value of 0 or 1 depending
on whether the timestamp is expressed in local time or UTC.
A correction has also been made in the XSD document, where the
description of "comment" messages was erroneous.

CHANGES
sadf.c
sadf.h
sadf_misc.c
xml/sysstat.dtd
xml/sysstat.xsd

diff --git a/CHANGES b/CHANGES
index 5d78354e429a4d833addc02886aabf1d9b285623..c864adb65ad0396357c14559a00b8540d46e8e26 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,7 @@ xxxx/xx/xx: Version 10.0.2 - Sebastien Godard (sysstat <at> orange.fr)
          Its design is still not generic anyway.
        * [Jeroen Roovers]: Automate translation files handling in
          Makefile.in.
+       * DTD and XSD documents updated.
        * Various cosmetic changes (sar.c, sadf.c).
        * CREDITS file updated.
 
diff --git a/sadf.c b/sadf.c
index 36e1460087af8ceefa8e758c6a56b4e43e8552d0..348dfa3c2a18a632d8bc9fd1db9fbdfb39df57b9 100644 (file)
--- a/sadf.c
+++ b/sadf.c
@@ -275,7 +275,7 @@ void prtab(int nr_tab)
 
 /*
  ***************************************************************************
- * printf() function modified for XML display
+ * printf() function modified for textual (XML-like) display.
  *
  * IN:
  * @nr_tab     Number of tabs to print.
@@ -317,8 +317,8 @@ void xprintf(int nr_tab, const char *fmtf, ...)
  *                     been saved.
  ***************************************************************************
  */
-void write_xml_restarts(int curr, int use_tm_start, int use_tm_end, int tab,   /* FIXME: revoir nom proc */
-                       struct tm *rectime, struct tm *loctime)
+void write_textual_restarts(int curr, int use_tm_start, int use_tm_end, int tab,
+                           struct tm *rectime, struct tm *loctime)
 {
        char cur_date[32], cur_time[32];
 
@@ -340,7 +340,7 @@ void write_xml_restarts(int curr, int use_tm_start, int use_tm_end, int tab,        /*
 
 /*
  ***************************************************************************
- * Display XML COMMENT records for textual (XML-like) reports.
+ * Display COMMENT records for textual (XML-like) reports.
  *
  * IN:
  * @curr               Index in array for current sample statistics.
@@ -361,8 +361,8 @@ void write_xml_restarts(int curr, int use_tm_start, int use_tm_end, int tab,        /*
  *                     been saved.
  ***************************************************************************
  */
-void write_xml_comments(int curr, int use_tm_start, int use_tm_end, int tab, int ifd,  /* FIXME: revoir nom proc */
-                       struct tm *rectime, struct tm *loctime)
+void write_textual_comments(int curr, int use_tm_start, int use_tm_end, int tab, int ifd,
+                           struct tm *rectime, struct tm *loctime)
 {
        char cur_date[32], cur_time[32];
        char file_comment[MAX_COMMENT_LEN];
@@ -612,9 +612,9 @@ int write_parsable_stats(int curr, int reset, long *cnt, int use_tm_start,
  * 1 if stats have been successfully displayed.
  ***************************************************************************
  */
-int write_xml_stats(int curr, int use_tm_start, int use_tm_end, int reset,
-                   long *cnt, int tab, __nr_t cpu_nr, struct tm *rectime,
-                   struct tm *loctime)
+int write_textual_stats(int curr, int use_tm_start, int use_tm_end, int reset,
+                       long *cnt, int tab, __nr_t cpu_nr, struct tm *rectime,
+                       struct tm *loctime)
 {
        int i;
        unsigned long long dt, itv, g_itv;
@@ -683,11 +683,10 @@ int write_xml_stats(int curr, int use_tm_start, int use_tm_end, int reset,
        }
        tab++;
 
-       /* Display XML statistics */
+       /* Display textual statistics */
        for (i = 0; i < NR_ACT; i++) {
 
-               /* FIXME: PB: le nom de la fonction a appeler va dependre du format d'affichage choisi (ex.: f_xml_print si on est en XML) */
-               
+               /* This code is not generic at all...! */
                if (CLOSE_MARKUP(act[i]->options) ||
                    (IS_SELECTED(act[i]->options) && (act[i]->nr > 0))) {
                        (*act[i]->f_xml_print)(act[i], curr, tab,
@@ -874,9 +873,9 @@ void rw_curr_act_stats(int ifd, off_t fpos, int *curr, long *cnt, int *eosaf,
  *             saved for current record.
  ***************************************************************************
  */
-void xml_display_loop(int ifd, struct file_activity *file_actlst, char *dfile,
-                     struct file_magic *file_magic, __nr_t cpu_nr,
-                     struct tm *rectime, struct tm *loctime)
+void textual_display_loop(int ifd, struct file_activity *file_actlst, char *dfile,
+                         struct file_magic *file_magic, __nr_t cpu_nr,
+                         struct tm *rectime, struct tm *loctime)
 {
        int curr, tab = 0, rtype;
        int eosaf = TRUE, next, reset = FALSE;
@@ -953,8 +952,8 @@ void xml_display_loop(int ifd, struct file_activity *file_actlst, char *dfile,
                                                             file_actlst);
 
                                        /* next is set to 1 when we were close enough to desired interval */
-                                       next = write_xml_stats(curr, tm_start.use, tm_end.use, reset,
-                                                              &cnt, tab, cpu_nr, rectime, loctime);
+                                       next = write_textual_stats(curr, tm_start.use, tm_end.use, reset,
+                                                                  &cnt, tab, cpu_nr, rectime, loctime);
 
                                        if (next) {
                                                curr ^= 1;
@@ -1024,8 +1023,8 @@ void xml_display_loop(int ifd, struct file_activity *file_actlst, char *dfile,
                                                     file_actlst);
                        }
                        if (rtype == R_RESTART) {
-                               write_xml_restarts(0, tm_start.use, tm_end.use, tab,
-                                                  rectime, loctime);
+                               write_textual_restarts(0, tm_start.use, tm_end.use, tab,
+                                                      rectime, loctime);
                        }
                        else if (rtype == R_COMMENT) {
                                /* Ignore COMMENT record */
@@ -1063,8 +1062,8 @@ void xml_display_loop(int ifd, struct file_activity *file_actlst, char *dfile,
                                                             file_actlst);
                                }
                                if (rtype == R_COMMENT) {
-                                       write_xml_comments(0, tm_start.use, tm_end.use,
-                                                          tab, ifd, rectime, loctime);
+                                       write_textual_comments(0, tm_start.use, tm_end.use,
+                                                              tab, ifd, rectime, loctime);
                                }
                        }
                }
@@ -1264,12 +1263,11 @@ void read_stats_from_file(char dfile[])
 
        if (DISPLAY_GROUPED_STATS(fmt[f_position]->options)) {
                main_display_loop(ifd, file_actlst, cpu_nr,
-                                 &rectime, &loctime);                  /* FIXME: revoir nom */
+                                 &rectime, &loctime);
        }
        else {
-               xml_display_loop(ifd, file_actlst,
-                                dfile, &file_magic, cpu_nr,
-                                &rectime, &loctime);                   /* FIXME: revoir nom */
+               textual_display_loop(ifd, file_actlst, dfile,
+                                    &file_magic, cpu_nr, &rectime, &loctime);
        }
 
        close(ifd);
diff --git a/sadf.h b/sadf.h
index 87d4dee222921e1119f9d23bfd659af73c662f8a..660d73952484721a91d0c825604378c473f5f3ce 100644 (file)
--- a/sadf.h
+++ b/sadf.h
@@ -8,6 +8,9 @@
 
 #include "sa.h"
 
+/* DTD version for XML output */
+#define XML_DTD_VERSION        "2.12"
+
 /* Possible actions for functions used to display reports */
 #define F_BEGIN        0x01
 #define F_MAIN 0x02
@@ -167,9 +170,6 @@ struct report_format {
        __printf_funct_t (*f_comment) (int *, int, char *, char *, int, char *, struct file_header *);
 };
 
-/* DTD version for XML output */
-#define XML_DTD_VERSION        "2.11"
-
 /*
  ***************************************************************************
  * Various function prototypes
index 708b2dbe12fe05e0017678daf814794d9628d504..fe5f1fdc9584fa62921fae63fd972fc23ae0a345 100644 (file)
@@ -129,7 +129,7 @@ __printf_funct_t print_xml_restart(int *tab, int action, char *cur_date,
        }
        if (action & F_MAIN) {
                xprintf(*tab, "<boot date=\"%s\" time=\"%s\" utc=\"%d\"/>",
-                       cur_date, cur_time, utc ? 1 : 0);               /* FIXME: Nouvelle balise a prevoir dans DTD/XSD */
+                       cur_date, cur_time, utc ? 1 : 0);
        }
        if (action & F_END) {
                xprintf(--(*tab), "</restarts>");
@@ -238,7 +238,7 @@ __printf_funct_t print_xml_comment(int *tab, int action, char *cur_date,
                xprintf((*tab)++, "<comments>");
        }
        if (action & F_MAIN) {
-               xprintf(*tab, "<comment date=\"%s\" time=\"%s\" utc=\"%d\" com=\"%s\"/>",       /* FIXME: modification du DTD/XSD */
+               xprintf(*tab, "<comment date=\"%s\" time=\"%s\" utc=\"%d\" com=\"%s\"/>",
                        cur_date, cur_time, utc ? 1 : 0, comment);
        }
        if (action & F_END) {
@@ -288,7 +288,7 @@ __printf_funct_t print_xml_timestamp(int *tab, int action, char *cur_date,
                                     char *cur_time, int utc, unsigned long long itv)
 {
        if (action & F_BEGIN) {
-               xprintf(*tab, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\"/>",      /* FIXME: modification du DTD/XSD */
+               xprintf(*tab, "<timestamp date=\"%s\" time=\"%s\" utc=\"%d\" interval=\"%llu\"/>",
                        cur_date, cur_time, utc ? 1 : 0, itv);
        }
        if (action & F_END) {
index 77798288dc1558efe89a40ebec336a9586f4d5a9..dc96ff7fd248e25af140b551417193437dcbafd3 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--DTD v2.11 for sysstat. See sadf.h -->
+<!--DTD v2.12 for sysstat. See sadf.h -->
 
 <!ELEMENT sysstat (sysdata-version, host)>
 
@@ -26,6 +26,7 @@
 <!ATTLIST timestamp
        date CDATA #REQUIRED
        time CDATA #REQUIRED
+       utc CDATA #REQUIRED
        interval CDATA #REQUIRED
 >
 
@@ -35,6 +36,7 @@
 <!ATTLIST boot
        date CDATA #REQUIRED
        time CDATA #REQUIRED
+       utc CDATA #REQUIRED
 >
 
 <!ELEMENT comments (comment+)>
@@ -43,6 +45,7 @@
 <!ATTLIST comment
        date CDATA #REQUIRED
        time CDATA #REQUIRED
+       utc CDATA #REQUIRED
        com CDATA #REQUIRED
 >
 
index 6cf36241e078bb94e05f8debaf2d103f88ccae4c..990c03acf3d28023fe749d72c4ad14ad43ea6dd0 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://pagesperso-orange.fr/sebastien.godard/sysstat" targetNamespace="http://pagesperso-orange.fr/sebastien.godard/sysstat" elementFormDefault="qualified">
 <xs:annotation>
-       <xs:appinfo>-- XML Schema v2.11 for sysstat. See sadf.h --</xs:appinfo>
+       <xs:appinfo>-- XML Schema v2.12 for sysstat. See sadf.h --</xs:appinfo>
 </xs:annotation>
 
 <xs:element name="sysstat" type="sysstat-type"></xs:element>
@@ -74,9 +74,9 @@
 
 <xs:element name="comments" type="comments-type"></xs:element>
 <xs:complexType name="comments-type">
-       <xs:attribute name="date" type="xs:date"></xs:attribute>
-       <xs:attribute name="time" type="xs:time"></xs:attribute>
-       <xs:attribute name="comment" type="xs:string"></xs:attribute>
+       <xs:sequence>
+               <xs:element name="comment" type="comment-type"></xs:element>
+       </xs:sequence>
 </xs:complexType>
 
 <xs:element name="timestamp" type="timestamp-type"></xs:element>
        </xs:sequence>
        <xs:attribute name="date" type="xs:date"></xs:attribute>
        <xs:attribute name="time" type="xs:time"></xs:attribute>
+       <xs:attribute name="utc" type="xs:nonNegativeInteger"></xs:attribute>
        <xs:attribute name="interval" type="xs:nonNegativeInteger"></xs:attribute>
 </xs:complexType>
 
 <xs:complexType name="boot-type">
        <xs:attribute name="date" type="xs:date"></xs:attribute>
        <xs:attribute name="time" type="xs:time"></xs:attribute>
+       <xs:attribute name="utc" type="xs:nonNegativeInteger"></xs:attribute>
+</xs:complexType>
+
+<xs:element name="comment" type="comment-type"></xs:element>
+<xs:complexType name="comment-type">
+       <xs:attribute name="date" type="xs:date"></xs:attribute>
+       <xs:attribute name="time" type="xs:time"></xs:attribute>
+       <xs:attribute name="utc" type="xs:nonNegativeInteger"></xs:attribute>
+       <xs:attribute name="com" type="xs:string"></xs:attribute>
 </xs:complexType>
 
 <xs:element name="cpu-load" type="cpu-load-type"></xs:element>