rpms/sysstat/devel sysstat-7.0.2-nfs.patch, NONE, 1.1 .cvsignore, 1.15, 1.16 sources, 1.14, 1.15 sysstat.spec, 1.43, 1.44 sysstat-6.0.2-sysconf.patch, 1.2, NONE sysstat-7.0.0-nfs.patch, 1.1, NONE
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Wed Nov 8 11:41:38 UTC 2006
- Previous message (by thread): rpms/icu/devel icu.icu5501.sinhala.biggerexpand.patch, NONE, 1.1 icu.spec, 1.38, 1.39
- Next message (by thread): rpms/mc/devel mc-fishfix.patch, 1.1, 1.2 mc.spec, 1.109, 1.110 mc-fish-upload.patch, 1.3, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: varekova
Update of /cvs/dist/rpms/sysstat/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv13502
Modified Files:
.cvsignore sources sysstat.spec
Added Files:
sysstat-7.0.2-nfs.patch
Removed Files:
sysstat-6.0.2-sysconf.patch sysstat-7.0.0-nfs.patch
Log Message:
- update to 7.0.2
sysstat-7.0.2-nfs.patch:
common.c | 30 +++++++
common.h | 2
iostat.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
iostat.h | 28 ++++++-
man/iostat.1 | 8 +-
5 files changed, 292 insertions(+), 7 deletions(-)
--- NEW FILE sysstat-7.0.2-nfs.patch ---
--- sysstat-7.0.2/man/iostat.1.nfs 2006-10-15 19:00:55.000000000 +0200
+++ sysstat-7.0.2/man/iostat.1 2006-11-08 12:04:05.000000000 +0100
@@ -3,7 +3,7 @@
iostat \- Report Central Processing Unit (CPU) statistics and input/output
statistics for devices and partitions.
.SH SYNOPSIS
-.B iostat [ -c | -d ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [
+.B iostat [ -c | -d ] [ -k | -m ] [ -t ] [ -V ] [ -x ] [ -n ] [
.I device
.B [ ... ] | ALL ] [ -p [
.I device
@@ -309,6 +309,10 @@
Display statistics in megabytes per second instead of blocks or
kilobytes per second.
Data displayed are valid only with kernels 2.4 and newer.
+.IP -n
+Displays the NFS-directory statistic.
+Data displayed are valid only with kernels 2.6.17 and newer.
+This option is exclusive ot the -x option.
.IP "-p [ { device | ALL } ]"
The -p option is exclusive of the -x option and displays statistics for
block devices and all their partitions that are used by the system.
@@ -325,7 +329,7 @@
Print version number then exit.
.IP -x
Display extended statistics.
-This option is exclusive of the -p one, and works with
+This option is exclusive of the -p and -n, and works with
post 2.5 kernels since it needs /proc/diskstats file or a mounted sysfs to
get the statistics. This option may also work with older kernels (e.g. 2.4)
only if extended statistics are available in /proc/partitions (the kernel
--- sysstat-7.0.2/iostat.h.nfs 2006-10-22 11:23:45.000000000 +0200
+++ sysstat-7.0.2/iostat.h 2006-11-08 12:04:05.000000000 +0100
@@ -25,6 +25,8 @@
#define I_F_HAS_DISKSTATS 0x0800
#define I_F_HAS_PPARTITIONS 0x1000
#define I_F_PLAIN_KERNEL24 0x2000
+#define I_D_NFS_ONLY 0x4000
+#define I_F_NFS 0x8000
#define DISPLAY_CPU_ONLY(m) (((m) & I_D_CPU_ONLY) == I_D_CPU_ONLY)
#define DISPLAY_DISK_ONLY(m) (((m) & I_D_DISK_ONLY) == I_D_DISK_ONLY)
@@ -40,6 +42,8 @@
#define HAS_DISKSTATS(m) (((m) & I_F_HAS_DISKSTATS) == I_F_HAS_DISKSTATS)
#define HAS_PPARTITIONS(m) (((m) & I_F_HAS_PPARTITIONS) == I_F_HAS_PPARTITIONS)
#define HAS_PLAIN_KERNEL24(m) (((m) & I_F_PLAIN_KERNEL24) == I_F_PLAIN_KERNEL24)
+#define DISPLAY_NFS(m) (((m) & I_D_NFS_ONLY) == I_D_NFS_ONLY)
+#define HAS_NFS(m) (((m) & I_F_NFS) == I_F_NFS
#define DT_DEVICE 0
#define DT_PARTITION 1
@@ -110,11 +114,33 @@
struct io_hdr_stats {
unsigned int active __attribute__ ((aligned (8)));
unsigned int used __attribute__ ((packed));
- char name[MAX_NAME_LEN] __attribute__ ((packed));
+ char name[MAX_NAME_LEN] __attribute__ ((packed));
};
#define IO_HDR_STATS_SIZE (sizeof(struct io_hdr_stats))
+struct nfs_stats {
+ unsigned long long normal_read_bytes;
+ unsigned long long normal_written_bytes;
+ unsigned long long direct_read_bytes;
+ unsigned long long direct_written_bytes;
+ unsigned long long server_read_bytes;
+ unsigned long long server_written_bytes;
+ unsigned long long read_pages;
+ unsigned long long write_pages;
+};
+
+#define IO_NFS_STATS_SIZE (sizeof(struct nfs_stats))
+
+struct io_hdr_nfs_stats {
+ unsigned int active;
+ unsigned int used;
+ char name[MAX_NAME_LEN];
+};
+
+#define IO_HDR_NFS_STATS_SIZE (sizeof(struct io_hdr_nfs_stats))
+
+
/* List of devices entered on the command line */
struct io_dlist {
/* Indicate whether its partitions are to be displayed or not */
--- sysstat-7.0.2/common.c.nfs 2006-10-22 11:23:45.000000000 +0200
+++ sysstat-7.0.2/common.c 2006-11-08 12:04:05.000000000 +0100
@@ -394,6 +394,36 @@
}
+/*
+ ***************************************************************************
+ * Find number of NFS-mounted points that are registered in
+ * in /proc/self/mount.
+ ***************************************************************************
+ */
+int get_nfs_mount_nr(void)
+{
+ FILE *fp;
+ char line[8192],pos[8192];
+ char type_name[10];
+ unsigned int nfs = 0;
+
+ if ((fp = fopen(NFSMOUNTSTATS, "r")) == NULL) {
+ fprintf(stderr, _("Cannot open %s: %s\n"), NFSMOUNTSTATS, strerror(errno));
+ exit(2);
+ }
+ while (fgets(line, 8192, fp) != NULL) {
+ if ((strstr(line,"mounted")) && (strstr(line,"on")) && (strstr(line,"with")) && (strstr(line,"fstype"))) {
+ sscanf(strstr(line,"fstype")+6,"%10s", type_name);
+ if ((!strncmp(type_name,"nfs",3)) && (strncmp(type_name,"nfsd",4))) {
+ nfs ++;
+ }
+ }
+ }
+ fclose(fp);
+ return nfs;
+}
+
+
/*
***************************************************************************
* Print banner
--- sysstat-7.0.2/iostat.c.nfs 2006-10-22 11:23:45.000000000 +0200
+++ sysstat-7.0.2/iostat.c 2006-11-08 12:22:42.000000000 +0100
@@ -51,10 +51,15 @@
struct io_stats *st_iodev[2];
struct io_hdr_stats *st_hdr_iodev;
struct io_dlist *st_dev_list;
+struct nfs_stats *st_ionfs[2];
+struct io_hdr_nfs_stats *st_hdr_ionfs;
/* Nb of devices and partitions found */
int iodev_nr = 0;
+/* Nb of NFS-mounted directories*/
+int ionfs_nr = 0;
+
/* Nb of devices entered on the command line */
int dlist_idx = 0;
@@ -74,7 +79,7 @@
{
fprintf(stderr, _("Usage: %s [ options... ] [ <interval> [ <count> ] ]\n"
"Options are:\n"
- "[ -c | -d ] [ -k | -m ] [ -t ] [ -V ] [ -x ]\n"
+ "[ -c | -d ] [ -k | -m ] [ -n ] [ -t ] [ -V ] [ -x ]\n"
"[ <device> [ ... ] | ALL ] [ -p [ <device> | ALL ] ]\n"),
progname);
exit(1);
@@ -122,6 +127,21 @@
/*
***************************************************************************
+ * Set every nfs_io entry to inactive state
+ ***************************************************************************
+ */
+void set_nfs_entries_inactive(int ionfs_nr)
+{
+ int i;
+ struct io_hdr_nfs_stats *shi = st_hdr_ionfs;
+
+ for (i = 0; i < ionfs_nr; i++, shi++)
+ shi->active = FALSE;
+}
+
+
+/*
+ ***************************************************************************
* Set structures's state to free for inactive entries
***************************************************************************
*/
@@ -139,6 +159,23 @@
/*
***************************************************************************
+ * Set structures's state to free for inactive entries
+ ***************************************************************************
+ */
+void free_inactive_nfs_entries(int iodev_nr)
+{
+ int i;
+ struct io_hdr_nfs_stats *shi = st_hdr_ionfs;
+
+ for (i = 0; i < ionfs_nr; i++, shi++) {
+ if (!shi->active)
+ shi->used = FALSE;
+ }
+}
+
+
+/*
+ ***************************************************************************
* Allocate and init I/O devices structures
***************************************************************************
*/
@@ -164,6 +201,29 @@
/*
***************************************************************************
+ * Allocate and init I/O NFS-mount directory structures
+ ***************************************************************************
+ */
+void salloc_nfs(int ionfs_nr)
+{
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ if ((st_ionfs[i] = (struct nfs_stats *) malloc (IO_NFS_STATS_SIZE * ionfs_nr)) == NULL) {
+ perror("malloc");
+ exit(4);
+ }
+ }
+ if ((st_hdr_ionfs = (struct io_hdr_nfs_stats *) malloc (IO_HDR_NFS_STATS_SIZE * ionfs_nr)) == NULL) {
+ perror("malloc");
+ exit(4);
+ }
+ memset(st_hdr_ionfs, 0, IO_HDR_NFS_STATS_SIZE * ionfs_nr);
+}
+
+
+/*
+ ***************************************************************************
* Allocate structures for devices entered on the command line
***************************************************************************
*/
@@ -256,6 +316,16 @@
*flags |= I_F_OLD_KERNEL;
}
}
+
+ /* If the NFS-mount directory statistic is set
+ get the number of NFS-mount directories and allocate structures for them */
+
+ if ((DISPLAY_NFS(*flags)) &&
+ (ionfs_nr = get_nfs_mount_nr())) {
+ *flags |= I_F_NFS;
+ /* Allocate structures for number of NFS-mount directories */
+ salloc_nfs(ionfs_nr);
+ }
/*
* Allocate structures for number of disks found.
* iodev_nr must be <> 0.
@@ -324,6 +394,55 @@
/*
***************************************************************************
+ * Save stats for current NFS-mount directories
+ ***************************************************************************
+ */
+
+void save_nfs_stats(char *nfs_name, int curr, struct nfs_stats *snfs)
+{
+ int i;
+ struct io_hdr_nfs_stats *st_hdr_ionfs_i;
+ struct nfs_stats *st_ionfs_i;
+
+ /* Look for NFS-mount directories in NFS mount table */
+ for (i = 0; i<ionfs_nr; i++) {
+ st_hdr_ionfs_i = st_hdr_ionfs + i;
+ if (!strncmp(st_hdr_ionfs_i->name, nfs_name, MAX_NAME_LEN)) {
+ break;
+ }
+
+ }
+ if (i == ionfs_nr) {
+ /* New NFS-mount directory */
+ for (i = 0; i<ionfs_nr; i++) {
+ st_hdr_ionfs_i = st_hdr_ionfs + i;
+ if (!st_hdr_ionfs_i->used) {
+
+ /* Unused entry was found */
+ st_hdr_ionfs_i->used = TRUE;
+ strncpy(st_hdr_ionfs_i->name, nfs_name, MAX_NAME_LEN);
+ st_ionfs_i = st_ionfs[!curr] + i;
+ memset(st_ionfs_i, 0, IO_NFS_STATS_SIZE);
+ break;
+ }
+ }
+ }
+ if (i < ionfs_nr) {
+ st_hdr_ionfs_i = st_hdr_ionfs + i;
+ st_hdr_ionfs_i->active = TRUE;
+ st_ionfs_i = st_ionfs[curr] +i;
+ *st_ionfs_i = *snfs;
+ }
+ for (i=0; i<2; i++) {
+ st_ionfs_i = st_ionfs[curr] + i;
+ st_hdr_ionfs_i = st_hdr_ionfs + i;
+ }
+ /* else it was a new NFS-mount directory but there was no free structure to store it */
+}
+
+
+/*
+ ***************************************************************************
* Read stats from /proc/stat file...
* Useful at least for CPU utilization.
* May be useful to get disk stats if /sys not available.
@@ -769,6 +888,57 @@
/*
***************************************************************************
+ * Read NFS-mount directories stats from /proc/self/mountstats
+ ***************************************************************************
+ */
+void read_nfs_stat(int curr, int flags)
+{
+ FILE *fp;
+ int i;
+ char line[8192];
+ char nfs_name[MAX_NAME_LEN];
+ char mount[10], on[10];
+ char bytes[10];
+ char aux[25];
+ struct nfs_stats snfs;
+ int sw;
+
+ if ((fp = fopen(NFSMOUNTSTATS, "r")) == NULL) {
+ fprintf(stderr, _("Cannot open %s: %s\n"), NFSMOUNTSTATS, strerror(errno));
+ return;
+ }
+
+ sw = 0;
+
+ sprintf(aux,"%%%ds %%10s %%10s",MAX_NAME_LEN<200?MAX_NAME_LEN:200);
+
+ while (fgets(line, 256, fp) != NULL) {
+ /* read the NFS-mount directory name */
+ if (!strncmp(line, "device", 6)) {
+ sw = 0;
+ sscanf(line+6,aux,nfs_name, mount, on);
+ if ((!strncmp(mount, "mounted", 7)) && (!strncmp(on,"on",2))) {
+ sw = 1;
+ }
+ }
+ sscanf(line, "%10s", bytes);
+ if ((sw) && (!strncmp(bytes,"bytes:",6))) {
+ /* read the statistic for the last NFS-mounted directory */
+ i = sscanf(strstr(line,"bytes:")+6, " %llu %llu %llu %llu %llu %llu %llu %llu",
+ &snfs.normal_read_bytes, &snfs.normal_written_bytes, &snfs.direct_read_bytes,
+ &snfs.direct_written_bytes, &snfs.server_read_bytes, &snfs.server_written_bytes,
+ &snfs.read_pages, &snfs.write_pages);
+
+ save_nfs_stats(nfs_name,curr,&snfs);
+
+ sw = 0;
+ }
+ }
+}
+
+
+/*
+ ***************************************************************************
* Display CPU utilization
***************************************************************************
*/
@@ -937,6 +1107,38 @@
/*
***************************************************************************
+ * Write basic stats, read from /proc/stat, /proc/{diskstats,partitions}
+ * or from sysfs
+ ***************************************************************************
+ */
+void write_nfs_stat(int curr, unsigned long long itv, int flags, int fctr,
+ struct io_hdr_nfs_stats *shhi, struct nfs_stats *ionfsi,
+ struct nfs_stats *ionfsj)
+{
+ unsigned long long read_b_i, read_b_j, writt_b_i, writt_b_j;
+ /* NFS-mount directories statistic has values in bytes */
+ int f = 512*fctr;
+ printf("%-22s", shhi->name);
+ if (strlen(shhi->name) > 20)
+ printf("\n ");
+
+ /* print stats from /proc/self/mountstats */
+ read_b_i = ionfsi->normal_read_bytes + ionfsi->direct_read_bytes + ionfsi->server_read_bytes;
+ writt_b_i = ionfsi->normal_written_bytes + ionfsi->direct_written_bytes + ionfsi->server_written_bytes;
+ read_b_j = ionfsj->normal_read_bytes + ionfsj->direct_read_bytes + ionfsj->server_read_bytes;
+ writt_b_j = ionfsj->normal_written_bytes + ionfsj->direct_written_bytes + ionfsj->server_written_bytes;
+
+ printf(" %12.2f %12.2f %10llu %10llu\n",
+ S_VALUE(read_b_j, read_b_i, itv)/f,
+ S_VALUE(writt_b_j, writt_b_i, itv)/f,
+ (unsigned long long) (read_b_i - read_b_j)/ f,
+ (unsigned long long) (writt_b_i - writt_b_j)/ f);
+
+}
+
+
+/*
+ ***************************************************************************
* Print everything now (stats and uptime)
***************************************************************************
*/
@@ -945,6 +1147,8 @@
int dev, i, fctr = 1;
unsigned long long itv;
struct io_hdr_stats *shi = st_hdr_iodev;
+ struct io_hdr_nfs_stats *shhi = st_hdr_ionfs;
+ struct nfs_stats *ionfsi, *ionfsj;
struct io_stats *ioi, *ioj;
struct io_dlist *st_dev_list_i;
@@ -1005,7 +1209,7 @@
write_stat_header(flags, &fctr);
if (DISPLAY_EXTENDED(flags) &&
- (HAS_OLD_KERNEL(flags) || HAS_PLAIN_KERNEL24(flags))) {
+ (HAS_OLD_KERNEL(flags) || HAS_PLAIN_KERNEL24(flags) || DISPLAY_EXTENDED(flags))) {
/* No extended stats with old 2.2-2.4 kernels */
printf("\n");
return 1;
@@ -1052,6 +1256,15 @@
write_basic_stat(curr, itv, flags, fctr, shi, ioi, ioj);
}
}
+ for (i = 0; i< ionfs_nr; i++, shhi++) {
+ if (shhi->used) {
+
+ ionfsi = st_ionfs[curr] + i;
+ ionfsj = st_ionfs[!curr] + i;
+ write_nfs_stat(curr, itv, flags, fctr, shhi, ionfsi, ionfsj);
+ }
+
+ }
printf("\n");
}
return 1;
@@ -1097,7 +1310,10 @@
else if (HAS_PPARTITIONS(flags))
read_ppartitions_stat(curr, flags);
}
-
+ if (DISPLAY_NFS(flags)) {
+ read_nfs_stat(curr, flags);
+ }
+
/* Save time */
get_localtime(rectime);
@@ -1206,7 +1422,11 @@
case 'V': /* Print version number and exit */
print_version();
break;
-
+
+ case 'n':
+ flags|=I_D_NFS_ONLY;
+ break;
+
default:
usage(argv[0]);
}
@@ -1243,6 +1463,9 @@
fprintf(stderr, _("-x and -p options are mutually exclusive\n"));
exit(1);
}
+
+ if (DISPLAY_NFS(flags) && DISPLAY_EXTENDED(flags))
+ fprintf(stderr, _("-x and -n options are mutually exclusive\n"));
/* Ignore device list if '-p ALL' entered on the command line */
if (DISPLAY_PART_ALL(flags))
--- sysstat-7.0.2/common.h.nfs 2006-10-22 11:23:45.000000000 +0200
+++ sysstat-7.0.2/common.h 2006-11-08 12:04:05.000000000 +0100
@@ -34,6 +34,7 @@
#define SYSFS_BLOCK "/sys/block"
#define SYSFS_DEVCPU "/sys/devices/system/cpu"
#define S_STAT "stat"
+#define NFSMOUNTSTATS "/proc/self/mountstats"
#define MAX_FILE_LEN 256
#define MAX_PF_NAME 1024
@@ -87,6 +88,7 @@
extern int get_cpu_nr(unsigned int);
extern int get_sysfs_dev_nr(int);
extern int get_diskstats_dev_nr(int, int);
+extern int get_nfs_mount_nr(void);
extern int get_ppartitions_dev_nr(int);
extern int get_win_height(void);
extern void init_nls(void);
Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/sysstat/devel/.cvsignore,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- .cvsignore 14 Jul 2006 08:00:06 -0000 1.15
+++ .cvsignore 8 Nov 2006 11:41:36 -0000 1.16
@@ -1 +1 @@
-sysstat-7.0.0.tar.gz
+sysstat-7.0.2.tar.bz2
Index: sources
===================================================================
RCS file: /cvs/dist/rpms/sysstat/devel/sources,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- sources 14 Jul 2006 07:25:46 -0000 1.14
+++ sources 8 Nov 2006 11:41:36 -0000 1.15
@@ -1 +1 @@
-cf5b64db32a1589f76462100101c1e81 sysstat-7.0.0.tar.gz
+752c37a8eab82eef2aab43521fb2733b sysstat-7.0.2.tar.bz2
Index: sysstat.spec
===================================================================
RCS file: /cvs/dist/rpms/sysstat/devel/sysstat.spec,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- sysstat.spec 26 Oct 2006 09:12:15 -0000 1.43
+++ sysstat.spec 8 Nov 2006 11:41:36 -0000 1.44
@@ -1,19 +1,18 @@
Name: sysstat
-Version: 7.0.0
-Release: 3
+Version: 7.0.2
+Release: 1%{?dist}
Summary: The sar and iostat system monitoring commands.
License: GPL
Group: Applications/System
URL: http://perso.orange.fr/sebastien.godard/
-Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.gz
+Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
Source1: sysstat.crond
Source2: sysstat.crondaily
Source3: sysstat.sysconfig
Patch0: sysstat-4.0.1-config.patch
Patch3: sysstat-5.0.5-statreset.patch
Patch6: sysstat-5.0.5-append-msg.patch
-Patch7: sysstat-6.0.2-sysconf.patch
-Patch8: sysstat-7.0.0-nfs.patch
+Patch8: sysstat-7.0.2-nfs.patch
Patch9: sysstat-7.0.0-tmp.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -33,7 +32,6 @@
%patch0 -p1 -b .config
%patch3 -p1 -b .statreset
%patch6 -p1 -b .append-msg
-%patch7 -p1 -b .sysconf
%patch8 -p1 -b .nfs
%patch9 -p1 -b .tmp
@@ -115,6 +113,9 @@
/var/log/sa
%changelog
+* Wed Nov 8 2006 Ivana Varekova <varekova at redhat.com> - 7.0.2-1
+- update to 7.0.2
+
* Thu Oct 26 2006 Ivana Varekova <varekova at redhat.com> - 7.0.0-3
- move tmp file (#208433)
--- sysstat-6.0.2-sysconf.patch DELETED ---
--- sysstat-7.0.0-nfs.patch DELETED ---
- Previous message (by thread): rpms/icu/devel icu.icu5501.sinhala.biggerexpand.patch, NONE, 1.1 icu.spec, 1.38, 1.39
- Next message (by thread): rpms/mc/devel mc-fishfix.patch, 1.1, 1.2 mc.spec, 1.109, 1.110 mc-fish-upload.patch, 1.3, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list