From: Sebastien GODARD Date: Mon, 9 Jul 2018 13:27:26 +0000 (+0200) Subject: sadf: SVG: Make sure gXX-0 id exists for memory activity X-Git-Tag: v12.0.0~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d5f5190a8ed0e3a26e3378005bad564783e3658;p=sysstat sadf: SVG: Make sure gXX-0 id exists for memory activity A_MEMORY activity (which has two possible outputs: memory statistics and swap statistics) might have no "gXX-0" id in SVG file if memory statistics hadn't been selected. This would break corresponding link in the table of contents displayed by sadf with its option "showtoc", e.g.: sadf -g -O showtoc -- -S > output.svg Signed-off-by: Sebastien GODARD --- diff --git a/svg_stats.c b/svg_stats.c index bca0607..3905f17 100644 --- a/svg_stats.c +++ b/svg_stats.c @@ -1687,6 +1687,7 @@ __print_funct_t svg_print_memory_stats(struct activity *a, int curr, int action, static double *spmin, *spmax; static char **out; static int *outsize; + static int xid = 0; double tval; int i; unsigned long long nousedmem; @@ -1862,15 +1863,18 @@ __print_funct_t svg_print_memory_stats(struct activity *a, int curr, int action, } if (DISPLAY_MEMORY(a->opt_flags)) { - draw_activity_graphs(DISPLAY_MEM_ALL(a->opt_flags) ? 6 : 5, - g_type1, title1, g_title1, NULL, group1, - spmin, spmax, out, outsize, svg_p, record_hdr, FALSE, a->id, 0); + if (draw_activity_graphs(DISPLAY_MEM_ALL(a->opt_flags) ? 6 : 5, + g_type1, title1, g_title1, NULL, group1, + spmin, spmax, out, outsize, svg_p, record_hdr, + FALSE, a->id, xid)) { + xid++; + } } if (DISPLAY_SWAP(a->opt_flags)) { draw_activity_graphs(3, g_type2, title2, g_title2, NULL, group2, spmin + 16, spmax + 16, out + 16, outsize + 16, - svg_p, record_hdr, FALSE, a->id, 1); + svg_p, record_hdr, FALSE, a->id, xid); } /* Free remaining structures */