]> granicus.if.org Git - sysstat/commitdiff
SVG: Add SVG output for TCPv4 network errors statistics
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 3 Jun 2016 12:31:31 +0000 (14:31 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 3 Jun 2016 12:31:31 +0000 (14:31 +0200)
These graphs correspond to the output of "sar -n ETCP".

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
activity.c
svg_stats.c
svg_stats.h

index 4e8a1f0616d8dc1af5714c9b8592e10075f12851..412be4bdbed359a35e95a5b91adeaddd89b457f9 100644 (file)
@@ -803,9 +803,10 @@ struct activity net_etcp_act = {
        .f_render       = render_net_etcp_stats,
        .f_xml_print    = xml_print_net_etcp_stats,
        .f_json_print   = json_print_net_etcp_stats,
+       .f_svg_print    = svg_print_net_etcp_stats,
        .hdr_line       = "atmptf/s;estres/s;retrans/s;isegerr/s;orsts/s",
        .name           = "A_NET_ETCP",
-       .g_nr           = 0,
+       .g_nr           = 2,
 #endif
        .nr             = 1,
        .nr2            = 1,
index 523555ed71f596809b7c9a89ae24c63fcab1fb16..468b4c84f2cca2183e507e414435caf28409d965 100644 (file)
@@ -2528,6 +2528,80 @@ __print_funct_t svg_print_net_tcp_stats(struct activity *a, int curr, int action
        }
 }
 
+/*
+ ***************************************************************************
+ * Display TCPv4 network errors statistics in SVG.
+ *
+ * IN:
+ * @a          Activity structure with statistics.
+ * @curr       Index in array for current sample statistics.
+ * @action     Action expected from current function.
+ * @svg_p      SVG specific parameters: Current graph number (.@graph_no),
+ *             flag indicating that a restart record has been previously
+ *             found (.@restart) and time used for the X axis origin
+ *             (@ust_time_ref).
+ * @itv                Interval of time in jiffies (only with F_MAIN action).
+ * @record_hdr Pointer on record header of current stats sample.
+ ***************************************************************************
+ */
+__print_funct_t svg_print_net_etcp_stats(struct activity *a, int curr, int action, struct svg_parm *svg_p,
+                                        unsigned long long itv, struct record_header *record_hdr)
+{
+       struct stats_net_etcp
+               *snetc = (struct stats_net_etcp *) a->buf[curr],
+               *snetp = (struct stats_net_etcp *) a->buf[!curr];
+       int group[] = {2, 3};
+       char *title[] = {"TCPv4 network errors statistics (1)", "TCPv4 network errors statistics (2)"};
+       char *g_title[] = {"atmptf/s", "estres/s",
+                          "retrans/s", "isegerr/s", "orsts/s"};
+       static double *spmin, *spmax;
+       static char **out;
+       static int *outsize;
+
+       if (action & F_BEGIN) {
+               /*
+                * Allocate arrays that will contain the graphs data
+                * and the min/max values.
+                */
+               out = allocate_graph_lines(5, &outsize, &spmin, &spmax);
+       }
+
+       if (action & F_MAIN) {
+               /* Check for min/max values */
+               save_extrema(0, 5, 0, (void *) a->buf[curr], (void *) a->buf[!curr],
+                            itv, spmin, spmax);
+
+               /* atmptf/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snetp->AttemptFails, snetc->AttemptFails, itv),
+                        out, outsize, svg_p->restart);
+               /* estres/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snetp->EstabResets, snetc->EstabResets, itv),
+                        out + 1, outsize + 1, svg_p->restart);
+               /* retrans/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snetp->RetransSegs, snetc->RetransSegs, itv),
+                        out + 2, outsize + 2, svg_p->restart);
+               /* isegerr/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snetp->InErrs, snetc->InErrs, itv),
+                        out + 3, outsize + 3, svg_p->restart);
+               /* orsts/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snetp->OutRsts, snetc->OutRsts, itv),
+                        out + 4, outsize + 4, svg_p->restart);
+       }
+
+       if (action & F_END) {
+               draw_activity_graphs(a->g_nr, SVG_LINE_GRAPH, title, g_title, NULL, group,
+                                    spmin, spmax, out, outsize, svg_p, record_hdr);
+
+               /* Free remaining structures */
+               free_graphs(out, outsize, spmin, spmax);
+       }
+}
+
 /*
  ***************************************************************************
  * Display UDPv4 network statistics in SVG.
index 650d5ed87ce3703499f6ed549dc996a24090ea2b..82814f8e09e1882506edcb2c75d9cda0817fc94e 100644 (file)
@@ -59,6 +59,9 @@ __print_funct_t svg_print_net_eicmp_stats
 __print_funct_t svg_print_net_tcp_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);
+__print_funct_t svg_print_net_etcp_stats
+       (struct activity *, int, int, struct svg_parm *, unsigned long long,
+        struct record_header *);
 __print_funct_t svg_print_net_udp_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);