sadf -x) and DTD document.
* sadc -S POWER didn't include voltage inputs statistics.
This is now fixed.
+ * Define groups of activities: Each activity has now a new
+ attribute specifying the group it belongs to (POWER, IPV6, etc.)
* [Ivana Varekova]: Moved manual pages to $prefix/share/man
instead of $prefix/man.
* [Ivana Varekova]: Fixed configure's --disable-man-group option.
.id = A_CPU,
.options = AO_COLLECTED + AO_REMANENT + AO_GLOBAL_ITV + AO_MULTIPLE_OUTPUTS,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = wrap_get_cpu_nr,
.f_count2 = NULL,
.id = A_PCSW,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_IRQ,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_INT,
#ifdef SOURCE_SADC
.f_count = wrap_get_irq_nr,
.f_count2 = NULL,
.id = A_SWAP,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_PAGE,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_IO,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_MEMORY,
.options = AO_COLLECTED + AO_MULTIPLE_OUTPUTS,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_KTABLES,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_QUEUE,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_SERIAL,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = wrap_get_serial_nr,
.f_count2 = NULL,
.id = A_DISK,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DISK,
#ifdef SOURCE_SADC
.f_count = wrap_get_disk_nr,
.f_count2 = NULL,
.id = A_NET_DEV,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = wrap_get_iface_nr,
.f_count2 = NULL,
.id = A_NET_EDEV,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = wrap_get_iface_nr,
.f_count2 = NULL,
.id = A_NET_NFS,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_NFSD,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_SOCK,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_IP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_SNMP,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_EIP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_SNMP,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_ICMP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_SNMP,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_EICMP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_SNMP,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_TCP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_SNMP,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_ETCP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_SNMP,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_UDP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_SNMP,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_SOCK6,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_IPV6,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_IP6,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_IPV6,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_EIP6,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_IPV6,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_ICMP6,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_IPV6,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_EICMP6,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_IPV6,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_NET_UDP6,
.options = AO_CLOSE_MARKUP,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_IPV6,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_PWR_CPUFREQ,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_POWER,
#ifdef SOURCE_SADC
.f_count = wrap_get_cpu_nr,
.f_count2 = NULL,
.id = A_PWR_FAN,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_POWER,
#ifdef SOURCE_SADC
.f_count = wrap_get_fan_nr,
.f_count2 = NULL,
.id = A_PWR_TEMP,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_POWER,
#ifdef SOURCE_SADC
.f_count = wrap_get_temp_nr,
.f_count2 = NULL,
.id = A_PWR_IN,
.options = AO_NULL,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_POWER,
#ifdef SOURCE_SADC
.f_count = wrap_get_in_nr,
.f_count2 = NULL,
.id = A_HUGE,
.options = AO_COLLECTED,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DEFAULT,
#ifdef SOURCE_SADC
.f_count = NULL,
.f_count2 = NULL,
.id = A_PWR_WGHFREQ,
.options = AO_CLOSE_MARKUP,
.magic = ACTIVITY_MAGIC_BASE,
+ .group = G_POWER,
#ifdef SOURCE_SADC
.f_count = wrap_get_cpu_nr,
.f_count2 = wrap_get_freq_nr,
#define DISPLAY_HORIZONTALLY(m) (((m) & S_F_HORIZONTALLY) == S_F_HORIZONTALLY)
#define DISPLAY_COMMENT(m) (((m) & S_F_COMMENT) == S_F_COMMENT)
+#define AO_F_NULL 0x00000000
+
/* Output flags for options -R / -r / -S */
#define AO_F_MEM_DIA 0x00000001
#define AO_F_MEM_AMT 0x00000002
#define K_TCP "TCP"
#define K_ETCP "ETCP"
#define K_UDP "UDP"
-#define K_DISK "DISK"
-#define K_INT "INT"
-#define K_SNMP "SNMP"
#define K_SOCK6 "SOCK6"
#define K_IP6 "IP6"
#define K_EIP6 "EIP6"
#define K_ICMP6 "ICMP6"
#define K_EICMP6 "EICMP6"
#define K_UDP6 "UDP6"
-#define K_IPV6 "IPV6"
-#define K_POWER "POWER"
-#define K_XDISK "XDISK"
#define K_CPU "CPU"
#define K_FAN "FAN"
#define K_TEMP "TEMP"
#define K_IN "IN"
#define K_FREQ "FREQ"
+#define K_INT "INT"
+#define K_DISK "DISK"
+#define K_XDISK "XDISK"
+#define K_SNMP "SNMP"
+#define K_IPV6 "IPV6"
+#define K_POWER "POWER"
+
+/* Groups of activities */
+#define G_DEFAULT 0x00
+#define G_INT 0x01
+#define G_DISK 0x02
+#define G_SNMP 0x04
+#define G_IPV6 0x08
+#define G_POWER 0x10
+
/* sadc program */
#define SADC "sadc"
int b_size;
};
-/* Structure used to define an activity */
+/*
+ * Structure used to define an activity.
+ * Note; This structure can be modified without changing the format of data files.
+ */
struct activity {
/*
* This variable contains the identification value (A_...) for this activity.
* previous versions.
*/
unsigned int magic;
+ /*
+ * an activity belongs to a group (and only one).
+ * Groups are those selected with option -S of sadc.
+ */
+ unsigned int group;
/*
* The f_count() function is used to count the number of
* items (serial lines, network interfaces, etc.) -> @nr
*
* IN:
* @act Array of activities.
+ *
+ * OUT:
+ * @act Array of activities, all of the being selected.
***************************************************************************
*/
void select_all_activities(struct activity *act[])
* Also select CPU "all" if no other CPU has been selected.
*
* IN:
- * @act Array of activities.
+ * @act Array of activities.
*
* OUT:
- * @act Array of activities with CPU activity selected if needed.
+ * @act Array of activities with CPU activity selected if needed.
***************************************************************************
*/
void select_default_activity(struct activity *act[])
exit(1);
}
+/*
+ ***************************************************************************
+ * Collect all activities belonging to a group.
+ *
+ * IN:
+ * @group_id Group identification number.
+ * @opt_f Optionnal flag to set.
+ ***************************************************************************
+ */
+void collect_group_activities(unsigned int group_id, unsigned int opt_f)
+{
+ int i;
+
+ for (i = 0; i < NR_ACT; i++) {
+ if (act[i]->group & group_id) {
+ act[i]->options |= AO_COLLECTED;
+ if (opt_f) {
+ act[i]->opt_flags |= opt_f;
+ }
+ }
+ }
+}
+
/*
***************************************************************************
* Parse option -S, indicating which activities are to be collected.
for (p = strtok(argv[opt], ","); p; p = strtok(NULL, ",")) {
if (!strcmp(p, K_INT)) {
- /* Select interrupt activity */
- COLLECT_ACTIVITY(A_IRQ);
+ /* Select group of interrupt activities */
+ collect_group_activities(G_INT, AO_F_NULL);
}
else if (!strcmp(p, K_DISK)) {
- /* Select disk activity */
- COLLECT_ACTIVITY(A_DISK);
+ /* Select group of disk activities */
+ collect_group_activities(G_DISK, AO_F_NULL);
}
else if (!strcmp(p, K_XDISK)) {
- /* Select disk and partition activity */
- i = get_activity_position(act, A_DISK);
- act[i]->options |= AO_COLLECTED;
- act[i]->opt_flags |= AO_F_DISK_PART;
+ /* Select group of disk and partition activities */
+ collect_group_activities(G_DISK, AO_F_DISK_PART);
}
else if (!strcmp(p, K_SNMP)) {
- /* Select SNMP activities */
- COLLECT_ACTIVITY(A_NET_IP);
- COLLECT_ACTIVITY(A_NET_EIP);
- COLLECT_ACTIVITY(A_NET_ICMP);
- COLLECT_ACTIVITY(A_NET_EICMP);
- COLLECT_ACTIVITY(A_NET_TCP);
- COLLECT_ACTIVITY(A_NET_ETCP);
- COLLECT_ACTIVITY(A_NET_UDP);
+ /* Select group of SNMP activities */
+ collect_group_activities(G_SNMP, AO_F_NULL);
}
else if (!strcmp(p, K_IPV6)) {
- /* Select IPv6 activities */
- COLLECT_ACTIVITY(A_NET_IP6);
- COLLECT_ACTIVITY(A_NET_EIP6);
- COLLECT_ACTIVITY(A_NET_ICMP6);
- COLLECT_ACTIVITY(A_NET_EICMP6);
- COLLECT_ACTIVITY(A_NET_UDP6);
- COLLECT_ACTIVITY(A_NET_SOCK6);
+ /* Select group of IPv6 activities */
+ collect_group_activities(G_IPV6, AO_F_NULL);
}
else if (!strcmp(p, K_POWER)) {
- /* Select activities related to power management */
- COLLECT_ACTIVITY(A_PWR_CPUFREQ);
- COLLECT_ACTIVITY(A_PWR_FAN);
- COLLECT_ACTIVITY(A_PWR_IN);
- COLLECT_ACTIVITY(A_PWR_TEMP);
- COLLECT_ACTIVITY(A_PWR_WGHFREQ);
+ /* Select group of activities related to power management */
+ collect_group_activities(G_POWER, AO_F_NULL);
}
else if (!strcmp(p, K_ALL) || !strcmp(p, K_XALL)) {
/* Select all activities */
}
if (!strcmp(p, K_XALL)) {
/* Tell sadc to also collect partition statistics */
- i = get_activity_position(act, A_DISK);
- act[i]->opt_flags |= AO_F_DISK_PART;
+ collect_group_activities(G_DISK, AO_F_DISK_PART);
}
}
else if (strspn(argv[opt], DIGITS) == strlen(argv[opt])) {