// StatisticsFrame.java // $Id: StatisticsFrame.java,v 1.5 1998/03/18 10:13:26 bmahe Exp $ // (c) COPYRIGHT MIT and INRIA, 1996. // Please first read the full copyright statement in file COPYRIGHT.html package org.w3c.jigsaw.status ; import java.util.* ; import org.w3c.tools.resources.*; import org.w3c.www.http.*; import org.w3c.jigsaw.frames.*; import org.w3c.jigsaw.http.*; import org.w3c.jigsaw.html.*; /** * This class exports the server statistics. * It makes available a bunch of various parameters about the current * server, and uses the Refresh meta-tag (as the ThreadStat) to * make them redisplay. *
This would benefit from being an applet. */ public class StatisticsFrame extends HTTPFrame { protected static Integer REFRESH_DEFAULT = new Integer(5) ; /** * Attribute index - Our refresh interval. */ protected static int ATTR_REFRESH = -1 ; static { Attribute a = null ; Class cls = null ; try { cls = Class.forName("org.w3c.jigsaw.status.StatisticsFrame"); } catch (Exception ex) { ex.printStackTrace() ; System.exit(1) ; } // The refresh interval attribute: a = new IntegerAttribute("refresh" , new Integer(5) , Attribute.EDITABLE) ; ATTR_REFRESH = AttributeRegistry.registerAttribute(cls, a) ; } static String time_tbl = ("
Request processing times:" + "
min" + " | avg" + " | max" + " | ||||||
---|---|---|---|---|---|---|---|---|
free" + " | idle" + " | total" + " |
---|---|---|
" , Long.toString(stats.getMinRequestTime()) , " ms") ; g.append(" | " , Long.toString(stats.getMeanRequestTime()) , " ms") ; g.append(" | " , Long.toString(stats.getMaxRequestTime()) , " ms"); g.append(" |
Current load:"+stats.getServerLoad()); Reply reply = request.makeReply(HTTP.OK) ; reply.setStream (g) ; return reply ; } }