]> granicus.if.org Git - sysstat/commitdiff
sadf: SVG: Don't take into account activites with no graphs
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 15 Jun 2018 14:25:10 +0000 (16:25 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 15 Jun 2018 14:25:10 +0000 (16:25 +0200)
In "packed" mode, activities which don't have a graph (e.g. USB devices)
should not be taken into account when calculating SVG canvas height.
Without this patch, a command like:

$ sadf -g -O packed -- -A > output.svg

created a SVG file with some unused white space at its end.

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

diff --git a/sadf.c b/sadf.c
index bbe6c1c8a3c80e7ae7a6e567f13658a46cd1ff7e..2bd4133836959f1477371eceb34d4962f996dcfc 100644 (file)
--- a/sadf.c
+++ b/sadf.c
@@ -513,7 +513,7 @@ int get_svg_graph_nr(int ifd, char *file, struct file_magic *file_magic,
                        continue;
 
                p = get_activity_position(act, id_seq[i], EXIT_IF_NOT_FOUND);
-               if (!IS_SELECTED(act[p]->options))
+               if (!IS_SELECTED(act[p]->options) || !act[p]->g_nr)
                        continue;
 
                if (((act[p]->id == A_NET_DEV) || (act[p]->id == A_NET_EDEV)) &&