summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-11-06 09:51:58 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-11-06 09:51:58 -0600
commit2229253e11ae5c729a703f0c72e006f46746c592 (patch)
tree4600f2a3144f25a578138164f85ef91c70aecfc3
parente9da95977365731a8f921f2d23b943036bf8f3d5 (diff)
downloadlibgtop-2229253e11ae5c729a703f0c72e006f46746c592.tar.gz
Revert "Updated config and added reference"
This reverts commit e9da95977365731a8f921f2d23b943036bf8f3d5.
-rw-r--r--configure.ac6
-rw-r--r--doc/main.texi1
-rw-r--r--doc/reference.texi59
-rw-r--r--doc/reference/libgtop-sections.txt22
-rw-r--r--include/glibtop/disk.h18
-rw-r--r--sysdeps/linux/disk.c31
6 files changed, 53 insertions, 84 deletions
diff --git a/configure.ac b/configure.ac
index cc1d041f..5426daf1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,16 +8,16 @@ m4_define([libgtop_micro_version], [0])
m4_define([libgtop_version], [libgtop_major_version.libgtop_minor_version.libgtop_micro_version])
dnl increment if the interface has additions, changes, removals.
-m4_define([libgtop_current], [12])
+m4_define([libgtop_current], [11])
dnl increment any time the source changes; set to
dnl 0 if you increment CURRENT
-m4_define([libgtop_revision], [0])
+m4_define([libgtop_revision], [1])
dnl increment if any interfaces have been added; set to 0
dnl if any interfaces have been removed. removal has
dnl precedence over adding, so set to 0 if both happened.
-m4_define([libgtop_age], [1])
+m4_define([libgtop_age], [0])
# Increase each time you change the client/server protocol.
m4_define([libgtop_server_version], [5])
diff --git a/doc/main.texi b/doc/main.texi
index f6a1ddde..6945d651 100644
--- a/doc/main.texi
+++ b/doc/main.texi
@@ -49,7 +49,6 @@ System Dependent Functions
* glibtop_proc_map:: Process Memory Maps.
* glibtop_netload:: Network Load.
* glibtop_ppp:: PPP Usage.
-* glibtop_disk:: DISK Usage.
Common Functions
diff --git a/doc/reference.texi b/doc/reference.texi
index 55970001..cdba6887 100644
--- a/doc/reference.texi
+++ b/doc/reference.texi
@@ -28,7 +28,6 @@
* glibtop_proc_map:: Process Memory Maps.
* glibtop_netload:: Network Load.
* glibtop_ppp:: PPP Usage.
-* glibtop_disk:: DISK Usage.
@end menu
@node glibtop_cpu, glibtop_mem, System Dependent, System Dependent
@@ -1344,7 +1343,7 @@ enum @{
@end example
@page
-@node glibtop_ppp, glibtop_disk, glibtop_netload, System Dependent
+@node glibtop_ppp, , glibtop_netload, System Dependent
@subsection PPP Statistics
Library function @code{glibtop_get_ppp}:
@@ -1405,62 +1404,6 @@ We're currently online.
@end table
@page
-@node glibtop_disk, , glibtop_ppp, System Dependent
-@subsection DISK Usage
-
-Library function @code{glibtop_get_disk}:
-
-@example
-@cartouche
-void glibtop_get_disk (glibtop_disk *buf);
-void glibtop_get_disk_l (glibtop *server, glibtop_disk *buf);
-@end cartouche
-@end example
-
-Declaration of @code{glibtop_disk} in @file{<glibtop/disk.h>}:
-
-@example
-@cartouche
-typedef struct _glibtop_disk glibtop_disk;
-
-struct _glibtop_disk
-@{
- xdisk_sectors_read [GLIBTOP_NDISK],
- xdisk_time_read [GLIBTOP_NDISK],
- xdisk_sectors_write [GLIBTOP_NDISK],
- xdisk_time_write [GLIBTOP_NDISK],
-@};
-@end cartouche
-@end example
-
-All DISK reads and writes are measured by @dfn{sectors} which are normally 512 bytes each.
-All disk time are measured in milliseconds which is 1/1000th of a second.
-
-@table @code
-@item xdisk_sectors_read
-Number of sectors read since system boot.
-
-@item xdisk_time_read
-Number of milliseconds spent reading since system boot.
-
-@item xdisk_sectors_write
-Number of sectors written since system boot.
-
-@item xdisk_time_write
-Number of milliseconds spent writing since system boot.
-
-@end table
-
-The @samp{xdisk_} are values from arrays of @code{GLIBTOP_NDISK} (defined in
-@file{<glibtop/disk.h>}) elements and contain one value for each DISK
-in the system.
-
-Please note that all of the disk values are absolute values measured in
-certain units since system boot. To get bandwidth values (bytes/s), you need to call @code{glibtop_disk}, save the
-result, wait some time and then call it again and divide the differences of
-the two values by the time spent reading or writing.
-
-@page
@node Common Functions, Library Functions, System Dependent, Reference Manual
@section Common Functions
diff --git a/doc/reference/libgtop-sections.txt b/doc/reference/libgtop-sections.txt
index 63137481..3d6d710d 100644
--- a/doc/reference/libgtop-sections.txt
+++ b/doc/reference/libgtop-sections.txt
@@ -682,10 +682,24 @@ glibtop_get_cpu_s
<INCLUDE>glibtop/disk.h</INCLUDE>
<SECTION>
<FILE>disk</FILE>
-LIBTOP_XDISK_SECTORS_READ
-GLIBTOP_XDISK_TIME_READ
-GLIBTOP_XDISK_SECTORS_WRITE
-GLIBTOP_XDISK_TIME_WRITE
+GLIBTOP_DISK_TOTAL
+GLIBTOP_DISK_USER
+GLIBTOP_DISK_NICE
+GLIBTOP_DISK_SYS
+GLIBTOP_DISK_IDLE
+GLIBTOP_DISK_FREQUENCY
+GLIBTOP_XDISK_TOTAL
+GLIBTOP_XDISK_USER
+GLIBTOP_XDISK_NICE
+GLIBTOP_XDISK_SYS
+GLIBTOP_XDISK_IDLE
+GLIBTOP_XDISK_FLAGS
+GLIBTOP_DISK_IOWAIT
+GLIBTOP_DISK_IRQ
+GLIBTOP_DISK_SOFTIRQ
+GLIBTOP_XDISK_IOWAIT
+GLIBTOP_XDISK_IRQ
+GLIBTOP_XDISK_SOFTIRQ
GLIBTOP_MAX_DISK
GLIBTOP_NDISK
glibtop_disk
diff --git a/include/glibtop/disk.h b/include/glibtop/disk.h
index e444d819..292924f6 100644
--- a/include/glibtop/disk.h
+++ b/include/glibtop/disk.h
@@ -28,17 +28,17 @@
G_BEGIN_DECLS
#define GLIBTOP_XDISK_SECTORS_READ 0
-#define GLIBTOP_XDISK_TIME_READ 1
+#define GLIBTOP_XDISK_TIME_READ 1
#define GLIBTOP_XDISK_SECTORS_WRITE 2
#define GLIBTOP_XDISK_TIME_WRITE 3
-#define GLIBTOP_MAX_DISK 4
+#define GLIBTOP_MAX_DISK 4
/* Nobody should really be using more than 4 disk.
Yes we are :)
Nobody should really be using more than 32 disk.
*/
-#define GLIBTOP_NDISK 1024
+#define GLIBTOP_NDISK 1024
typedef struct _glibtop_disk glibtop_disk;
@@ -54,12 +54,12 @@ typedef struct _partition_info partition_info;
struct _glibtop_disk
{
- guint64 flags; /* NOT USED YET */
- guint64 xdisk_sectors_read [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_SECTORS_READ */
- guint64 xdisk_time_read [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_TIME_READ */
- guint64 xdisk_sectors_write [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_SECTORS_WRITE */
- guint64 xdisk_time_write [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_TIME_WRITE */
- guint64 xdisk_flags;
+ guint64 flags;
+ guint64 xdisk_sectors_read [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_SECTORS_READ */
+ guint64 xdisk_time_read [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_TIME_READ */
+ guint64 xdisk_sectors_write [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_SECTORS_WRITE */
+ guint64 xdisk_time_write [GLIBTOP_NDISK]; /* GLIBTOP_XDISK_TIME_WRITE */
+ guint64 xdisk_flags;
};
void glibtop_get_disk (glibtop_disk *buf);
diff --git a/sysdeps/linux/disk.c b/sysdeps/linux/disk.c
index dbd46dff..c2d341f6 100644
--- a/sysdeps/linux/disk.c
+++ b/sysdeps/linux/disk.c
@@ -51,7 +51,7 @@ void
find_primary_part (partition_info *primary_part, const char *m)
{
int n = 0, tlvl = 0;
- char name[256]="", type[256]="";
+ char name[256]="",type[256]="";
primary_part->max = 0;
@@ -92,12 +92,18 @@ find_primary_part (partition_info *primary_part, const char *m)
n--;
}
- else if ((strcmp (type, "lvm") == 0) || (strncmp (type, "raid", 4) == 0)) {
+ else if ((strcmp (type, "lvm") == 0)) {
tlvl = 2;
primary_part->max++;
}
+ else if ((strncmp (type, "raid", 4) == 0)) {
+
+ tlvl = 2;
+ primary_part->max++;
+
+ }
}
else if( tlvl == 2){
@@ -109,14 +115,23 @@ find_primary_part (partition_info *primary_part, const char *m)
primary_part->max++;
}
- else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "lvm") == 0) ||
- (strcmp (primary_part[n-1].type, "raid") == 0) && (strncmp (type, "raid", 4) == 0)) {
+ else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "lvm") == 0)) {
+
+ n--;
+
+ }
+ else if ((strcmp (primary_part[n-1].type, "raid") == 0) && (strncmp (type, "raid", 4) == 0)) {
n--;
}
- else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "part") == 0) ||
- (strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0)) {
+ else if ((strcmp (primary_part[n-1].type, "lvm") == 0) && (strcmp (type, "part") == 0)) {
+
+ n--;
+ tlvl = 1;
+
+ }
+ else if ((strcmp (primary_part[n-1].type, "raid") == 0) && (strcmp (type, "part") == 0)) {
n--;
tlvl = 1;
@@ -156,7 +171,6 @@ find_primary_part (partition_info *primary_part, const char *m)
tlvl = 1;
}
-
}
@@ -181,12 +195,11 @@ is_virtual_drive (partition_info *primary_part, const char *p)
int i;
char name[256];
int test = 1;
-
sscanf (p, "%s", name);
if (*p) {
- for (i=0; i < primary_part->max; i++) {
+ for (i=0; i<primary_part->max; i++) {
if (strcmp (primary_part[i].name, name) == 0) {