]> granicus.if.org Git - sysstat/commitdiff
sar/sadc: Remove preallocation constants
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 12 Nov 2017 08:17:55 +0000 (09:17 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 12 Nov 2017 09:02:26 +0000 (10:02 +0100)
Next sysstat version will dynamically allocate records for new devices
when they are registered by the system. So we no longer need to
preallocate those records.
This patch removes the constants and files that were used for this
purpose.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
Makefile.in
build/prealloc [deleted file]
configure
configure.in
iconfig
prealloc.in [deleted file]
sa.h
sa_wrap.c
sadf.c

index 7300194065fbaa384ef05a99224f654b756b6087..6137f246de0de1ddc70ce456a9f9fbd082888dc8 100644 (file)
@@ -213,7 +213,7 @@ svg_stats.o: svg_stats.c sa.h sadf.h ioconf.h sysconfig.h svg_stats.h
 
 raw_stats.o: raw_stats.c sa.h sadf.h ioconf.h sysconfig.h raw_stats.h
 
-sa_wrap.o: sa_wrap.c sa.h rd_stats.h count.h rd_sensors.h prealloc.h
+sa_wrap.o: sa_wrap.c sa.h rd_stats.h count.h rd_sensors.h
 
 format_sadf.o: format.c sadf.h
        $(CC) -o $@ -c $(CFLAGS) -DSOURCE_SADF $(DFLAGS) $<
@@ -587,7 +587,7 @@ clean:
        find nls -name "*.gmo" -exec rm -f {} \;
 
 almost-distclean: clean nls/sysstat.pot
-       rm -f sa1 sa2 sysstat cron/crontab version.h sysconfig.h prealloc.h
+       rm -f sa1 sa2 sysstat cron/crontab version.h sysconfig.h
        rm -f sysstat.sysconfig cron/sysstat.crond cron/sysstat.cron.daily sysstat.service
        rm -f cron/sysstat-collect.service cron/sysstat-collect.timer cron/sysstat-summary.service cron/sysstat-summary.timer
        rm -f cron/sysstat.cron.hourly cron/sysstat.crond.sample cron/sysstat.crond.sample.in
diff --git a/build/prealloc b/build/prealloc
deleted file mode 100644 (file)
index 898034f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-sar (or sadc) allocates empty records in the data files it creates so that
-it can save statistics for devices (disks, network interfaces, etc.) that
-may be added to the system after the file was created. The drawback is that
-data files take more space on disk than actually strictly necessary.
-Answer here a positive integer number telling sar/sadc how much space they
-should allocate for such devices. The default value (1) means that a few
-records will be allocated. A greater value (e.g. 2 or 3) means that many
-more of them will be allocated. A value of 0 doesn't allocate any empty
-records.
-The default value should be OK for most of you.
-
index 4b0507d48ed1017d70a50dfa06506ae7990a021e..7735d25c9f2a90798c8ba92e5a8372205981c5b0 100755 (executable)
--- a/configure
+++ b/configure
@@ -644,8 +644,6 @@ COMPRESS_MANPG
 IGNORE_FILE_ATTRIBUTES
 MAN_GROUP
 man_group
-PREALLOC_FACTOR
-prealloc
 COMPRESSAFTER
 compressafter
 HISTORY
@@ -762,7 +760,6 @@ sa_dir
 conf_dir
 history
 compressafter
-prealloc
 man_group
 cron_owner
 cron_interval
@@ -1412,8 +1409,6 @@ Some influential environment variables:
   compressafter
               number of days after which data files are compressed (default
               value is 10)
-  prealloc    preallocation factor that will determine data files size
-              (default value is 1)
   man_group   group for manual pages
   cron_owner  crontab owner
   cron_interval
@@ -5079,19 +5074,6 @@ fi
 $as_echo "$COMPRESSAFTER" >&6; }
 
 
-# Preallocation factor
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking preallocation factor value" >&5
-$as_echo_n "checking preallocation factor value... " >&6; }
-
-if test x$prealloc = x""; then
-   PREALLOC_FACTOR=1
-else
-   PREALLOC_FACTOR=$prealloc
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PREALLOC_FACTOR" >&5
-$as_echo "$PREALLOC_FACTOR" >&6; }
-
-
 # Manual page group
 grep ^man: /etc/group >/dev/null 2>&1
 if test $? = 0; then
@@ -5396,8 +5378,6 @@ ac_config_files="$ac_config_files version.h:version.in"
                # File must be renamed
 ac_config_files="$ac_config_files sysconfig.h:sysconfig.in"
        # File must be renamed
-ac_config_files="$ac_config_files prealloc.h:prealloc.in"
-       # File must be renamed
 ac_config_files="$ac_config_files cron/sysstat.cron.daily"
 
 ac_config_files="$ac_config_files cron/sysstat.cron.hourly"
@@ -6148,7 +6128,6 @@ do
     "sysstat.sysconfig") CONFIG_FILES="$CONFIG_FILES sysstat.sysconfig" ;;
     "version.h") CONFIG_FILES="$CONFIG_FILES version.h:version.in" ;;
     "sysconfig.h") CONFIG_FILES="$CONFIG_FILES sysconfig.h:sysconfig.in" ;;
-    "prealloc.h") CONFIG_FILES="$CONFIG_FILES prealloc.h:prealloc.in" ;;
     "cron/sysstat.cron.daily") CONFIG_FILES="$CONFIG_FILES cron/sysstat.cron.daily" ;;
     "cron/sysstat.cron.hourly") CONFIG_FILES="$CONFIG_FILES cron/sysstat.cron.hourly" ;;
     "cron/sysstat.crond") CONFIG_FILES="$CONFIG_FILES cron/sysstat.crond" ;;
index 2b8566c77ddcdc59ca19ceb36fd4cde590764cc0..877f4533306e2816186ee3f982dc9f26e48fb18d 100644 (file)
@@ -337,17 +337,6 @@ fi
 AC_MSG_RESULT($COMPRESSAFTER)
 AC_SUBST(COMPRESSAFTER)
 
-# Preallocation factor
-AC_MSG_CHECKING(preallocation factor value)
-AC_ARG_VAR([prealloc],[preallocation factor that will determine data files size (default value is 1)])
-if test x$prealloc = x""; then
-   PREALLOC_FACTOR=1
-else
-   PREALLOC_FACTOR=$prealloc
-fi
-AC_MSG_RESULT($PREALLOC_FACTOR)
-AC_SUBST(PREALLOC_FACTOR)
-
 # Manual page group
 grep ^man: /etc/group >/dev/null 2>&1
 if test $? = 0; then
@@ -591,7 +580,6 @@ AC_CONFIG_FILES([cron/crontab:cron/crontab.sample]) # File must be renamed
 AC_CONFIG_FILES([sysstat.sysconfig])
 AC_CONFIG_FILES([version.h:version.in])                # File must be renamed
 AC_CONFIG_FILES([sysconfig.h:sysconfig.in])    # File must be renamed
-AC_CONFIG_FILES([prealloc.h:prealloc.in])      # File must be renamed
 AC_CONFIG_FILES([cron/sysstat.cron.daily])
 AC_CONFIG_FILES([cron/sysstat.cron.hourly])
 AC_CONFIG_FILES([cron/sysstat.crond])
diff --git a/iconfig b/iconfig
index 6cb9519eeac88b35420e59b9a44cc8a0881dacdd..137b2199efa6ce0e9b679a86cd72a9a92762e010 100755 (executable)
--- a/iconfig
+++ b/iconfig
@@ -79,12 +79,6 @@ if [ "${COMPRESSAFTER}" != "" ]; then
        COMPRESSAFTER="compressafter=${COMPRESSAFTER} "
 fi
 
-# Preallocation factor
-PREALLOC_ANSWER=`${ASK} 'Preallocation factor value:' "prealloc" "prealloc"`
-if [ "${PREALLOC_ANSWER}" != "" ]; then
-       PREALLOC_ANSWER="prealloc=${PREALLOC_ANSWER} "
-fi
-
 # Manual page group
 MAN=`${ASK} 'Group for manual pages:' "man_group" "man_group"`
 if [ "${MAN}" != "" ]; then
@@ -202,7 +196,7 @@ fi
 
 echo
 echo -n "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${CLEAN_SA_DIR}${NLS} \
-${HISTORY}${COMPRESSAFTER}${PREALLOC_ANSWER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR}"
+${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR}"
 if [ "${SADC_OPT}" != "" ];
 then
        echo -n "sadc_options=\"${SADC_OPT}\""
@@ -211,7 +205,7 @@ echo "${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS}${STRIP}${COPY_ONLY}"
 echo
 
 ./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${CLEAN_SA_DIR}${NLS} \
-${HISTORY}${COMPRESSAFTER}${PREALLOC_ANSWER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR} \
+${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR} \
 sadc_options="${SADC_OPT}" ${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS} \
 ${STRIP}${COPY_ONLY}
 
diff --git a/prealloc.in b/prealloc.in
deleted file mode 100644 (file)
index 76c81bc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * sysstat: System performance tools for Linux
- * (C) 1999-2017 by Sebastien Godard (sysstat <at> orange.fr)
- */
-
-#ifndef _PREALLOC_H
-#define _PREALLOC_H
-
-/* Preallocation constants for sar */
-#define NR_IFACE_PREALLOC      (2 * @PREALLOC_FACTOR@)
-#define NR_SERIAL_PREALLOC     (2 * @PREALLOC_FACTOR@)
-#define NR_DISK_PREALLOC       (3 * @PREALLOC_FACTOR@)
-#define NR_FREQ_PREALLOC       (0 * @PREALLOC_FACTOR@)
-#define NR_USB_PREALLOC                (5 * @PREALLOC_FACTOR@)
-#define NR_FILESYSTEM_PREALLOC (3 * @PREALLOC_FACTOR@)
-#define NR_FCHOST_PREALLOC     (1 * @PREALLOC_FACTOR@)
-
-#endif  /* _PREALLOC_H */
diff --git a/sa.h b/sa.h
index 73b401ce50b82bb7ed330fb3f6c221ea910c065f..82d19cc1a5df8bbfd720cb5a070cff37727d75c2 100644 (file)
--- a/sa.h
+++ b/sa.h
@@ -9,7 +9,6 @@
 #include <stdio.h>
 
 #include "common.h"
-#include "prealloc.h"
 #include "rd_stats.h"
 #include "rd_sensors.h"
 
index 79020a2bca89080ec75b7f45146a301a7f68f2d2..f1266036e3177ccbac886e8b15e90444a17b8571 100644 (file)
--- a/sa_wrap.c
+++ b/sa_wrap.c
@@ -956,8 +956,8 @@ __nr_t wrap_get_irq_nr(struct activity *a)
  * @a  Activity structure.
  *
  * RETURNS:
- * Number of serial lines supporting tx/rx accouting + a pre-allocation
- * constant. Number cannot exceed MAX_NR_SERIAL_LINES.
+ * Number of serial lines supporting tx/rx accouting.
+ * Number cannot exceed MAX_NR_SERIAL_LINES.
  ***************************************************************************
  */
 __nr_t wrap_get_serial_nr(struct activity *a)
@@ -965,10 +965,10 @@ __nr_t wrap_get_serial_nr(struct activity *a)
        __nr_t n = 0;
 
        if ((n = get_serial_nr()) > 0) {
-               if ((n + NR_SERIAL_PREALLOC) > MAX_NR_SERIAL_LINES)
+               if (n > MAX_NR_SERIAL_LINES)
                        return MAX_NR_SERIAL_LINES;
                else
-                       return n + NR_SERIAL_PREALLOC;
+                       return n;
        }
 
        return 0;
@@ -983,8 +983,7 @@ __nr_t wrap_get_serial_nr(struct activity *a)
  * @a  Activity structure.
  *
  * RETURNS:
- * Number of network interfaces + a pre-allocation constant. Number cannot
- * exceed MAX_NR_IFACES.
+ * Number of network interfaces. Number cannot exceed MAX_NR_IFACES.
  ***************************************************************************
  */
 __nr_t wrap_get_iface_nr(struct activity *a)
@@ -992,10 +991,10 @@ __nr_t wrap_get_iface_nr(struct activity *a)
        __nr_t n = 0;
 
        if ((n = get_iface_nr()) > 0) {
-               if ((n + NR_IFACE_PREALLOC) > MAX_NR_IFACES)
+               if (n > MAX_NR_IFACES)
                        return MAX_NR_IFACES;
                else
-                       return n + NR_IFACE_PREALLOC;
+                       return n;
        }
 
        return 0;
@@ -1030,8 +1029,7 @@ __nr_t wrap_get_cpu_nr(struct activity *a)
  * @a  Activity structure.
  *
  * RETURNS:
- * Number of devices + a pre-allocation constant. Number cannot exceed
- * MAX_NR_DISKS.
+ * Number of devices. Number cannot exceed MAX_NR_DISKS.
  ***************************************************************************
  */
 __nr_t wrap_get_disk_nr(struct activity *a)
@@ -1040,10 +1038,10 @@ __nr_t wrap_get_disk_nr(struct activity *a)
        unsigned int f = COLLECT_PARTITIONS(a->opt_flags);
 
        if ((n = get_disk_nr(f)) > 0) {
-               if ((n + NR_DISK_PREALLOC) > MAX_NR_DISKS)
+               if (n > MAX_NR_DISKS)
                        return MAX_NR_DISKS;
                else
-                       return n + NR_DISK_PREALLOC;
+                       return n;
        }
 
        return 0;
@@ -1120,7 +1118,7 @@ __nr_t wrap_get_in_nr(struct activity *a)
  * @a   Activity structure.
  *
  * RETURNS:
- * Number of CPU frequencies + a pre-allocation constant.
+ * Number of CPU frequencies.
  ***************************************************************************
  */
 __nr_t wrap_get_freq_nr(struct activity *a)
@@ -1128,7 +1126,7 @@ __nr_t wrap_get_freq_nr(struct activity *a)
        __nr_t n = 0;
 
        if ((n = get_freq_nr()) > 0)
-               return n + NR_FREQ_PREALLOC;
+               return n;
 
        return 0;
 }
@@ -1141,20 +1139,18 @@ __nr_t wrap_get_freq_nr(struct activity *a)
  * @a  Activity structure.
  *
  * RETURNS:
- * Number of USB devices + a pre-allocation constant. Number cannot exceed
- * MAX_NR_USB.
+ * Number of USB devices. Number cannot exceed MAX_NR_USB.
  ***************************************************************************
  */
 __nr_t wrap_get_usb_nr(struct activity *a)
 {
        __nr_t n = 0;
 
-       if ((n = get_usb_nr()) >= 0) {
-               /* Return a positive number even if no USB devices have been found */
-               if ((n + NR_USB_PREALLOC) > MAX_NR_USB)
+       if ((n = get_usb_nr()) > 0) {
+               if (n > MAX_NR_USB)
                        return MAX_NR_USB;
                else
-                       return n + NR_USB_PREALLOC;
+                       return n;
        }
 
        return 0;
@@ -1169,8 +1165,7 @@ __nr_t wrap_get_usb_nr(struct activity *a)
  * @a  Activity structure.
  *
  * RETURNS:
- * Number of filesystems + a pre-allocation constant. Number cannot exceed
- * MAX_NR_FS.
+ * Number of filesystems. Number cannot exceed MAX_NR_FS.
  ***************************************************************************
  */
 __nr_t wrap_get_filesystem_nr(struct activity *a)
@@ -1178,10 +1173,10 @@ __nr_t wrap_get_filesystem_nr(struct activity *a)
        __nr_t n = 0;
 
        if ((n = get_filesystem_nr()) > 0) {
-               if ((n + NR_FILESYSTEM_PREALLOC) > MAX_NR_FS)
+               if (n > MAX_NR_FS)
                        return MAX_NR_FS;
                else
-                       return n + NR_FILESYSTEM_PREALLOC;
+                       return n;
        }
 
        return 0;
@@ -1195,20 +1190,18 @@ __nr_t wrap_get_filesystem_nr(struct activity *a)
  * @a  Activity structure.
  *
  * RETURNS:
- * Number of FC hosts + a pre-allocation constant. Number cannot exceed
- * MAX_NR_FCHOSTS.
+ * Number of FC hosts. Number cannot exceed MAX_NR_FCHOSTS.
  ***************************************************************************
  */
 __nr_t wrap_get_fchost_nr(struct activity *a)
 {
        __nr_t n = 0;
 
-       if ((n = get_fchost_nr()) >= 0) {
-               /* Return a positive number even if no FC hosts have been found */
-               if ((n + NR_FCHOST_PREALLOC) > MAX_NR_FCHOSTS)
+       if ((n = get_fchost_nr()) > 0) {
+               if (n > MAX_NR_FCHOSTS)
                        return MAX_NR_FCHOSTS;
                else
-                       return n + NR_FCHOST_PREALLOC;
+                       return n;
        }
 
        return 0;
diff --git a/sadf.c b/sadf.c
index c559f57ee530464aa146d965911a169d4aa328eb..306f65d74b51c8fe1ec44c74312e521503fd102b 100644 (file)
--- a/sadf.c
+++ b/sadf.c
@@ -437,8 +437,7 @@ time_t get_time_ref(void)
  * Each activity selected may have several views. Moreover we have to take
  * into account volatile activities (eg. CPU) for which the number of views
  * will depend on the highest number of items (eg. maximum number of CPU)
- * saved in the file. This number may be higher than the real number of views
- * that will be displayed since some items have a preallocation constant.
+ * saved in the file.
  *
  * IN:
  * @ifd                        File descriptor of input file.