From 375c19465118f990d95150899a4c3c90ba265bdc Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Mon, 6 Aug 2018 18:28:10 +0200 Subject: [PATCH] sadc: Allow to unselect activities by name The idea here is to make it possible for the user to *unselect* an activity which is collected by default by sadc. For example, you can now choose to collect all possible statistics except those for interrupts: sadc -S XALL,-A_IRQ (...) Signed-off-by: Sebastien GODARD --- sadc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sadc.c b/sadc.c index 5f251b4..826f4ae 100644 --- a/sadc.c +++ b/sadc.c @@ -195,6 +195,18 @@ void parse_sadc_S_option(char *argv[], int opt) usage(argv[0]); } } + else if (!strncmp(p, "-A_", 3)) { + /* Unselect activity by name */ + for (i = 0; i < NR_ACT; i++) { + if (!strcmp(p + 1, act[i]->name)) { + act[i]->options &= ~AO_COLLECTED; + break; + } + } + if (i == NR_ACT) { + usage(argv[0]); + } + } else { usage(argv[0]); } -- 2.40.0