]> granicus.if.org Git - sysstat/commitdiff
sadf: Don't use f_count2() function pointer
authorSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 4 Oct 2017 07:51:09 +0000 (09:51 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 4 Oct 2017 07:51:09 +0000 (09:51 +0200)
activity structure's f_count2() member (used to count the number of
sub-items) was tested in sadf.c but never initialized (its value is
initialized only when sadc.c is compiled, not sadf.c). So use a specific
flag to indicate if activity has sub-items instead of testing f_count2()
value.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
activity.c
sa.h
sadf_misc.c

index b6f3a89ef16bb08112bf0c02c940e7657b640cd4..8da2bfb0a5a6dcc501496421e36147f36208c53e 100644 (file)
@@ -1410,7 +1410,7 @@ struct activity huge_act = {
 /* CPU weighted frequency */
 struct activity pwr_wghfreq_act = {
        .id             = A_PWR_WGHFREQ,
-       .options        = AO_VOLATILE,
+       .options        = AO_VOLATILE + AO_MATRIX,
        .magic          = ACTIVITY_MAGIC_BASE,
        .group          = G_POWER,
 #ifdef SOURCE_SADC
diff --git a/sa.h b/sa.h
index 70e55ffe30f3362776fbf1ded0ec2e7e62964ace..3e6bed61b20efeb821ef4f6d7327061b29f8f842 100644 (file)
--- a/sa.h
+++ b/sa.h
@@ -650,6 +650,10 @@ struct record_header {
  * distinct item for this activity (sadf -g).
  */
 #define AO_GRAPH_PER_ITEM      0x40
+/*
+ * Indicate that this activity may have sub-items.
+ */
+#define AO_MATRIX              0x80
 
 #define IS_COLLECTED(m)                (((m) & AO_COLLECTED)        == AO_COLLECTED)
 #define IS_SELECTED(m)         (((m) & AO_SELECTED)         == AO_SELECTED)
@@ -658,6 +662,7 @@ struct record_header {
 #define CLOSE_MARKUP(m)                (((m) & AO_CLOSE_MARKUP)     == AO_CLOSE_MARKUP)
 #define HAS_MULTIPLE_OUTPUTS(m)        (((m) & AO_MULTIPLE_OUTPUTS) == AO_MULTIPLE_OUTPUTS)
 #define ONE_GRAPH_PER_ITEM(m)  (((m) & AO_GRAPH_PER_ITEM)   == AO_GRAPH_PER_ITEM)
+#define IS_MATRIX(m)           (((m) & AO_MATRIX)           == AO_MATRIX)
 
 #define _buf0  buf[0]
 
index 2e00a181fc1dc70357391c0c67bee1a91af5975a..840e2036156fe56b2c391ebaf5f6f436fd3a06ac 100644 (file)
@@ -880,7 +880,7 @@ __printf_funct_t print_hdr_header(void *parm, int action, char *dfile,
                        p = get_activity_position(act, id_seq[i], EXIT_IF_NOT_FOUND);
 
                        printf("%02d: %s\t(x%d)", act[p]->id, act[p]->name, act[p]->nr);
-                       if (act[p]->f_count2 || (act[p]->nr2 > 1)) {
+                       if (IS_MATRIX(act[p]->options) || (act[p]->nr2 > 1)) {
                                printf("\t(x%d)", act[p]->nr2);
                        }
                        if (act[p]->magic == ACTIVITY_MAGIC_UNKNOWN) {