From 6a5e0475a0db60f3510ecabd01d4ea901bfd8ca9 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Wed, 11 Jan 2017 13:23:12 +0100 Subject: [PATCH] SVG: Give actual canvas height Add a comment at the end of SVG output that indicates the actual canvas height. The actual height is frequently different (i.e. smaller) than that indicated in the header of the SVG output. This is because some activities have pre-allocated entries that don't result in graphs being drawn, or because option 'skipempty' has been used. Signed-off-by: Sebastien GODARD --- sadf.c | 3 +++ sadf_misc.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/sadf.c b/sadf.c index e32b5f1..3680aa7 100644 --- a/sadf.c +++ b/sadf.c @@ -1347,6 +1347,9 @@ void logic3_display_loop(int ifd, struct file_activity *file_actlst, __nr_t cpu_ } } + /* Real number of graphs that have been displayed */ + graph_nr = g_nr; + /* Print SVG trailer */ if (*fmt[f_position]->f_header) { (*fmt[f_position]->f_header)(&graph_nr, F_END, file, file_magic, diff --git a/sadf_misc.c b/sadf_misc.c index 1b61d28..8486e56 100644 --- a/sadf_misc.c +++ b/sadf_misc.c @@ -937,6 +937,11 @@ __printf_funct_t print_svg_header(void *parm, int action, char *dfile, } if (action & F_END) { + if (!(action & F_BEGIN)) { + /* Give actual SVG height */ + printf("\n", + SVG_H_YSIZE + SVG_T_YSIZE * (*graph_nr)); + } printf("\n"); } } -- 2.40.0