From: Sebastien GODARD Date: Fri, 3 Jun 2016 09:02:36 +0000 (+0200) Subject: SVG: Add SVG output for ICMPv6 network statistics X-Git-Tag: v11.3.5~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06119a08dc014146b4bad28a25e18b5477abde01;p=sysstat SVG: Add SVG output for ICMPv6 network statistics These graphs correspond to the output of "sar -n ICMP6". Signed-off-by: Sebastien GODARD --- diff --git a/activity.c b/activity.c index 4210052..f25e1fe 100644 --- a/activity.c +++ b/activity.c @@ -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, diff --git a/svg_stats.c b/svg_stats.c index 0de06c7..0000405 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -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. diff --git a/svg_stats.h b/svg_stats.h index 0256e95..219be2d 100644 --- a/svg_stats.h +++ b/svg_stats.h @@ -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 *);