You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/04/08 21:37:02 UTC
svn commit: r392596 - in
/geronimo/branches/1.1/applications/console-standard/src:
java/org/apache/geronimo/console/jsr77/ webapp/WEB-INF/view/infomanager/
webapp/graphs/
Author: ammulder
Date: Sat Apr 8 12:37:00 2006
New Revision: 392596
URL: http://svn.apache.org/viewcvs?rev=392596&view=rev
Log:
Try the "Information" page of the console in Firefox now
Added:
geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/
geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphJS.jsp (with props)
geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphSVG.jsp (with props)
geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/updatingGraphJS.jsp (with props)
Modified:
geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java
geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/infomanager/svrInfoNormal.jsp
Modified: geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java?rev=392596&r1=392595&r2=392596&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java (original)
+++ geronimo/branches/1.1/applications/console-standard/src/java/org/apache/geronimo/console/jsr77/DynamicServerInfo.java Sat Apr 8 12:37:00 2006
@@ -37,6 +37,7 @@
private String memoryMost;
private String memoryAllocated;
private String upTime;
+ private long bytesCurrent;
public DynamicServerInfo(long upTime) {
this.upTime = calculateTime(upTime);
@@ -46,6 +47,7 @@
public DynamicServerInfo(long memoryCurrent, long memoryMost, long memoryAllocated, long upTime) {
dec2Format = NumberFormat.getNumberInstance();
dec2Format.setMaximumFractionDigits(2);
+ bytesCurrent = memoryCurrent;
this.memoryCurrent = calculateMemory(memoryCurrent);
this.memoryMost = calculateMemory(memoryMost);
this.memoryAllocated = calculateMemory(memoryAllocated);
@@ -115,5 +117,9 @@
public String getUpTime() {
return upTime;
+ }
+
+ public long getBytesCurrent() {
+ return bytesCurrent;
}
}
Modified: geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/infomanager/svrInfoNormal.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/infomanager/svrInfoNormal.jsp?rev=392596&r1=392595&r2=392596&view=diff
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/infomanager/svrInfoNormal.jsp (original)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/WEB-INF/view/infomanager/svrInfoNormal.jsp Sat Apr 8 12:37:00 2006
@@ -130,3 +130,5 @@
<portlet:namespace/>callServer();
</script>
+<embed src="/console-standard/graphs/memoryGraphSVG.jsp"
+ width="600" height="450" type="image/svg+xml" />
Added: geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphJS.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphJS.jsp?rev=392596&view=auto
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphJS.jsp (added)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphJS.jsp Sat Apr 8 12:37:00 2006
@@ -0,0 +1,31 @@
+<%@ page contentType="text/javascript" %>
+var last = false;
+function addNext() {
+ if(last) {
+ addPoint(200);
+ last=false;
+ } else {
+ addPoint(50);
+ last=true;
+ }
+ setTimeout("addNext()", 500);
+}
+
+DWREngine.setErrorHandler(null);
+var stopped=false;
+function callServer() {
+ metadata = {};
+ metadata.callback=updateValues;
+ metadata.errorHandler=onError;
+ Jsr77Stats.getJavaVMStatistics(metadata);
+}
+function updateValues(serverStats) {
+ addPoint(serverStats.bytesCurrent, serverStats.memoryCurrent);
+ if(!stopped) {
+ setTimeout("callServer()", 1000);
+ }
+}
+function onError() {
+ stopped=true;
+// DWRUtil.setValue("<portlet:namespace/>ErrorArea", '<form name="<portlet:namespace/>Refresh" action="<portlet:actionURL/>"><input type="submit" value="Refresh"/></form>');
+}
Propchange: geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphJS.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphSVG.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphSVG.jsp?rev=392596&view=auto
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphSVG.jsp (added)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphSVG.jsp Sat Apr 8 12:37:00 2006
@@ -0,0 +1,11 @@
+<%@ page contentType="image/svg+xml" %>
+<svg width="100%" height="100%"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ onload="initialize(evt, 480, 300, 'callServer()', 'Server Memory Usage')">
+ <script type="text/ecmascript" xlink:href="updatingGraphJS.jsp"/>
+ <script type="text/ecmascript" xlink:href="memoryGraphJS.jsp"/>
+ <script type='text/ecmascript' xlink:href='../dwr/interface/Jsr77Stats.js' />
+ <script type='text/ecmascript' xlink:href='../dwr/engine.js' />
+ <script type='text/ecmascript' xlink:href='../dwr/util.js' />
+</svg>
\ No newline at end of file
Propchange: geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/memoryGraphSVG.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/updatingGraphJS.jsp
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/updatingGraphJS.jsp?rev=392596&view=auto
==============================================================================
--- geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/updatingGraphJS.jsp (added)
+++ geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/updatingGraphJS.jsp Sat Apr 8 12:37:00 2006
@@ -0,0 +1,146 @@
+<%@ page contentType="text/javascript" %>
+// =============== Infrastructure ==============
+// SVG namespace
+var svgNS = "http://www.w3.org/2000/svg";
+// the SVG document
+var graphDocument = null;
+// The main <g> element that groups all graph elements
+var graphGroup = null;
+// The selected point
+var selectedPoint = null;
+// All points
+var allPoints = new Array(60);
+// The path through all of the points
+var dataPath = null;
+// The space to the left of the graph
+var xOffset = 100;
+// The space above the graph
+var yOffset = 50;
+// The height of the graph
+var graphHeight;
+// The length of the graph
+var graphLength;
+
+// =============== Runtime Data ==============
+// Data
+var data = new Array(60);
+// Y-Max
+var yMax = 1;
+// Y Caption
+var yCaption = null;
+
+/** Saved bootstrap reference **/
+function initialize(evt, length, height, updater, caption) {
+ // Get the document
+ graphDocument = evt.target.ownerDocument;
+ renderChart(length, height, updater, caption);
+}
+
+/** Sets up the initial objects and draws the chart **/
+function renderChart(length, height, updater, captionText) {
+ graphLength = length;
+ graphHeight = height;
+ for(var i=0; i<data.length; i++) {
+ data[i] = 0;
+ }
+
+ // Create the group
+ graphGroup = graphDocument.createElementNS(svgNS, "g");
+
+ // Create the caption
+ var caption = graphDocument.createElementNS(svgNS, "text");
+ caption.setAttribute("x", (xOffset+length)/2);
+ caption.setAttribute("y", 20);
+ caption.setAttribute("text-anchor", "middle");
+ caption.appendChild(graphDocument.createTextNode(captionText));
+ graphGroup.appendChild(caption);
+
+ // Create the axes
+ var axisGroup = graphDocument.createElementNS(svgNS, "g");
+ // create the X axis line as a <path> element
+ var axisPath = graphDocument.createElementNS(svgNS, "path");
+ // X axis line settings
+ axisPath.setAttribute("stroke", "black");
+ axisPath.setAttribute("stroke-width", "2");
+ axisPath.setAttribute("fill", "none");
+ axisPath.setAttribute("d", "M "+xOffset+" "+yOffset+" L "+xOffset+" "+(yOffset+graphHeight)+" L "+(xOffset+graphLength)+" "+(yOffset+graphHeight));
+ axisGroup.appendChild(axisPath);
+ var topY = graphDocument.createElementNS(svgNS, "text");
+ topY.setAttribute("x", 1);
+ topY.setAttribute("y", yOffset+10);
+ yCaption = graphDocument.createTextNode("Max MB");
+ topY.appendChild(yCaption);
+ axisGroup.appendChild(topY);
+ // Done with axes
+ graphGroup.appendChild(axisGroup);
+
+ // Create the points
+ for(var i=0; i<allPoints.length; i++) {
+ allPoints[i] = graphDocument.createElementNS(svgNS, "circle");
+ allPoints[i].setAttribute("cx", xOffset+(i*graphLength/(data.length-1)));
+ allPoints[i].setAttribute("cy", yOffset+graphHeight);
+ allPoints[i].setAttribute("r", 2);
+ allPoints[i].setAttribute("fill", "blue");
+ }
+
+ // Create the data path
+ dataPath = graphDocument.createElementNS(svgNS, "path");
+ dataPath.setAttribute("stroke", "black");
+ dataPath.setAttribute("stroke-width", "1");
+ dataPath.setAttribute("fill", "none");
+
+ // add the data path to the chart group
+ graphGroup.appendChild(dataPath);
+ // add the points on top of the data path
+ for(var i = 0; i < allPoints.length; i++) {
+ graphGroup.appendChild(allPoints[i]);
+ }
+
+ // Render initial data
+ syncPoints();
+ setPathDef();
+
+ graphDocument.documentElement.appendChild(graphGroup);
+ setTimeout(updater, 100);
+}
+
+/** Updates the points to the most current data **/
+function syncPoints() {
+// for(var i = 0; i < data.length; i++) {
+// if(data[i] > yMax) {
+// yMax = data[i] * 1.3;
+// }
+// }
+ var bottom = yOffset+graphHeight;
+ var ratio = graphHeight/yMax;
+ for(var i = 0; i < data.length; i++) {
+ allPoints[i].setAttribute("cy", bottom-(data[i]*ratio));
+ }
+}
+
+/** Updates the path to go through all the points **/
+function setPathDef() {
+ var pathDef = "";
+ for(var i = 0; i < allPoints.length; i++) {
+ if(pathDef == "") {
+ pathDef += "M "+allPoints[i].getAttribute("cx")+" "+allPoints[i].getAttribute("cy");
+ } else {
+ pathDef += "L "+allPoints[i].getAttribute("cx")+" "+allPoints[i].getAttribute("cy");
+ }
+ }
+ dataPath.setAttribute("d", pathDef);
+}
+
+/** Adds a data point **/
+function addPoint(value, text) {
+ for(var i=0; i<data.length-1; i++) {
+ data[i] = data[i+1];
+ }
+ data[data.length-1] = value
+ if(value > yMax) {
+ yMax = value;
+ yCaption.data = text;
+ }
+ syncPoints();
+ setPathDef();
+}
Propchange: geronimo/branches/1.1/applications/console-standard/src/webapp/graphs/updatingGraphJS.jsp
------------------------------------------------------------------------------
svn:eol-style = native