.bitmap = NULL
};
+/* Filesystem usage activity */
+struct activity filesystem_act = {
+ .id = A_FILESYSTEM,
+ .options = AO_NULL,
+ .magic = ACTIVITY_MAGIC_BASE,
+ .group = G_DISK,
+#ifdef SOURCE_SADC
+ .f_count = wrap_get_filesystem_nr,
+ .f_count2 = NULL,
+ .f_read = wrap_read_filesystem,
+#endif
+#ifdef SOURCE_SAR
+ .f_print = print_filesystem_stats,
+ .f_print_avg = print_avg_filesystem_stats,
+#endif
+#ifdef SOURCE_SADF
+ .f_render = render_filesystem_stats,
+ .f_xml_print = xml_print_filesystem_stats,
+ .f_json_print = json_print_filesystem_stats,
+ .hdr_line = "Mbfsfree;Mbfsused;%fsused;%ufsused;Ifree;Iused;%Iused;FILESYSTEM",
+ .name = "A_FILESYSTEM",
+#endif
+ .nr = -1,
+ .nr2 = 1,
+ .fsize = STATS_FILESYSTEM_SIZE,
+ .msize = STATS_FILESYSTEM_SIZE,
+ .opt_flags = 0,
+ .buf = {NULL, NULL, NULL},
+ .bitmap = NULL
+};
+
/*
* Array of activities.
&pwr_temp_act,
&pwr_in_act,
&pwr_wghfreq_act,
- &pwr_usb_act /* AO_CLOSE_MARKUP */
+ &pwr_usb_act, /* AO_CLOSE_MARKUP */
/* </power-management> */
+ &filesystem_act
};
json_markup_power_management(tab, CLOSE_JSON_MARKUP);
}
}
+
+/*
+ ***************************************************************************
+ * Display filesystems statistics in JSON.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @curr Index in array for current sample statistics.
+ * @tab Indentation in output.
+ * @itv Interval of time in jiffies.
+ ***************************************************************************
+ */
+__print_funct_t json_print_filesystem_stats(struct activity *a, int curr, int tab,
+ unsigned long long itv)
+{
+ /* FIXME */
+}
(struct activity *, int, int, unsigned long long);
extern __print_funct_t json_print_pwr_usb_stats
(struct activity *, int, int, unsigned long long);
+extern __print_funct_t json_print_filesystem_stats
+ (struct activity *, int, int, unsigned long long);
#endif /* _XML_STATS_H */
{
stub_print_pwr_usb_stats(a, 2, TRUE);
}
+
+/*
+ ***************************************************************************
+ * Display filesystems statistics. This function is used to
+ * display instantaneous and average statistics.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @prev Index in array where stats used as reference are.
+ * @curr Index in array for current sample statistics.
+ * @itv Interval of time in jiffies.
+ * @dispavg TRUE if displaying average statistics.
+ ***************************************************************************
+ */
+__print_funct_t stub_print_filesystem_stats(struct activity *a, int prev, int curr,
+ unsigned long long itv, int dispavg)
+{
+ /* FIXME */
+}
+
+/*
+ ***************************************************************************
+ * Display filesystems statistics.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @prev Index in array where stats used as reference are.
+ * @curr Index in array for current sample statistics.
+ * @itv Interval of time in jiffies.
+ ***************************************************************************
+ */
+__print_funct_t print_filesystem_stats(struct activity *a, int prev, int curr,
+ unsigned long long itv)
+{
+ stub_print_filesystem_stats(a, prev, curr, itv, FALSE);
+}
+
+/*
+ ***************************************************************************
+ * Display average filesystems statistics.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @prev Index in array where stats used as reference are.
+ * @curr Index in array for current sample statistics.
+ * @itv Interval of time in jiffies.
+ ***************************************************************************
+ */
+__print_funct_t print_avg_filesystem_stats(struct activity *a, int prev, int curr,
+ unsigned long long itv)
+{
+ stub_print_filesystem_stats(a, prev, curr, itv, TRUE);
+}
(struct activity *, int, int, unsigned long long);
extern __print_funct_t print_pwr_usb_stats
(struct activity *, int, int, unsigned long long);
+extern __print_funct_t print_filesystem_stats
+ (struct activity *, int, int, unsigned long long);
/* Functions used to display average statistics */
extern __print_funct_t print_avg_memory_stats
(struct activity *, int, int, unsigned long long);
extern __print_funct_t print_avg_pwr_usb_stats
(struct activity *, int, int, unsigned long long);
+extern __print_funct_t print_avg_filesystem_stats
+ (struct activity *, int, int, unsigned long long);
#endif /* _PR_STATS_H */
#define NET_SNMP "/proc/net/snmp"
#define NET_SNMP6 "/proc/net/snmp6"
#define CPUINFO "/proc/cpuinfo"
+#define MTAB "/etc/mtab"
/*
#define STATS_PWR_USB_SIZE (sizeof(struct stats_pwr_usb))
+/* Structure for filesystems statistics */
+struct stats_filesystem {
+ unsigned long long f_blocks __attribute__ ((aligned (16)));
+ unsigned long long f_bfree __attribute__ ((aligned (16)));
+ unsigned long long f_bavail __attribute__ ((aligned (16)));
+ unsigned long long f_files __attribute__ ((aligned (16)));
+ unsigned long long f_ffree __attribute__ ((aligned (16)));
+};
+
+#define STATS_FILESYSTEM_SIZE (sizeof(struct stats_filesystem))
+
/*
***************************************************************************
* Prototypes for functions used to read system statistics
suc->product);
}
}
+
+/*
+ ***************************************************************************
+ * Display filesystems statistics in selected format.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @isdb Flag, true if db printing, false if ppc printing.
+ * @pre Prefix string for output entries
+ * @curr Index in array for current sample statistics.
+ * @itv Interval of time in jiffies.
+ ***************************************************************************
+ */
+__print_funct_t render_filesystem_stats(struct activity *a, int isdb, char *pre,
+ int curr, unsigned long long itv)
+{
+ /* FIXME */
+}
(struct activity *, int, char *, int, unsigned long long);
extern __print_funct_t render_pwr_usb_stats
(struct activity *, int, char *, int, unsigned long long);
+extern __print_funct_t render_filesystem_stats
+ (struct activity *, int, char *, int, unsigned long long);
#endif /* _RNDR_STATS_H */
*/
/* Number of activities */
-#define NR_ACT 36
+#define NR_ACT 37
/* Activities */
#define A_CPU 1
#define A_HUGE 34
#define A_PWR_WGHFREQ 35
#define A_PWR_USB 36
+#define A_FILESYSTEM 37
/* Macro used to flag an activity that should be collected */
#define NR_DISK_PREALLOC 3
#define NR_FREQ_PREALLOC 0
#define NR_USB_PREALLOC 5
+#define NR_FILESYSTEM_PREALLOC 3
#define UTSNAME_LEN 65
#define TIMESTAMP_LEN 16
wrap_get_freq_nr(struct activity *);
extern __nr_t
wrap_get_usb_nr(struct activity *);
+extern __nr_t
+ wrap_get_filesystem_nr(struct activity *);
/* Functions used to read activities statistics */
extern __read_funct_t
wrap_read_time_in_state(struct activity *);
extern __read_funct_t
wrap_read_bus_usb_dev(struct activity *);
+extern __read_funct_t
+ wrap_read_filesystem(struct activity *);
/* Other functions */
extern void
SELECT_ACTIVITY(A_DISK);
break;
+ case 'F':
+ SELECT_ACTIVITY(A_FILESYSTEM);
+ break;
+
case 'H':
p = get_activity_position(act, A_HUGE);
act[p]->options |= AO_SELECTED;
return;
}
+/*
+ ***************************************************************************
+ * Read filesystem statistics.
+ *
+ * IN:
+ * @a Activity structure.
+ *
+ * OUT:
+ * @a Activity structure with statistics.
+ ***************************************************************************
+ */
+__read_funct_t wrap_read_filesystem(struct activity *a)
+{
+ struct stats_filesystem *st_filesystem
+ = (struct stats_filesystem *) a->_buf0;
+
+ /* Read filesystems from /etc/mtab */
+ /* FIXME */
+
+ return;
+}
+
/*
***************************************************************************
* Count number of interrupts that are in /proc/stat file.
return 0;
}
+
+/*
+ ***************************************************************************
+ * Get number of mounted filesystems from /etc/mtab. Don't take into account
+ * pseudo-filesystems.
+ *
+ * IN:
+ * @a Activity structure.
+ *
+ * RETURNS:
+ * Number of filesystems + a pre-allocation constant.
+ ***************************************************************************
+ */
+__nr_t wrap_get_filesystem_nr(struct activity *a)
+{
+ __nr_t n = 0;
+
+ /* FIXME */
+
+ return 0;
+}
{
print_usage_title(stderr, progname);
fprintf(stderr, _("Options are:\n"
- "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n"
+ "[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]\n"
"[ -r ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ] [ -w ] [ -y ]\n"
"[ -I { <int> [,...] | SUM | ALL | XALL } ] [ -P { <cpu> [,...] | ALL } ]\n"
"[ -m { <keyword> [,...] | ALL } ] [ -n { <keyword> [,...] | ALL } ]\n"
printf(_("\t-b\tI/O and transfer rate statistics\n"));
printf(_("\t-B\tPaging statistics\n"));
printf(_("\t-d\tBlock device statistics\n"));
+ printf(_("\t-F\tFilesystems statistics\n"));
printf(_("\t-H\tHugepages utilization statistics\n"));
printf(_("\t-I { <int> | SUM | ALL | XALL }\n"
"\t\tInterrupts statistics\n"));
if (CLOSE_MARKUP(a->options)) {
xml_markup_power_management(tab, CLOSE_XML_MARKUP);
}
-}
\ No newline at end of file
+}
+
+/*
+ ***************************************************************************
+ * Display filesystems statistics in XML.
+ *
+ * IN:
+ * @a Activity structure with statistics.
+ * @curr Index in array for current sample statistics.
+ * @tab Indentation in XML output.
+ * @itv Interval of time in jiffies.
+ ***************************************************************************
+ */
+__print_funct_t xml_print_filesystem_stats(struct activity *a, int curr, int tab,
+ unsigned long long itv)
+{
+ /* FIXME */
+}
(struct activity *, int, int, unsigned long long);
extern __print_funct_t xml_print_pwr_usb_stats
(struct activity *, int, int, unsigned long long);
+extern __print_funct_t xml_print_filesystem_stats
+ (struct activity *, int, int, unsigned long long);
#endif /* _XML_STATS_H */