From 7bf23fadefaf25ff01cfb37e3fae2b7516350f67 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 15 Jun 2018 16:11:36 +0200 Subject: [PATCH] sadf: SVG: Display graphs for swap utilization in packed mode When both memory and swap utilization were selected, graphs for swap utilization weren't displayed by sadf if option "packed" had been entered, e.g.: $ sadf -g -O packed -- -rS > output.svg This was because SVG canvas height was not big enough. Indeed, sadf assumed that each activity only needed one row in "packed" mode, which is wrong for A_MEMORY activity (which requires two rows: One for memory utilization and one for swap utilization). This patch fixes the problem. Signed-off-by: Sebastien GODARD --- sadf.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sadf.c b/sadf.c index fdba3a7..bbe6c1c 100644 --- a/sadf.c +++ b/sadf.c @@ -530,8 +530,19 @@ int get_svg_graph_nr(int ifd, char *file, struct file_magic *file_magic, } if (PACK_VIEWS(flags)) { - /* One activity = one row with multiple views */ - n = 1; + /* + * One activity = one row with multiple views. + * Exception is A_MEMORY, for which one activity may be + * displayed in two rows if both memory *and* swap utilization + * have been selected. + */ + if ((act[p]->id == A_MEMORY) && + (DISPLAY_MEMORY(act[p]->opt_flags) && DISPLAY_SWAP(act[p]->opt_flags))) { + n = 2; + } + else { + n = 1; + } } else { /* One activity = multiple rows with only one view */ -- 2.40.0