Monday, November 08, 2010 at 12:04 AM.

system.verbs.builtins.mainResponder.adminSite.macros.serverStats

<<Changes
	<<6/6/02; 4:15:27 PM by JES
		<<If running on MacOS X, use sys.unixShellCommand to get the RAM usage values from the ps command.
	<<4/11/02; 1:05:46 AM by JES
		<<Removed "out of a possible" connection limit text. Added support for actual RAM and VRAM usage on M
local (htmltext = "");
on add (s) {
	htmltext = htmltext + s};
with user.webserver.stats {
	local (uphours = (number (clock.now ()) - number (upsince)) / 3600);
	add ("<b>Up since: " + upsince + " (" + uphours + " hours); " + hits + " hits.</b><br>");
	add ("Domain: " + tcp.dns.getMyDomainName () + "; IP Address: " + tcp.addressDecode (tcp.myAddress ()) + ".<br>");
	bundle { //Frontier 6.1b14; Windows NT; Version: 5.0.2128.
		local (osname = system.environment.osFullNameForDisplay);
		if system.environment.isMac {
			if defined (system.environment.isCarbon) and system.environment.isCarbon {
				osname = "MacOS X"}
			else {
				osname = "MacOS"}};
		add ("Frontier " + Frontier.version () + "; " + osname);
		if defined (system.environment.winServicePackNumber) {
			add (" " + string.trimWhiteSpace (system.environment.winServicePackNumber) + "; ")}; //PBS 11/9/99: fixed white space formatting problem: sometimes winServicePackNumber has no white space, sometimes it does
		add (" version " + system.environment.osVersionString + ".<br> ")};
	add ("Maximum number of connections: " + maxConnections + ".<br>");
	if defined (system.environment.isCarbon) and system.environment.isCarbon { //the way RAM works on MacOS X is totally different
		local (psout = sys.unixShellCommand ("ps -auxww | grep \"" + file.fileFromPath (frontier.getProgramPath ()) + "\"") );
		while psout contains "  " {
			psout = string.replaceAll (psout, "  ", " ")};
		local (memUsage = double (string.nthField (psout, " ", 5)) * 1024);
		local (resident = double (string.nthField (psout, " ", 6)) * 1024);
		add ("Total memory usage: " + string.gigabyteString (memUsage) + "; Resident: " + string.gigabyteString (resident) + ".")}
	else { //original Windows and Mac Classic behavior
		add ("Current memavail: " + string.gigabytestring (memavail ()) + "; "); //PBS 11/9/99: get Frontier's available memory, not the available memory on the system. This makes it consistent with the smallest and largest, which both refer to Frontier's memory
		add ("Smallest: " + string.megabytestring (minMemAvail) + "; ");
		add ("Largest: " + string.megabytestring (maxMemAvail) + ".<br>")}};
return (htmltext)



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.