Print more fields about each filesystem.
This commit is contained in:
committed by
Robert Roth
parent
e0244ad3fc
commit
a870dfc8f2
@@ -13,19 +13,36 @@ static void print_fsusage(const char *mountpoint)
|
|||||||
{
|
{
|
||||||
glibtop_fsusage buf;
|
glibtop_fsusage buf;
|
||||||
|
|
||||||
|
enum { SIZE, USED, FREE, AVAIL, READ, WRITE, MAX };
|
||||||
|
char **a = g_new0(char*, MAX);
|
||||||
|
|
||||||
glibtop_get_fsusage(&buf, mountpoint);
|
glibtop_get_fsusage(&buf, mountpoint);
|
||||||
|
|
||||||
printf("%-30s %10llu %10llu %10llu %5.1f %10llu %10llu\n",
|
|
||||||
mountpoint,
|
|
||||||
buf.blocks * buf.block_size >> 20,
|
|
||||||
(buf.blocks - buf.bavail) * buf.block_size >> 20,
|
|
||||||
buf.bavail * buf.block_size >> 20,
|
|
||||||
(buf.blocks - buf.bavail) * 100.0 / (buf.blocks ? buf.blocks : 1.0),
|
|
||||||
buf.read,
|
|
||||||
buf.write
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#define I(X) a[(X)]
|
||||||
|
I(SIZE) = g_format_size_full(buf.blocks * buf.block_size, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
I(USED) = g_format_size_full((buf.blocks - buf.bavail) * buf.block_size, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
I(FREE) = g_format_size_full(buf.bfree * buf.block_size, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
I(AVAIL) = g_format_size_full(buf.bavail * buf.block_size, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
I(READ) = g_format_size_full(buf.read, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
I(WRITE) = g_format_size_full(buf.write, G_FORMAT_SIZE_IEC_UNITS);
|
||||||
|
|
||||||
|
printf("%#7x %10s %10s %10s %10s %5.1f%% %10s %10s %8lu %8lu %s\n",
|
||||||
|
(unsigned)buf.flags,
|
||||||
|
I(SIZE),
|
||||||
|
I(USED),
|
||||||
|
I(FREE),
|
||||||
|
I(AVAIL),
|
||||||
|
(buf.blocks - buf.bavail) * 100.0 / (buf.blocks ? buf.blocks : 1.0),
|
||||||
|
I(READ),
|
||||||
|
I(WRITE),
|
||||||
|
(unsigned long)buf.files,
|
||||||
|
(unsigned long)buf.ffree,
|
||||||
|
mountpoint
|
||||||
|
);
|
||||||
|
|
||||||
|
g_strfreev(a);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -33,8 +50,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
glibtop_init();
|
glibtop_init();
|
||||||
|
|
||||||
printf("%-30s %10s %10s %10s %5s %10s %10s\n",
|
printf("%-6s %10s %10s %10s %10s %5s %10s %10s %10s %10s %s\n",
|
||||||
"Filesystem", "Size", "Used", "Avail", "Use%", "Read", "Write");
|
"(flags)", "Size", "Used", "Free", "Avail", "Use%", "Read", "Write", "Files", "Files Free", "Mountpoint");
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
while (*++argv)
|
while (*++argv)
|
||||||
|
Reference in New Issue
Block a user