]> granicus.if.org Git - sysstat/commitdiff
SVG: Add SVG output for ICMPv6 network statistics
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 3 Jun 2016 09:02:36 +0000 (11:02 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 3 Jun 2016 09:02:36 +0000 (11:02 +0200)
These graphs correspond to the output of "sar -n ICMP6".

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

index 42100522cae48dbb036ef749c4c134ad34756897..f25e1fe6ff6d66ea6e65002d8196edb1eda242f1 100644 (file)
@@ -971,11 +971,12 @@ struct activity net_icmp6_act = {
        .f_render       = render_net_icmp6_stats,
        .f_xml_print    = xml_print_net_icmp6_stats,
        .f_json_print   = json_print_net_icmp6_stats,
+       .f_svg_print    = svg_print_net_icmp6_stats,
        .hdr_line       = "imsg6/s;omsg6/s;iech6/s;iechr6/s;oechr6/s;igmbq6/s;igmbr6/s;ogmbr6/s;"
                          "igmbrd6/s;ogmbrd6/s;irtsol6/s;ortsol6/s;irtad6/s;inbsol6/s;onbsol6/s;"
                          "inbad6/s;onbad6/s",
        .name           = "A_NET_ICMP6",
-       .g_nr           = 0,
+       .g_nr           = 5,
 #endif
        .nr             = 1,
        .nr2            = 1,
index 0de06c7d40ca59002f0178535be46d7c655b96d8..0000405d9c6e6252a3cbcde17ed6a71c04c2a77d 100644 (file)
@@ -2566,6 +2566,133 @@ __print_funct_t svg_print_net_ip6_stats(struct activity *a, int curr, int action
        }
 }
 
+/*
+ ***************************************************************************
+ * Display ICMPv6 network 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_icmp6_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_icmp6
+               *snic = (struct stats_net_icmp6 *) a->buf[curr],
+               *snip = (struct stats_net_icmp6 *) a->buf[!curr];
+       int group[] = {2, 3, 5, 3, 4};
+       char *title[] = {"ICMPv6 network statistics (1)", "ICMPv6 network statistics (2)",
+                        "ICMPv6 network statistics (3)", "ICMPv6 network statistics (4)",
+                        "ICMPv6 network statistics (5)"};
+       char *g_title[] = {"imsg6/s", "omsg6/s",
+                          "iech6/s", "iechr6/s", "oechr6/s",
+                          "igmbq6/s", "igmbr6/s", "ogmbr6/s", "igmbrd6/s", "ogmbrd6/s",
+                          "irtsol6/s", "ortsol6/s", "irtad6/s",
+                          "inbsol6/s", "onbsol6/s", "inbad6/s", "onbad6/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(17, &outsize, &spmin, &spmax);
+       }
+
+       if (action & F_MAIN) {
+               /* Check for min/max values */
+               save_extrema(0, 17, 0, (void *) a->buf[curr], (void *) a->buf[!curr],
+                            itv, spmin, spmax);
+
+               /* imsg6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InMsgs6, snic->InMsgs6, itv),
+                        out, outsize, svg_p->restart);
+               /* omsg6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->OutMsgs6, snic->OutMsgs6, itv),
+                        out + 1, outsize + 1, svg_p->restart);
+               /* iech6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InEchos6, snic->InEchos6, itv),
+                        out + 2, outsize + 2, svg_p->restart);
+               /* iechr6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InEchoReplies6, snic->InEchoReplies6, itv),
+                        out + 3, outsize + 3, svg_p->restart);
+               /* oechr6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->OutEchoReplies6, snic->OutEchoReplies6, itv),
+                        out + 4, outsize + 4, svg_p->restart);
+               /* igmbq6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InGroupMembQueries6, snic->InGroupMembQueries6, itv),
+                        out + 5, outsize + 5, svg_p->restart);
+               /* igmbr6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InGroupMembResponses6, snic->InGroupMembResponses6, itv),
+                        out + 6, outsize + 6, svg_p->restart);
+               /* ogmbr6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->OutGroupMembResponses6, snic->OutGroupMembResponses6, itv),
+                        out + 7, outsize + 7, svg_p->restart);
+               /* igmbrd6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InGroupMembReductions6, snic->InGroupMembReductions6, itv),
+                        out + 8, outsize + 8, svg_p->restart);
+               /* ogmbrd6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->OutGroupMembReductions6, snic->OutGroupMembReductions6, itv),
+                        out + 9, outsize + 9, svg_p->restart);
+               /* irtsol6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InRouterSolicits6, snic->InRouterSolicits6, itv),
+                        out + 10, outsize + 10, svg_p->restart);
+               /* ortsol6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->OutRouterSolicits6, snic->OutRouterSolicits6, itv),
+                        out + 11, outsize + 11, svg_p->restart);
+               /* irtad6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InRouterAdvertisements6, snic->InRouterAdvertisements6, itv),
+                        out + 12, outsize + 12, svg_p->restart);
+               /* inbsol6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InNeighborSolicits6,snic->InNeighborSolicits6, itv),
+                        out + 13, outsize + 13, svg_p->restart);
+               /* onbsol6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->OutNeighborSolicits6, snic->OutNeighborSolicits6, itv),
+                        out + 14, outsize + 14, svg_p->restart);
+               /* inbad6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->InNeighborAdvertisements6, snic->InNeighborAdvertisements6, itv),
+                        out + 15, outsize + 15, svg_p->restart);
+               /* onbad6/s */
+               lnappend(record_hdr->ust_time - svg_p->ust_time_ref,
+                        S_VALUE(snip->OutNeighborAdvertisements6, snic->OutNeighborAdvertisements6, itv),
+                        out + 16, outsize + 16, 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 CPU frequency statistics in SVG.
index 0256e9590be9149b7a54c41f1aeb08d0ff8eba08..219be2de894a760fb53df93aa1d1c8f4c7649b01 100644 (file)
@@ -62,6 +62,9 @@ __print_funct_t svg_print_net_sock6_stats
 __print_funct_t svg_print_net_ip6_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);
+__print_funct_t svg_print_net_icmp6_stats
+       (struct activity *, int, int, struct svg_parm *, unsigned long long,
+        struct record_header *);
 __print_funct_t svg_print_pwr_cpufreq_stats
        (struct activity *, int, int, struct svg_parm *, unsigned long long,
         struct record_header *);