tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* Re: Autonice 0.3 and OSF/1 3.x . Problem with cputime detection...
@ 1995-05-06 12:54 Ray Bellis
  0 siblings, 0 replies; 2+ messages in thread
From: Ray Bellis @ 1995-05-06 12:54 UTC (permalink / raw)
  To: tru64-unix-managers

Thanks for the patch, I'd previously assumed that the millisecond timing
in v3.0 was a quirk which might be fixed later.  I'd already made an
unreleased patch to put the process name in syslog.

I'll incorporate these patches and release an official version 0.4
early next week.  When it's available it will be in:

  ftp://ftp.mrc-bbc.ox.ac.uk/pub/dec_alpha/autonice-0.4.tar.gz

Ray.

ps, glad to see people using my program, if people have suggestions for
improvements please let me know.

^ permalink raw reply	[flat|nested] 2+ messages in thread
* Autonice 0.3 and OSF/1 3.x .  Problem with cputime detection...
@ 1995-05-05 19:10 Massimo Ianigro
  0 siblings, 0 replies; 2+ messages in thread
From: Massimo Ianigro @ 1995-05-05 19:10 UTC (permalink / raw)
  To: tru64-unix-managers

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);
  			}
  		}
  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-05-06 12:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-05-06 12:54 Autonice 0.3 and OSF/1 3.x . Problem with cputime detection Ray Bellis
  -- strict thread matches above, loose matches on Subject: below --
1995-05-05 19:10 Massimo Ianigro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox