extern bool inint; /* flag is set whenever interrupts are being serviced */
extern uint8_t ticks_this_dsecond; /* Tick counter for counting off one decisecond */
+extern uint8_t ticks_per_dsecond; /* Ticks per decisecond at machine interrupt rate rate */
extern uint16_t runticks; /* Number of ticks current process has been swapped in */
extern time_t tod; /* Time of day */
bool inint;
uint16_t root_dev;
uint8_t ticks_this_dsecond;
+uint8_t ticks_per_dsecond;
inoptr root;
uint16_t waitno;
time_t tod; // time of day
ticks_t ticks;
-
int16_t acct_fh = -1; /* Accounting file handle */
struct runload loadavg[3] = {
#define VT_RIGHT 79
#define VT_BOTTOM 23
-#define TICKSPERSEC 50 /* Ticks per second (actually should be dynamic FIXME) */
+#define TICKSPERSEC 60 /* default value, it will be upated on device_init */
#define PROGBASE 0x0000 /* also data base */
#define PROGLOAD 0x0100
#define PROGTOP 0xF000 /* Top of program, base of U_DATA */
}
if ((infobits & INTFREQ_MASK) == INTFREQ_60Hz) {
kprintf("60Hz\n");
+ ticks_per_dsecond = 6;
} else {
kprintf("50Hz\n");
+ ticks_per_dsecond = 5;
}
if (megasd_probe()) {
/* Do once-per-decisecond things - this doesn't work out well on
boxes with 64 ticks/second.. need a better approach */
- if (++ticks_this_dsecond == TICKSPERSEC / 10) {
+ if (++ticks_this_dsecond == ticks_per_dsecond) {
static ptptr p;
/* Update global time counters */
create_init();
kputs("Enabling interrupts ... ");
+
+ /* runtime configurable, defaults to build time setting */
+ ticks_per_dsecond = TICKSPERSEC / 10;
+
ei();
kputs("ok.\n");
sysinfo.memk = procmem;
sysinfo.usedk = pagemap_mem_used();
sysinfo.nproc = PTABSIZE;
+ sysinfo.ticks = ticks_per_dsecond * 10;
sysinfo.loadavg[0] = loadavg[0].average;
sysinfo.loadavg[1] = loadavg[1].average;
sysinfo.loadavg[2] = loadavg[2].average;