lib/libc/db/mpool/mpool.c
void
mpool_stat(MPOOL *mp)
{
	BKT *bp;
	int cnt;
	char *sep;

	fprintf(stderr, "%u pages in the file\n", mp->npages);
	fprintf(stderr,
	    "page size %lu, caching %u pages of %u page max cache\n",
	    mp->pagesize, mp->curcache, mp->maxcache);
	fprintf(stderr, "%lu page puts, %lu page gets, %lu page new\n",
	    mp->pageput, mp->pageget, mp->pagenew);
	fprintf(stderr, "%lu page allocs, %lu page flushes\n",
	    mp->pagealloc, mp->pageflush);
	if (mp->cachehit + mp->cachemiss)
		fprintf(stderr,
		    "%.0f%% cache hit rate (%lu hits, %lu misses)\n", 
		    ((double)mp->cachehit / (mp->cachehit + mp->cachemiss))
		    * 100, mp->cachehit, mp->cachemiss);
	fprintf(stderr, "%lu page reads, %lu page writes\n",
	    mp->pageread, mp->pagewrite);

	sep = "";
	cnt = 0;
	TAILQ_FOREACH(bp, &mp->lqh, q) {
		fprintf(stderr, "%s%d", sep, bp->pgno);
		if (bp->flags & MPOOL_DIRTY)
			fprintf(stderr, "d");
		if (bp->flags & MPOOL_PINNED)
			fprintf(stderr, "P");
		if (++cnt == 10) {
			sep = "\n";
			cnt = 0;
		} else
			sep = ", ";
			
	}
	fprintf(stderr, "\n");
}
/*
 * mpool_stat
 *	Print out cache statistics.
 */
mpool_stat
Print out cache statistics.
mpool_stat Print out cache statistics .
void
mpool_stat(MPOOL *mp)
{
	BKT *bp;
	int cnt;
	char *sep;
	fprintf(stderr, "%u pages in the file\n", mp->npages);
	fprintf(stderr,
	    "page size %lu, caching %u pages of %u page max cache\n",
	    mp->pagesize, mp->curcache, mp->maxcache);
	fprintf(stderr, "%lu page puts, %lu page gets, %lu page new\n",
	    mp->pageput, mp->pageget, mp->pagenew);
	fprintf(stderr, "%lu page allocs, %lu page flushes\n",
	    mp->pagealloc, mp->pageflush);
	if (mp->cachehit + mp->cachemiss)
		fprintf(stderr,
		    "%.0f%% cache hit rate (%lu hits, %lu misses)\n", 
		    ((double)mp->cachehit / (mp->cachehit + mp->cachemiss))
		    * 100, mp->cachehit, mp->cachemiss);
	fprintf(stderr, "%lu page reads, %lu page writes\n",
	    mp->pageread, mp->pagewrite);
	sep = "";
	cnt = 0;
	TAILQ_FOREACH(bp, &mp->lqh, q) {
		fprintf(stderr, "%s%d", sep, bp->pgno);
		if (bp->flags & MPOOL_DIRTY)
			fprintf(stderr, "d");
		if (bp->flags & MPOOL_PINNED)
			fprintf(stderr, "P");
		if (++cnt == 10) {
			sep = "\n";
			cnt = 0;
		} else
			sep = ", ";
	}
	fprintf(stderr, "\n");
}
void mpool_stat ( MPOOL * mp ) { BKT * bp ; int cnt ; char * sep ; fprintf ( stderr , " \n " , mp -> npages ) ; fprintf ( stderr , " \n " , mp -> pagesize , mp -> curcache , mp -> maxcache ) ; fprintf ( stderr , " \n " , mp -> pageput , mp -> pageget , mp -> pagenew ) ; fprintf ( stderr , " \n " , mp -> pagealloc , mp -> pageflush ) ; if ( mp -> cachehit + mp -> cachemiss ) fprintf ( stderr , " \n " , ( ( double ) mp -> cachehit / ( mp -> cachehit + mp -> cachemiss ) ) * 100 , mp -> cachehit , mp -> cachemiss ) ; fprintf ( stderr , " \n " , mp -> pageread , mp -> pagewrite ) ; sep = " " ; cnt = 0 ; TAILQ_FOREACH ( bp , & mp -> lqh , q ) { fprintf ( stderr , " " , sep , bp -> pgno ) ; if ( bp -> flags & MPOOL_DIRTY ) fprintf ( stderr , " " ) ; if ( bp -> flags & MPOOL_PINNED ) fprintf ( stderr , " " ) ; if ( ++ cnt == 10 ) { sep = " \n " ; cnt = 0 ; } else sep = " " ; } fprintf ( stderr , " \n " ) ; }
mpool_stat
      Print out cache statistics.
mpool_stat Print out cache statistics .