optimize portclock. unused stats cost ~100 cycles/tick/processor (about 8-10%) on an 8 core machine. Reference: /n/atom/patch/applied2013/portclockopt Date: Sat Dec 28 16:55:21 CET 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/port/portfns.h Sat Dec 28 16:48:24 2013 +++ /sys/src/nix/port/portfns.h Sat Dec 28 16:48:24 2013 @@ -351,7 +351,7 @@ void sysprocsetup(Proc*); void timeradd(Timer*); void timerdel(Timer*); -void timerintr(Ureg*, vlong); +void timerintr(Ureg*, void*); void timerset(uvlong); void timersinit(void); ulong tk2ms(ulong); --- /sys/src/nix/port/portclock.c Sat Dec 28 16:48:25 2013 +++ /sys/src/nix/port/portclock.c Sat Dec 28 16:48:26 2013 @@ -14,9 +14,6 @@ static Timers timers[MACHMAX]; -ulong intrcount[MACHMAX]; -ulong fcallcount[MACHMAX]; - static vlong tadd(Timers *tt, Timer *nt) { @@ -182,14 +179,13 @@ } void -timerintr(Ureg *u, vlong) +timerintr(Ureg *u, void*) { Timer *t; Timers *tt; vlong when, now; int callhzclock; - intrcount[m->machno]++; callhzclock = 0; tt = &timers[m->machno]; now = fastticks(nil); @@ -212,7 +208,6 @@ tt->head = t->tnext; assert(t->tt == tt); t->tt = nil; - fcallcount[m->machno]++; iunlock(tt); if(t->tf) (*t->tf)(u, t); --- /sys/src/nix/k10/lapic.c Sat Dec 28 16:48:27 2013 +++ /sys/src/nix/k10/lapic.c Sat Dec 28 16:48:27 2013 @@ -249,12 +249,6 @@ lapicdump0(xlapic + i, i); } -static void -apictimer(Ureg* ureg, void*) -{ - timerintr(ureg, 0); -} - int lapiconline(void) { @@ -380,9 +374,8 @@ */ microdelay((TK2MS(1)*1000/lapmachno) * m->machno); lapicrput(Tic, apic->max); - if(apic->machno == 0) - intrenable(IdtTIMER, apictimer, 0, -1, "APIC timer"); + intrenable(IdtTIMER, timerintr, nil, -1, "APIC timer"); lapicrput(Tlvt, Periodic|IrqTIMER); if(m->machno == 0) lapicrput(Tp, 0);