From: Massimo Ianigro <massimo () area ! BA ! CNR ! IT>
To: tru64-unix-managers
Subject: Autonice 0.3 and OSF/1 3.x . Problem with cputime detection...
Date: Fri, 05 May 1995 19:10:08 +0000 [thread overview]
Message-ID: <96075319906436.tru64-unix-managers.marc@archive.invalid> (raw)
hi managers,
i have just upgraded from OSF/1 3.0 to 3.2 and i have found a little
bug in autonice version 0.3
When it runs under OSF/1 3.x (x>0) it doesn't correctly recognize
that cputime is espressed in milliseconds instead of seconds and so
it reduces priorities also for processes that have a few milliseconds
of run. The result is that almost processes active get reniced, including
cshells and so on...
The problem is the following:
in osf 3.0 timing is espressed in milliseconds and there was in
autonice.c a strcmp between the result coming from uname() and the string "3.0"
This method i successful with OSF/1 3.0 but doesn't work if the version
is 3.2 or later...
now the little hack is the following:
the strcmp has been replaced with a conversion from alphanumeric to float
of the field uts.release and a check of the condition (version >= 3.0)...
furthermore in daemon.log appears also the name of the program reniced.I
find very useful to know what have been reniced, just to check that everything
works well.
For those who can be interested, the patch is at the end of my mail.
Also a complete kit for autonice can be found at:
http://www.ba.cnr.it/ftp_area/pub/users/massimo
ciao,
Massimo
--
--------------------------------------------------------------------
| Massimo Ianigro | E-write at : Massimo.Ianigro@ba.cnr.it |
| C . N . R . | URL: http://www.ba.cnr.it/~massimo |
| Via Amendola, 166/5 | Phone: 39 80 5482176/80/30/00 |
| 70126 BARI ITALY | Fax : 39 80 5484467 |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Humility is the ability to act embarressed |
| while telling others how great you are |
--------------------------------------------------------------------
*** autonice.c Fri May 05 20:45:51 1995
--- new-autonice.c Fri May 05 20:42:27 1995
***************
*** 5,10 ****
--- 5,17 ----
* (C) R.P.Bellis 1993
*
* $Log: autonice.c,v $
+ *
+ * Revision 0.3.something 1995/05/05 20:26 Massimo Ianigro massimo@ba.cnr.it
+ * Adjusted the detection of OSF/1. Now check also for versions greater than
+ * 3.0
+ * Messages in syslog show also the name of executable reniced
+ *
+ *
* Revision 0.3 1994/11/22 12:51:01 rpb
* Opened /proc entry read-only instead of read/write
* Adjusted time to cope with millisecond timings under DEC OSF/1 V3.0
***************
*** 61,66 ****
--- 68,74 ----
struct utsname uts;
int osf1;
int millisec_time;
+ float os_release;
DIR *dirp;
/* Read system type */
***************
*** 69,77 ****
return EXIT_FAILURE;
}
! /* Detect OSF/1 v3.0 */
osf1 = !strcmp(uts.sysname, "OSF1");
! millisec_time = osf1 && !strncmp(&uts.release[1], "3.0", 3);
/* Fork as a daemon */
if (daemon(0, 0) == -1) {
--- 77,86 ----
return EXIT_FAILURE;
}
! /* Detect OSF/1 v3.0 (or more... -Massimo Ianigro: massimo@ba.cnr.it- */
osf1 = !strcmp(uts.sysname, "OSF1");
! os_release = atof( &uts.release[1]) ;
! millisec_time = osf1 && (os_release >= 3.0);
/* Fork as a daemon */
if (daemon(0, 0) == -1) {
***************
*** 163,168 ****
--- 172,178 ----
/* Is the priority already correct */
if (p >= np) continue;
+
/* Actually change the priority and report on success */
if (setpriority(PRIO_PROCESS, ps.pr_pid, np) == -1) {
syslog(LOG_ERR,
***************
*** 170,177 ****
ps.pr_pid);
} else {
syslog(LOG_INFO,
! "setting priority for PID %d to %d",
! ps.pr_pid, np);
}
}
--- 180,187 ----
ps.pr_pid);
} else {
syslog(LOG_INFO,
! "setting priority for PID %d(%s) to %d",
! ps.pr_pid, ps.pr_fname, np);
}
}
next reply other threads:[~1995-05-05 19:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-05-05 19:10 Massimo Ianigro [this message]
-- strict thread matches above, loose matches on Subject: below --
1995-05-06 12:54 Autonice 0.3 and OSF/1 3.x . Problem with cputime detection Ray Bellis
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox