#define S_F_ZERO_OMIT 0x02000000
#define S_F_SVG_SHOW_TOC 0x04000000
#define S_F_FDATASYNC 0x08000000
+#define S_F_OPTION_A 0x10000000
+#define S_F_OPTION_P 0x20000000
+#define S_F_OPTION_I 0x40000000
#define WANT_SINCE_BOOT(m) (((m) & S_F_SINCE_BOOT) == S_F_SINCE_BOOT)
#define WANT_SA_ROTAT(m) (((m) & S_F_SA_ROTAT) == S_F_SA_ROTAT)
#define DISPLAY_ZERO_OMIT(m) (((m) & S_F_ZERO_OMIT) == S_F_ZERO_OMIT)
#define DISPLAY_DEBUG_MODE(m) (((m) & S_F_RAW_DEBUG_MODE) == S_F_RAW_DEBUG_MODE)
#define AUTOSCALE_ON(m) (((m) & S_F_SVG_AUTOSCALE) == S_F_SVG_AUTOSCALE)
-#define DISPLAY_ONE_DAY(m) (((m) & S_F_SVG_ONE_DAY) == S_F_SVG_ONE_DAY)
+#define DISPLAY_ONE_DAY(m) (((m) & S_F_SVG_ONE_DAY) == S_F_SVG_ONE_DAY)
#define DISPLAY_IDLE(m) (((m) & S_F_SVG_SHOW_IDLE) == S_F_SVG_SHOW_IDLE)
#define DISPLAY_INFO(m) (((m) & S_F_SVG_SHOW_INFO) == S_F_SVG_SHOW_INFO)
-#define DISPLAY_UNIT(m) (((m) & S_F_UNIT) == S_F_UNIT)
-#define SET_CANVAS_HEIGHT(m) (((m) & S_F_SVG_HEIGHT) == S_F_SVG_HEIGHT)
-#define PACK_VIEWS(m) (((m) & S_F_SVG_PACKED) == S_F_SVG_PACKED)
-#define DISPLAY_HUMAN_READ(m) (((m) & S_F_HUMAN_READ) == S_F_HUMAN_READ)
+#define DISPLAY_UNIT(m) (((m) & S_F_UNIT) == S_F_UNIT)
+#define SET_CANVAS_HEIGHT(m) (((m) & S_F_SVG_HEIGHT) == S_F_SVG_HEIGHT)
+#define PACK_VIEWS(m) (((m) & S_F_SVG_PACKED) == S_F_SVG_PACKED)
+#define DISPLAY_HUMAN_READ(m) (((m) & S_F_HUMAN_READ) == S_F_HUMAN_READ)
#define DISPLAY_TOC(m) (((m) & S_F_SVG_SHOW_TOC) == S_F_SVG_SHOW_TOC)
#define FDATASYNC(m) (((m) & S_F_FDATASYNC) == S_F_FDATASYNC)
+#define USE_OPTION_A(m) (((m) & S_F_OPTION_A) == S_F_OPTION_A)
+#define USE_OPTION_P(m) (((m) & S_F_OPTION_P) == S_F_OPTION_P)
+#define USE_OPTION_I(m) (((m) & S_F_OPTION_I) == S_F_OPTION_I)
#define AO_F_NULL 0x00000000
int parse_sar_opt
(char * [], int *, struct activity * [], unsigned int *, int);
int parse_sar_I_opt
- (char * [], int *, struct activity * []);
+ (char * [], int *, unsigned int *, struct activity * []);
int parse_sa_P_opt
(char * [], int *, unsigned int *, struct activity * []);
int parse_sar_m_opt
(struct activity * []);
void select_default_activity
(struct activity * []);
-void set_bitmap
- (unsigned char [], unsigned char, unsigned int);
+void set_bitmaps
+ (struct activity * [], unsigned int *);
void set_hdr_rectime
(unsigned int, struct tm *, struct file_header *);
void set_record_timestamp_string
case 'A':
select_all_activities(act);
+ *flags |= S_F_OPTION_A;
/*
- * Force '-P ALL -I ALL -r ALL -u ALL -F'.
+ * Force '-r ALL -u ALL -F'.
* Setting -F is compulsory because corresponding activity
* has AO_MULTIPLE_OUTPUTS flag set.
+ * -P ALL / -I ALL will be set only corresponding option has
+ * not been exlicitly entered on the command line.
*/
p = get_activity_position(act, A_MEMORY, EXIT_IF_NOT_FOUND);
act[p]->opt_flags |= AO_F_MEMORY + AO_F_SWAP + AO_F_MEM_ALL;
- p = get_activity_position(act, A_IRQ, EXIT_IF_NOT_FOUND);
- memset(act[p]->bitmap->b_array, ~0,
- BITMAP_SIZE(act[p]->bitmap->b_size));
p = get_activity_position(act, A_CPU, EXIT_IF_NOT_FOUND);
- memset(act[p]->bitmap->b_array, ~0,
- BITMAP_SIZE(act[p]->bitmap->b_size));
act[p]->opt_flags = AO_F_CPU_ALL;
p = get_activity_position(act, A_FS, EXIT_IF_NOT_FOUND);
* @act Array of activities.
*
* OUT:
+ * @flags Common flags and system state.
* @act Array of activities, with interrupts activity selected.
*
* RETURNS:
* 0 on success, 1 otherwise.
***************************************************************************
*/
-int parse_sar_I_opt(char *argv[], int *opt, struct activity *act[])
+int parse_sar_I_opt(char *argv[], int *opt, unsigned int *flags, struct activity *act[])
{
int p;
act[p]->bitmap->b_size, K_SUM))
return 1;
(*opt)++;
+ *flags |= S_F_OPTION_I;
return 0;
}
act[p]->bitmap->b_size, K_LOWERALL))
return 1;
(*opt)++;
+ *flags |= S_F_OPTION_P;
return 0;
}
return 1;
}
+/*
+ ***************************************************************************
+ * If option -A has been used, force -P ALL -I ALL only if corresponding
+ * option has not been explicitly entered on the command line.
+ *
+ * IN:
+ * @flags Common flags and system state.
+ *
+ * OUT:
+ * @act Array of selected activities.
+ ***************************************************************************
+ */
+void set_bitmaps(struct activity *act[], unsigned int *flags)
+{
+ int p;
+
+ if (!USE_OPTION_P(*flags)) {
+ /* Force -P ALL */
+ p = get_activity_position(act, A_CPU, EXIT_IF_NOT_FOUND);
+ memset(act[p]->bitmap->b_array, ~0,
+ BITMAP_SIZE(act[p]->bitmap->b_size));
+ }
+
+ if (!USE_OPTION_I(*flags)) {
+ /* Force -I ALL */
+ p = get_activity_position(act, A_IRQ, EXIT_IF_NOT_FOUND);
+ memset(act[p]->bitmap->b_array, ~0,
+ BITMAP_SIZE(act[p]->bitmap->b_size));
+ }
+}
+
/*
***************************************************************************
* Count number of comma-separated values in arguments list. For example,
if (!sar_options) {
usage(argv[0]);
}
- if (parse_sar_I_opt(argv, &opt, act)) {
+ if (parse_sar_I_opt(argv, &opt, &flags, act)) {
usage(argv[0]);
}
}
}
}
+ if (USE_OPTION_A(flags)) {
+ /* Set -P ALL -I ALL if needed */
+ set_bitmaps(act, &flags);
+ }
+
/* sadf reads current daily data file by default */
if (!dfile[0]) {
set_default_file(dfile, day_offset, -1);
else if (!strcmp(argv[opt], "-I")) {
/* Parse -I option */
- if (parse_sar_I_opt(argv, &opt, act)) {
+ if (parse_sar_I_opt(argv, &opt, &flags, act)) {
usage(argv[0]);
}
}
fprintf(stderr, _("-f and -o options are mutually exclusive\n"));
exit(1);
}
+ if (USE_OPTION_A(flags)) {
+ /* Set -P ALL -I ALL if needed */
+ set_bitmaps(act, &flags);
+ }
/* Use time start or option -i only when reading stats from a file */
if ((tm_start.use || INTERVAL_SET(flags)) && !from_file[0]) {
fprintf(stderr,