psacct/psacct-6.5.1-hzval-fixes2.patch

110 lines
3.5 KiB
Diff

diff -up acct-6.5.1/lastcomm.c.hz acct-6.5.1/lastcomm.c
--- acct-6.5.1/lastcomm.c.hz 2009-09-06 01:39:50.000000000 +0200
+++ acct-6.5.1/lastcomm.c 2009-12-18 15:24:13.000000000 +0100
@@ -43,6 +43,9 @@ MA 02139, USA. */
# include <time.h>
# endif
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include <pwd.h>
@@ -73,6 +76,7 @@ char *program_name; /* name of the prog
int show_paging = 0; /* If they want paging stats, print 'em */
+static unsigned int hzval;
/* Here are various lists for the user to specify entries that they
want to see. */
@@ -100,6 +104,8 @@ int main(int argc, char *argv[])
`-f' or `--file' flag */
int backwards = 1; /* default to reading backwards */
+ hzval = sysconf(_SC_CLK_TCK);
+
program_name = argv[0];
while (1)
@@ -396,7 +402,7 @@ void parse_entries(void)
#ifdef LINUX_MULTIFORMAT
((ut + st) / (double) rec->ac_ahz),
#else
- ((ut + st) / (double) ahz),
+ ((ut + st) / (double) hzval),
#endif
ctime (&btime));
else
@@ -406,7 +412,7 @@ void parse_entries(void)
#ifdef LINUX_MULTIFORMAT
((ut + st) / (double) rec->ac_ahz),
#else
- ((ut + st) / (double) ahz),
+ ((ut + st) / (double) hzval),
#endif
ctime (&btime));
#else
diff -up acct-6.5.1/sa.c.hz acct-6.5.1/sa.c
--- acct-6.5.1/sa.c.hz 2009-09-06 17:54:56.000000000 +0200
+++ acct-6.5.1/sa.c 2009-12-18 15:25:54.000000000 +0100
@@ -253,6 +253,7 @@ int print_all_records = 0; /* don't lump
"***other" category */
int always_yes = 0; /* nonzero means always answer yes to
a query */
+static unsigned int hzval;
/* prototypes */
@@ -281,6 +282,7 @@ int main(int argc, char *argv[])
{
int c;
+ static unsigned int hzval;
program_name = argv[0];
/* Cache the page size of the machine for the PAGES_TO_KB macro */
@@ -598,7 +600,7 @@ int main(int argc, char *argv[])
if (debugging_enabled)
{
- (void)fprintf (stddebug, "AHZ -> %d\n", ahz);
+ (void)fprintf (stddebug, "hzval -> %d\n", hzval);
(void)fprintf (stddebug, "getpagesize() -> %d\n", getpagesize ());
(void)fprintf (stddebug, "system_page_size == %.2f\n", system_page_size);
}
@@ -962,7 +964,7 @@ static void print_stats_nicely (struct s
/* Christoph Badura <bad@flatlin.ka.sub.org> says:
*
* The k*sec statistic is computed as
- * ((ac_utime+ac_stime)*pages_to_kbytes(ac_mem))/AHZ. Of course you
+ * ((ac_utime+ac_stime)*pages_to_kbytes(ac_mem))/hzval. Of course you
* need to expand the comp_t values.
*
* PAGES_TO_KBYTES(x) simply divides x by (getpagesize()/1024). Of
@@ -1176,19 +1178,19 @@ void parse_acct_entries (void)
while ((rec = pacct_get_entry ()) != NULL)
{
#ifdef HAVE_ACUTIME
- double ut = comp_t_2_double (rec->ac_utime) / CURR_AHZ;
+ double ut = comp_t_2_double (rec->ac_utime) / (double) hzval;
#endif
#ifdef HAVE_ACSTIME
- double st = comp_t_2_double (rec->ac_stime) / CURR_AHZ;
+ double st = comp_t_2_double (rec->ac_stime) / (double) hzval;
#endif
#ifdef HAVE_ACETIME
- double et = ACETIME_2_DOUBLE (rec->ac_etime) / CURR_AHZ;
+ double et = comp_t_2_double (rec->ac_etime) / (double) hzval;
#endif
#ifdef HAVE_ACIO
- double di = comp_t_2_double (rec->ac_io) / CURR_AHZ;
+ double di = comp_t_2_double (rec->ac_io) / (double) hzval;
#endif
#ifdef HAVE_ACMEM