~kris/9p

9hist

259508b31ab4b2d7151d38dfaf6262d87977f807 — David du Colombier 27 years ago ea3abbf
Plan 9 from Bell Labs 1998-11-07
1 files changed, 16 insertions(+), 0 deletions(-)

M port/segment.c
M port/segment.c => port/segment.c +16 -0
@@ 296,16 296,26 @@ found:
	return i;
}

static struct {
	int	calls;			/* times imagereclaim was called */
	int	loops;			/* times the main loop was run */
	uvlong	ticks;			/* total time in the main loop */
	uvlong	maxt;			/* longest time in main loop */
} irstats;

static void
imagereclaim(void)
{
	Page *p;
	uvlong ticks;

	irstats.calls++;
	/* Somebody is already cleaning the page cache */
	if(!canqlock(&imagealloc.ireclaim))
		return;

	lock(&palloc);
	ticks = fastticks(nil);
	for(p = palloc.head; p; p = p->next) {
		if(p->ref == 0 && p->image && canlock(p)) {
			if(p->ref == 0)


@@ 313,7 323,13 @@ imagereclaim(void)
			unlock(p);
		}
	}
	ticks = fastticks(nil) - ticks;
	unlock(&palloc);
	irstats.loops++;
	irstats.ticks += ticks;
	if(ticks > irstats.maxt)
		irstats.maxt = ticks;
	//print("T%llud+", ticks);
	qunlock(&imagealloc.ireclaim);
}