Changes so the HZ constant isn't needed any more.
This commit is contained in:
		
							parent
							
								
									37a9ce7275
								
							
						
					
					
						commit
						4c1ac39678
					
				@ -29,6 +29,8 @@
 | 
			
		||||
#include <minix/const.h>
 | 
			
		||||
#include <minix/partition.h>
 | 
			
		||||
#include <minix/u64.h>
 | 
			
		||||
#include <minix/com.h>
 | 
			
		||||
#include <minix/sysinfo.h>
 | 
			
		||||
#include <ibm/partition.h>
 | 
			
		||||
#include <termios.h>
 | 
			
		||||
#include <stdarg.h>
 | 
			
		||||
@ -1582,6 +1584,7 @@ void m_read(int ev, int *biosdrive)
 | 
			
		||||
{
 | 
			
		||||
	int i, mode, n, v;
 | 
			
		||||
	struct part_entry *pe;
 | 
			
		||||
	u32_t system_hz;
 | 
			
		||||
 | 
			
		||||
	if (ev != 'r' || device >= 0) return;
 | 
			
		||||
 | 
			
		||||
@ -1594,7 +1597,11 @@ void m_read(int ev, int *biosdrive)
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	v = 2*HZ;
 | 
			
		||||
	if(getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz) < 0) {
 | 
			
		||||
		fprintf(stderr, "autopart: system hz not found\n");
 | 
			
		||||
		exit(1);
 | 
			
		||||
	}
 | 
			
		||||
	v = 2*system_hz;
 | 
			
		||||
	ioctl(device, DIOCTIMEOUT, &v);
 | 
			
		||||
 | 
			
		||||
	memset(bootblock, 0, sizeof(bootblock));
 | 
			
		||||
 | 
			
		||||
@ -54,6 +54,8 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <minix/config.h>
 | 
			
		||||
#include <minix/com.h>
 | 
			
		||||
#include <minix/sysinfo.h>
 | 
			
		||||
#include <minix/endpoint.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <timers.h>
 | 
			
		||||
@ -295,6 +297,11 @@ char *argv[];
 | 
			
		||||
  char cpu[sizeof(clock_t) * 3 + 1 + 2];
 | 
			
		||||
  struct kinfo kinfo;
 | 
			
		||||
  int s;
 | 
			
		||||
  u32_t system_hz;
 | 
			
		||||
 | 
			
		||||
  if(getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz) < 0) {
 | 
			
		||||
	exit(1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  (void) signal(SIGSEGV, disaster);	/* catch a common crash */
 | 
			
		||||
 | 
			
		||||
@ -385,7 +392,7 @@ char *argv[];
 | 
			
		||||
			sprintf(pid, "%d", buf.ps_pid);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ustime = (buf.ps_utime + buf.ps_stime) / HZ;
 | 
			
		||||
		ustime = (buf.ps_utime + buf.ps_stime) / system_hz;
 | 
			
		||||
		if (ustime < 60 * 60) {
 | 
			
		||||
			sprintf(cpu, "%2lu:%02lu", ustime / 60, ustime % 60);
 | 
			
		||||
		} else
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,8 @@ Created:	June 1995 by Philip Homburg <philip@f-mnx.phicoh.com>
 | 
			
		||||
#include <net/gen/netdb.h>
 | 
			
		||||
#include <net/gen/socket.h>
 | 
			
		||||
#include <minix/queryparam.h>
 | 
			
		||||
#include <minix/com.h>
 | 
			
		||||
#include <minix/sysinfo.h>
 | 
			
		||||
 | 
			
		||||
#include <inet/generic/buf.h>
 | 
			
		||||
#include <inet/generic/clock.h>
 | 
			
		||||
@ -31,6 +33,7 @@ Created:	June 1995 by Philip Homburg <philip@f-mnx.phicoh.com>
 | 
			
		||||
#include <inet/generic/tcp.h>
 | 
			
		||||
#include <inet/generic/tcp_int.h>
 | 
			
		||||
 | 
			
		||||
u32_t system_hz;
 | 
			
		||||
char *prog_name;
 | 
			
		||||
tcp_conn_t tcp_conn_table[TCP_CONN_NR];
 | 
			
		||||
char values[2 * sizeof(tcp_conn_table) + 1];
 | 
			
		||||
@ -50,6 +53,8 @@ int main(int argc, char*argv[])
 | 
			
		||||
	int fl;
 | 
			
		||||
	int a_flag, n_flag, v_flag;
 | 
			
		||||
 | 
			
		||||
	getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz);
 | 
			
		||||
 | 
			
		||||
	(prog_name=strrchr(argv[0], '/')) ? prog_name++ : (prog_name=argv[0]);
 | 
			
		||||
 | 
			
		||||
	a_flag= 0;
 | 
			
		||||
@ -219,7 +224,7 @@ void print_conn(int i, clock_t now)
 | 
			
		||||
				if (tcp_conn->tc_senddis >= now)
 | 
			
		||||
				{
 | 
			
		||||
					printf("(time wait %ld s)",
 | 
			
		||||
						(tcp_conn->tc_senddis-now)/HZ);
 | 
			
		||||
					(tcp_conn->tc_senddis-now)/system_hz);
 | 
			
		||||
				}
 | 
			
		||||
				no_verbose= 1;
 | 
			
		||||
				break;
 | 
			
		||||
@ -263,9 +268,9 @@ void print_conn(int i, clock_t now)
 | 
			
		||||
		tcp_conn->tc_max_mtu-IP_TCP_MIN_HDR_SIZE,
 | 
			
		||||
		tcp_conn->tc_mtu,
 | 
			
		||||
		(tcp_conn->tc_flags & TCF_PMTU) ? "" : " (no PMTU)",
 | 
			
		||||
		rtt/(HZ+0.0),
 | 
			
		||||
		artt/(HZ+0.0)/TCP_RTT_SCALE, TCP_DRTT_MULT,
 | 
			
		||||
		drtt/(HZ+0.0)/TCP_RTT_SCALE);
 | 
			
		||||
		rtt/(system_hz+0.0),
 | 
			
		||||
		artt/(system_hz+0.0)/TCP_RTT_SCALE, TCP_DRTT_MULT,
 | 
			
		||||
		drtt/(system_hz+0.0)/TCP_RTT_SCALE);
 | 
			
		||||
	flags= tcp_conn->tc_flags;
 | 
			
		||||
	printf("\tflags:");
 | 
			
		||||
	if (!flags)
 | 
			
		||||
@ -319,7 +324,7 @@ void print_conn(int i, clock_t now)
 | 
			
		||||
	printf("\n");
 | 
			
		||||
	printf("\ttimer: ref %d, time %f, active %d\n",
 | 
			
		||||
		tcp_conn->tc_transmit_timer.tim_ref,
 | 
			
		||||
		(0.0+tcp_conn->tc_transmit_timer.tim_time-now)/HZ,
 | 
			
		||||
		(0.0+tcp_conn->tc_transmit_timer.tim_time-now)/system_hz,
 | 
			
		||||
		tcp_conn->tc_transmit_timer.tim_active);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -26,6 +26,8 @@
 | 
			
		||||
#include <sys/select.h>
 | 
			
		||||
 | 
			
		||||
#include <minix/ipc.h>
 | 
			
		||||
#include <minix/com.h>
 | 
			
		||||
#include <minix/sysinfo.h>
 | 
			
		||||
#include <minix/config.h>
 | 
			
		||||
#include <minix/type.h>
 | 
			
		||||
#include <minix/const.h>
 | 
			
		||||
@ -35,6 +37,8 @@
 | 
			
		||||
#include "../../kernel/const.h"
 | 
			
		||||
#include "../../kernel/proc.h"
 | 
			
		||||
 | 
			
		||||
u32_t system_hz;
 | 
			
		||||
 | 
			
		||||
#define  TC_BUFFER  1024        /* Size of termcap(3) buffer    */
 | 
			
		||||
#define  TC_STRINGS  200        /* Enough room for cm,cl,so,se  */
 | 
			
		||||
 | 
			
		||||
@ -197,7 +201,7 @@ void print_procs(int maxlines,
 | 
			
		||||
			((pr->p_memmap[T].mem_len + 
 | 
			
		||||
			pr->p_memmap[D].mem_len) << CLICK_SHIFT)/1024);
 | 
			
		||||
		printf("%6s", pr->p_rts_flags ? "" : "RUN");
 | 
			
		||||
		printf(" %3d:%02d ", (ticks/HZ/60), (ticks/HZ)%60);
 | 
			
		||||
		printf(" %3d:%02d ", (ticks/system_hz/60), (ticks/system_hz)%60);
 | 
			
		||||
 | 
			
		||||
		printf("%6.2f%% %s\n",
 | 
			
		||||
			100.0*tick_procs[p].ticks/dt, name);
 | 
			
		||||
@ -306,6 +310,8 @@ int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	int r, c, s = 0, orig;
 | 
			
		||||
 | 
			
		||||
	getsysinfo_up(PM_PROC_NR, SIU_SYSTEMHZ, sizeof(system_hz), &system_hz);
 | 
			
		||||
 | 
			
		||||
	init(&r);
 | 
			
		||||
 | 
			
		||||
	while((c=getopt(argc, argv, "s:")) != EOF) {
 | 
			
		||||
@ -357,4 +363,3 @@ int main(int argc, char *argv[])
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int sys_hz() { return 50; }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user