From 4e45e0909b574881342c87fb252c7cd5954e76c2 Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Fri, 26 Apr 2019 10:20:43 +0200 Subject: [PATCH] sadc: Fix bad number of CPU displayed in a LINUX RESTART message sadc didn't take into account properly a different number of CPU When appending data to an existing file. This was because the number of CPU recorded with the restart message was overwritten with that originally saved in the file. This patch fixes the problem. Signed-off-by: Sebastien GODARD --- sadc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sadc.c b/sadc.c index 87d7332..557a8e7 100644 --- a/sadc.c +++ b/sadc.c @@ -954,8 +954,11 @@ void open_ofile(int *ofd, char ofile[], int restart_mark) * Since we are appending data to a file, set @nr_ini to the value of the file. * Stats saved in file will all be 0 for that activity if no items exist on * the machine. + * NB: We must preserve the value read for A_CPU when a LINUX RESTART is inserted. */ - act[p]->nr_ini = file_act[i].nr; + if (!ALWAYS_COUNT_ITEMS(act[p]->options) || !act[p]->nr_ini) { + act[p]->nr_ini = file_act[i].nr; + } /* * Force number of sub-items to that of the file, and reallocate structures. -- 2.40.0