[jboss-cvs] JBoss Profiler SVN: r528 - in branches/JBossProfiler2/src/main/org/jboss/profiler/client/web: util and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat May 9 11:44:51 EDT 2009
Author: jesper.pedersen
Date: 2009-05-09 11:44:51 -0400 (Sat, 09 May 2009)
New Revision: 528
Modified:
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java
branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java
Log:
checkstyle fixes
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/BasicOptBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,6 +21,13 @@
*/
package org.jboss.profiler.client.web;
+import org.jboss.profiler.client.SnapshotUtil;
+import org.jboss.profiler.shared.Command;
+import org.jboss.profiler.shared.CommandType;
+import org.jboss.profiler.shared.Snapshot;
+import org.jboss.profiler.shared.SnapshotHelper;
+import org.jboss.profiler.shared.Visibility;
+
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
@@ -28,15 +35,9 @@
import java.util.ArrayList;
import java.util.List;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
-import org.jboss.profiler.client.SnapshotUtil;
-import org.jboss.profiler.shared.Command;
-import org.jboss.profiler.shared.CommandType;
-import org.jboss.profiler.shared.Snapshot;
-import org.jboss.profiler.shared.SnapshotHelper;
-import org.jboss.profiler.shared.Visibility;
-
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
@@ -60,203 +61,319 @@
private String plugin = "org.jboss.profiler.plugins.Hibernate";
private String path = LoadSnapshotBean.class.getResource("/").getFile() + "../../files/";
- private ArrayList<String> interceptClassList = new ArrayList<String>();
- private static ArrayList<Snapshot> snapshotsList = new ArrayList<Snapshot>();
+ private List<String> interceptClassList = new ArrayList<String>();
+ private static List<Snapshot> snapshotsList = new ArrayList<Snapshot>();
private org.jboss.remoting.InvokerLocator locator;
private org.jboss.remoting.Client remotingClient;
-
+
+ /**
+ * Get latest opts
+ * @return The value
+ */
public String getLastestOpts() {
return lastestOpts;
}
+ /**
+ * Set latest opts
+ * @param lastestOpts The value
+ */
public void setLastestOpts(String lastestOpts) {
this.lastestOpts = lastestOpts;
}
+ /**
+ * Get add class
+ * @return The value
+ */
public String getAddClass() {
return addClass;
}
+ /**
+ * Set add class
+ * @param addClass The value
+ */
public void setAddClass(String addClass) {
this.addClass = addClass;
}
+ /**
+ * Get visibility
+ * @return The value
+ */
public String getVisibility() {
return visibility;
}
+ /**
+ * Set visibility
+ * @param visibility The value
+ */
public void setVisibility(String visibility) {
this.visibility = visibility;
}
+ /**
+ * Get remove class
+ * @return The value
+ */
public String getRemoveClass() {
return removeClass;
}
+ /**
+ * Set remove class
+ * @param removeClass The value
+ */
public void setRemoveClass(String removeClass) {
this.removeClass = removeClass;
}
- public ArrayList<String> getInterceptClassList() {
+ /**
+ * Get intercept class list
+ * @return The value
+ */
+ public List<String> getInterceptClassList() {
return interceptClassList;
}
- public void setInterceptClassList(ArrayList<String> interceptClassList) {
+ /**
+ * Set intercept class list
+ * @param interceptClassList The value
+ */
+ public void setInterceptClassList(List<String> interceptClassList) {
this.interceptClassList = interceptClassList;
}
- public static ArrayList<Snapshot> getSnapshotsList() {
+ /**
+ * Get snapshot list
+ * @return The value
+ */
+ public static List<Snapshot> getSnapshotsList() {
return snapshotsList;
}
+ /**
+ * Set snapshot list
+ * @param snapshotsList The value
+ */
public static void setSnapshotsList(ArrayList<Snapshot> snapshotsList) {
BasicOptBean.snapshotsList = snapshotsList;
}
+ /**
+ * Get select snapshot
+ * @return The value
+ */
public String getSelectSnapshot() {
return selectSnapshot;
}
+ /**
+ * Set select snapshot
+ * @param selectSnapshot The value
+ */
public void setSelectSnapshot(String selectSnapshot) {
this.selectSnapshot = selectSnapshot;
}
+ /**
+ * Get save snapshot name
+ * @return The value
+ */
public String getSaveSnapshotName() {
return saveSnapshotName;
}
+ /**
+ * Set save snapshot name
+ * @param saveSnapshotName The value
+ */
public void setSaveSnapshotName(String saveSnapshotName) {
this.saveSnapshotName = saveSnapshotName;
}
+ /**
+ * Get dig threshold
+ * @return The value
+ */
public static double getDigThreshold() {
return digThreshold;
}
+ /**
+ * Set dig threshold
+ * @param digThreshold The value
+ */
public static void setDigThreshold(double digThreshold) {
BasicOptBean.digThreshold = digThreshold;
}
+ /**
+ * Is panels shown
+ * @return The value
+ */
public boolean isPanelShows() {
return panelShows;
}
+ /**
+ * Set panels shown
+ * @param panelShows The value
+ */
public void setPanelShows(boolean panelShows) {
this.panelShows = panelShows;
}
+ /**
+ * Get save echo
+ * @return The value
+ */
public String getSaveEcho() {
return saveEcho;
}
+ /**
+ * Set save echo
+ * @param saveEcho The value
+ */
public void setSaveEcho(String saveEcho) {
this.saveEcho = saveEcho;
}
- public void clickStart() throws Throwable {
+ /**
+ * Click start
+ * @exception Throwable If an error occurs
+ */
+ public void clickStart() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
-
+
remotingClient.connect();
this.connect();
Command cmd = new Command(CommandType.START_PROFILER);
- String response = (String)remotingClient.invoke(cmd);
+ String response = (String)remotingClient.invoke(cmd);
this.setLastestOpts("Profiler has started.");
-
+
remotingClient.disconnect();
}
+ /**
+ * Click stop
+ * @exception Throwable If an error occurs
+ */
public void clickStop() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
remotingClient.connect();
-
+
Command cmd3 = new Command(CommandType.STOP_PROFILER);
- String response = (String)remotingClient.invoke(cmd3);
+ String response = (String)remotingClient.invoke(cmd3);
this.setLastestOpts("Profiler has stopped.");
-
+
remotingClient.disconnect();
}
+ /**
+ * Click enable
+ * @exception Throwable If an error occurs
+ */
public void clickEnable() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
-
+
remotingClient.connect();
-
+
Command cmd1 = new Command(CommandType.ENABLE);
- String response = (String)remotingClient.invoke(cmd1);
+ String response = (String)remotingClient.invoke(cmd1);
this.setLastestOpts("Profiler has enabled.");
-
+
remotingClient.disconnect();
}
+ /**
+ * Click disable
+ * @exception Throwable If an error occurs
+ */
public void clickDisable() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
-
+
remotingClient.connect();
-
+
Command cmd2 = new Command(CommandType.DISABLE);
- String response = (String)remotingClient.invoke(cmd2);
- this.setLastestOpts("Profiler has disabled.");
-
+ String response = (String)remotingClient.invoke(cmd2);
+ this.setLastestOpts("Profiler has disabled.");
+
remotingClient.disconnect();
}
+ /**
+ * GC
+ * @exception Throwable If an error occurs
+ */
public void gc() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
-
+
remotingClient.connect();
this.connect();
- Command cmd = new Command(CommandType.START_PROFILER);
- String response = (String)remotingClient.invoke(cmd);
+ Command cmd = new Command(CommandType.GC);
+ String response = (String)remotingClient.invoke(cmd);
this.setLastestOpts("begins garbage collection.");
-
+
remotingClient.disconnect();
}
+ /**
+ * Take snapshot
+ * @exception Throwable If an error occurs
+ */
public void takeSnapshot() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
-
+
remotingClient.connect();
Command cmd = new Command(CommandType.SNAPSHOT);
-
+
Snapshot snapshot = (Snapshot)remotingClient.invoke(cmd);
if (snapshot != null) {
//SnapshotUtil su = new SnapshotUtil(new Double(threshold).doubleValue());
BasicOptBean.snapshotsList.add(snapshot);
}
-
+
remotingClient.disconnect();
}
+ /**
+ * Clear snapshots
+ * @exception Throwable If an error occurs
+ */
public void clearSnapshot() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
-
+
remotingClient.connect();
Command cmd = new Command(CommandType.CLEAR_SNAPSHOTS);
-
+
String response = (String)remotingClient.invoke(cmd);
this.snapshotsList.clear();
-
+
remotingClient.disconnect();
this.setPanelShows(false);
}
/**
- *
+ * Get snapshots
* @return all the snapshots string from the agent side
- * @throws Throwable
+ * @throws Throwable If an error occurs
*/
public String[] getSnapshots() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
@@ -268,31 +385,42 @@
return snapshots;
}
+ /**
+ * Select snapshot action
+ */
public void selectSnapshotAction() {
this.setPanelShows(true);
}
+ /**
+ * Select save snapshot action
+ * @throws Throwable If an error occurs
+ */
public void selectSaveSnapshotAction() throws Throwable {
String[] snapshots = this.getSnapshots();
int k = 0;
for (int i = 0; i < snapshots.length; i++) {
- if(snapshots[i].equals(this.selectSnapshot))
- k=i;
+ if (snapshots[i].equals(this.selectSnapshot))
+ k = i;
}
- Snapshot selectSnapshot1 =(Snapshot)this.snapshotsList.get(k);
+ Snapshot selectSnapshot1 = (Snapshot)this.snapshotsList.get(k);
try {
- if (this.saveSnapshotName == "")
- SnapshotHelper.save(selectSnapshot1,new File(path+ SnapshotHelper.getName(selectSnapshot1) + ".jps"));
+ if (this.saveSnapshotName == null || this.saveSnapshotName.trim().equals(""))
+ SnapshotHelper.save(selectSnapshot1, new File(path + SnapshotHelper.getName(selectSnapshot1) + ".jps"));
else
- SnapshotHelper.save(selectSnapshot1, new File(path+this.saveSnapshotName));
+ SnapshotHelper.save(selectSnapshot1, new File(path + this.saveSnapshotName));
- this.saveEcho = "snapshot "+this.saveSnapshotName+" is just saved!";
+ this.saveEcho = "snapshot " + this.saveSnapshotName + " is just saved!";
this.saveSnapshotName = "";
} catch (IOException e) {
e.printStackTrace();
}
}
+ /**
+ * Get visibilities
+ * @return The value
+ */
public List<SelectItem> getVisibilities() {
List<SelectItem> allSelectItems = new ArrayList<SelectItem>(4);
allSelectItems.add(new SelectItem("public"));
@@ -302,12 +430,16 @@
return allSelectItems;
}
+ /**
+ * Add class action
+ * @exception Throwable If an error occurs
+ */
public void addClassAction() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
remotingClient.connect();
-
- String clz= this.addClass;
+
+ String clz = this.addClass;
Visibility v = Visibility.PUBLIC;
if (this.visibility.endsWith("private")) {
@@ -318,88 +450,140 @@
v = Visibility.PACKAGE;
}
- Command cmd = new Command(CommandType.ADD_CLASSES, new Object[] { clz, v } );
-
- String response = (String)remotingClient.invoke(cmd);
- //this.setLastestOpts("Profiler has disabled.");
- remotingClient.disconnect();
-
+ Command cmd = new Command(CommandType.ADD_CLASSES, new Object[] {clz, v});
+
+ String response = (String)remotingClient.invoke(cmd);
+ //this.setLastestOpts("Profiler has disabled.");
+ remotingClient.disconnect();
+
listClassAction();
}
+ /**
+ * Remove class action
+ * @exception Throwable If an error occurs
+ */
public void removeClassAction() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
remotingClient.connect();
-
+
String clz = this.removeClass;
- Command cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] { clz } );
-
- String response = (String)remotingClient.invoke(cmd);
+ Command cmd = new Command(CommandType.REMOVE_CLASSES, new Object[] {clz});
+
+ String response = (String)remotingClient.invoke(cmd);
remotingClient.disconnect();
-
+
listClassAction();
}
+ /**
+ * List class action
+ * @exception Throwable If an error occurs
+ */
public void listClassAction() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
remotingClient = new org.jboss.remoting.Client(locator);
remotingClient.connect();
-
- Command cmd = new Command(CommandType.LIST_CLASSES);
-
+
+ Command cmd = new Command(CommandType.LIST_CLASSES);
+
this.interceptClassList.clear();
String[] result = (String[])remotingClient.invoke(cmd);
if (result != null) {
for (int j = 0; j < result.length; j++) {
this.interceptClassList.add(result[j]);
}
- }
+ }
remotingClient.disconnect();
}
+ /**
+ * Get the protocol
+ * @return The value
+ */
public String getProtocol() {
return protocol;
}
-
+
+ /**
+ * Set the protocol
+ * @param protocol The value
+ */
public void setProtocol(String protocol) {
this.protocol = protocol;
}
-
+
+ /**
+ * Get the host
+ * @return The value
+ */
public String getHost() {
return host;
}
-
+
+ /**
+ * Set the host
+ * @param host The value
+ */
public void setHost(String host) {
this.host = host;
}
-
+
+ /**
+ * Get the port
+ * @return The value
+ */
public int getPort() {
return port;
}
-
+
+ /**
+ * Set the port
+ * @param port The value
+ */
public void setPort(int port) {
this.port = port;
}
+ /**
+ * Get the threshold
+ * @return The value
+ */
public String getThreshold() {
return threshold;
}
+ /**
+ * Set the threshold
+ * @param threshold The value
+ */
public void setThreshold(String threshold) {
this.threshold = threshold;
BasicOptBean.setDigThreshold(new Double(threshold).doubleValue());
}
+ /**
+ * Get the plugin
+ * @return The value
+ */
public String getPlugin() {
return plugin;
}
-
+
+ /**
+ * Set the plugin
+ * @param plugin The value
+ */
public void setPlugin(String plugin) {
this.plugin = plugin;
}
+ /**
+ * Get the plugins
+ * @return The value
+ */
public List<SelectItem> getProtocols() {
List<SelectItem> allSelectItems = null;
allSelectItems = new ArrayList<SelectItem>(3);
@@ -408,16 +592,24 @@
allSelectItems.add(new SelectItem("rmi"));
return allSelectItems;
}
-
+
+ /**
+ * Connect
+ * @exception Throwable If an error occurs
+ */
public void connect() throws Throwable {
locator = new org.jboss.remoting.InvokerLocator(this.protocol + "://" + this.host + ":" + this.port);
org.jboss.remoting.Client remotingClient = new org.jboss.remoting.Client(locator);
-
+
remotingClient.connect();
remotingClient.disconnect();
}
-
- public void protocolChanged(javax.faces.event.ValueChangeEvent evt) {
+
+ /**
+ * Protocol changed
+ * @param evt The event
+ */
+ public void protocolChanged(ValueChangeEvent evt) {
String protocol = (String)evt.getNewValue();
if (protocol.endsWith("socket")) {
this.setPort(5400);
@@ -426,7 +618,7 @@
} else {
this.setPort(5402);
}
-
+
this.setProtocol(protocol);
}
}
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ClassBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,24 +21,24 @@
*/
package org.jboss.profiler.client.web;
-import java.io.Serializable;
-import java.text.DecimalFormat;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.jboss.profiler.client.CombinedFrameComparator;
import org.jboss.profiler.client.CombinedFrameInfo;
+import org.jboss.profiler.client.SnapshotUtil;
import org.jboss.profiler.client.TimedClassComparator;
import org.jboss.profiler.client.TimedClassInfo;
import org.jboss.profiler.client.Util;
import org.jboss.profiler.shared.AllocationInfo;
import org.jboss.profiler.shared.Math;
import org.jboss.profiler.shared.Snapshot;
-import org.jboss.profiler.client.SnapshotUtil;
+import java.io.Serializable;
+import java.text.DecimalFormat;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
@@ -48,77 +48,131 @@
private String totalTime;
private String waitTime;
private long allocCount;
- private String selectedClass="";
-
+ private String selectedClass = "";
private Map<String, List<CombinedFrameInfo>> info = null;
private List<TimedClassInfo> classes = null;
-
- //the class info in which the methods will be shown.
- public ClassBean(String className,String type, String totalTime) {
- super();
- this.className = className;
- this.totalTime = totalTime;
- this.type = type;
- this.waitTime = "";
- this.allocCount = -1;
+
+ /**
+ * Constructor
+ */
+ public ClassBean() {
}
-
- public ClassBean(String className,String type, String totalTime,String waitTime, long allocations) {
- super();
+
+ /**
+ * Constructor
+ * @param className The class name
+ * @param type The type
+ * @param totalTime The total time
+ */
+ public ClassBean(String className, String type, String totalTime) {
+ this(className, type, totalTime, "", -1);
+ }
+
+ /**
+ * Constructor
+ * @param className The class name
+ * @param type The type
+ * @param totalTime The total time
+ * @param waitTime The wait time
+ * @param allocations The allocations
+ */
+ public ClassBean(String className, String type, String totalTime, String waitTime, long allocations) {
this.className = className;
this.totalTime = totalTime;
this.type = type;
this.waitTime = waitTime;
this.allocCount = allocations;
}
-
- public ClassBean() {
- super();
- }
-
+
+ /**
+ * Get the class name
+ * @return The value
+ */
public String getClassName() {
return className;
}
-
+
+ /**
+ * Set the class name
+ * @param className The value
+ */
public void setClassName(String className) {
this.className = className;
}
-
+
+ /**
+ * Get the type
+ * @return The value
+ */
public String getType() {
return type;
}
-
+
+ /**
+ * Set the type
+ * @param type The value
+ */
public void setType(String type) {
this.type = type;
}
-
+
+ /**
+ * Get the total time
+ * @return The value
+ */
public String getTotalTime() {
return totalTime;
}
-
+
+ /**
+ * Set the total time
+ * @param totalTime The value
+ */
public void setTotalTime(String totalTime) {
this.totalTime = totalTime;
}
+ /**
+ * Get the wait time
+ * @return The value
+ */
public String getWaitTime() {
return waitTime;
}
-
+
+ /**
+ * Set the wait time
+ * @param waitTime The value
+ */
public void setWaitTime(String waitTime) {
this.waitTime = waitTime;
}
+ /**
+ * Get the allocation count
+ * @return The value
+ */
public long getAllocCount() {
return allocCount;
}
-
+
+ /**
+ * Set the allocation count
+ * @param allocCount The value
+ */
public void setAllocCount(long allocCount) {
this.allocCount = allocCount;
}
+ /**
+ * Get the number of allocations
+ * @param tci The timed class info
+ * @param allocs The allocations
+ * @return The number
+ */
private long getAllocations(TimedClassInfo tci, List<AllocationInfo> allocs) {
String prettyClassName = Util.getPrettyName(tci);
- long alloc = 0;
+ long alloc = 0;
if (allocs != null && allocs.size() > 0) {
boolean found = false;
for (int i = 0; !found && i < allocs.size(); i++) {
@@ -131,16 +185,28 @@
}
return alloc;
}
-
+
+ /**
+ * Get the selected class
+ * @return The value
+ */
public String getSelectedClass() {
return selectedClass;
}
+ /**
+ * Set the selected class
+ * @param selectedClass The value
+ */
public void setSelectedClass(String selectedClass) {
this.selectedClass = selectedClass;
}
- public Set<String> getAjaxRowKeys(){
+ /**
+ * Get the row keys
+ * @return The value
+ */
+ public Set<String> getAjaxRowKeys() {
ClassBean[] clazz = this.getClasses();
Set<String> keys = new HashSet<String>();
for (int i = 0; i < clazz.length; i++) {
@@ -148,18 +214,21 @@
}
return keys;
}
-
+
+ /**
+ * Fire method info
+ */
public void fireMethodsInfo() {
- TimedClassInfo selectedTimedClassInfo = null,tmpTimedClassInfo = null;
+ TimedClassInfo selectedTimedClassInfo = null, tmpTimedClassInfo = null;
String tmpString;
- if (this.classes!=null) {
+ if (this.classes != null) {
for (int i = 0; i < classes.size(); i++) {
tmpTimedClassInfo = (TimedClassInfo)(classes.get(i));
tmpString = tmpTimedClassInfo.getClassName();
//have to replace / with .
tmpString = tmpString.replace('/', '.');
if (this.getSelectedClass().equals(tmpString)) {
- selectedTimedClassInfo=tmpTimedClassInfo;
+ selectedTimedClassInfo = tmpTimedClassInfo;
break;
}
}
@@ -168,7 +237,11 @@
List<CombinedFrameInfo> l = info.get(selectedTimedClassInfo.getClassName());
MethodBean.setCfs(l);
}
-
+
+ /**
+ * Get the class beans
+ * @return The value
+ */
public ClassBean[] getClasses() {
ClassBean[] classBeans = null;
if (LoadSnapshotBean.getSnapshot() != null) {
@@ -176,21 +249,21 @@
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
-
+
this.info = info;
this.classes = classes;
-
+
Collections.sort(classes, new TimedClassComparator(TimedClassComparator.NAME));
-
+
int j = 0;
long tmpCount = 0;
classBeans = new ClassBean[classes.size()];
-
- for (TimedClassInfo tci: classes) {
+
+ for (TimedClassInfo tci : classes) {
tmpCount = this.getAllocations(tci, LoadSnapshotBean.getSnapshot().getAllocations());
- classBeans[j++] = new ClassBean(Util.getPrettyName(tci),Util.getDescription(tci),
- df.format(tci.getTotalTime()), df.format(tci.getWaitTime()),tmpCount);
- }
+ classBeans[j++] = new ClassBean(Util.getPrettyName(tci), Util.getDescription(tci),
+ df.format(tci.getTotalTime()), df.format(tci.getWaitTime()), tmpCount);
+ }
}
return classBeans;
}
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/CompareSnapshotBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,6 +21,13 @@
*/
package org.jboss.profiler.client.web;
+import org.jboss.profiler.client.CombinedFrameComparator;
+import org.jboss.profiler.client.CombinedFrameInfo;
+import org.jboss.profiler.client.SnapshotUtil;
+import org.jboss.profiler.client.TimedClassInfo;
+import org.jboss.profiler.shared.Snapshot;
+import org.jboss.profiler.shared.SnapshotHelper;
+
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
@@ -34,20 +41,12 @@
import javax.faces.model.SelectItem;
-import org.jboss.profiler.client.CombinedFrameComparator;
-import org.jboss.profiler.client.CombinedFrameInfo;
-import org.jboss.profiler.client.TimedClassInfo;
-import org.jboss.profiler.shared.Snapshot;
-import org.jboss.profiler.shared.SnapshotHelper;
-import org.jboss.profiler.client.SnapshotUtil;
-
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
public class CompareSnapshotBean implements Serializable {
private String[] snapshotsToCompare = new String[2];
-
- CompareSnapshotBean[] compareSnapshotBeans;
+ private CompareSnapshotBean[] compareSnapshotBeans;
private String difftime;
private String oTime;
private String nTime;
@@ -56,11 +55,30 @@
private long nCount;
private String methodName;
private String path = LoadSnapshotBean.class.getResource("/").getFile() + "../../files/";
-
+
+ /**
+ * Constructor
+ */
public CompareSnapshotBean() {
}
-
- public CompareSnapshotBean(String difftime,String oTime,String nTime,long diffCount,long oCount,long nCount, String methodName) {
+
+ /**
+ * Constructor
+ * @param difftime The diff time
+ * @param oTime The old time
+ * @param nTime The new time
+ * @param diffCount The diff count
+ * @param oCount The old count
+ * @param nCount The new count
+ * @param methodName The method name
+ */
+ public CompareSnapshotBean(String difftime,
+ String oTime,
+ String nTime,
+ long diffCount,
+ long oCount,
+ long nCount,
+ String methodName) {
this.difftime = difftime;
this.oTime = oTime;
this.nTime = nTime;
@@ -69,76 +87,148 @@
this.nCount = nCount;
this.methodName = methodName;
}
-
+
+ /**
+ * Get the diff time
+ * @return The value
+ */
public String getDifftime() {
return difftime;
}
-
+
+ /**
+ * Set the diff time
+ * @param difftime The value
+ */
public void setDifftime(String difftime) {
this.difftime = difftime;
}
-
+
+ /**
+ * Get the old time
+ * @return The value
+ */
public String getOTime() {
return oTime;
}
-
+
+ /**
+ * Set the old time
+ * @param time The value
+ */
public void setOTime(String time) {
oTime = time;
}
-
+
+ /**
+ * Get the new time
+ * @return The value
+ */
public String getNTime() {
return nTime;
}
-
+
+ /**
+ * Set the new time
+ * @param time The value
+ */
public void setNTime(String time) {
nTime = time;
}
-
+
+ /**
+ * Get the diff count
+ * @return The value
+ */
public long getDiffCount() {
return diffCount;
}
-
+
+ /**
+ * Set the diff count
+ * @param diffCount The value
+ */
public void setDiffCount(long diffCount) {
this.diffCount = diffCount;
}
-
+
+ /**
+ * Get the old count
+ * @return The value
+ */
public long getOCount() {
return oCount;
}
-
+
+ /**
+ * Set the old count
+ * @param count The value
+ */
public void setOCount(long count) {
oCount = count;
}
-
+
+ /**
+ * Get the new count
+ * @return The value
+ */
public long getNCount() {
return nCount;
}
-
+
+ /**
+ * Set the new count
+ * @param count The value
+ */
public void setNCount(long count) {
nCount = count;
}
-
+
+ /**
+ * Get the method name
+ * @return The value
+ */
public String getMethodName() {
return methodName;
}
-
+
+ /**
+ * Set the method name
+ * @param methodName The value
+ */
public void setMethodName(String methodName) {
this.methodName = methodName;
}
-
+
+ /**
+ * Get the compare snapshot beans
+ * @return The value
+ */
public CompareSnapshotBean[] getCompareSnapshotBeans() {
return compareSnapshotBeans;
}
-
+
+ /**
+ * Get the snapshot to compare
+ * @return The value
+ */
public String[] getSnapshotsToCompare() {
return snapshotsToCompare;
}
-
+
+ /**
+ * Set the snapshot to compare
+ * @param snapshotsToCompare The value
+ */
public void setSnapshotsToCompare(String[] snapshotsToCompare) {
this.snapshotsToCompare = snapshotsToCompare;
}
-
- public List<SelectItem> getJPSs(){
+
+ /**
+ * Get the files
+ * @return The value
+ */
+ public List<SelectItem> getJPSs() {
List<SelectItem> allSelectItems = null;
File tempFile = new File(path);
String[] fileStr = tempFile.list();
@@ -152,11 +242,15 @@
}
return allSelectItems;
}
-
- public void analyzeAction() throws Exception{
+
+ /**
+ * Analyze action
+ * @exception Exception If an error occurs
+ */
+ public void analyzeAction() throws Exception {
File file1 = new File(path + this.snapshotsToCompare[0]);
File file2 = new File(path + this.snapshotsToCompare[1]);
-
+
try {
Snapshot os = SnapshotHelper.load(file1);
Snapshot ns = SnapshotHelper.load(file2);
@@ -168,8 +262,17 @@
e.printStackTrace();
}
}
-
- private CompareSnapshotBean[] compareMethods(Map<String, List<CombinedFrameInfo>> oInfo, Map<String, List<CombinedFrameInfo>> nInfo) throws Exception {
+
+ /**
+ * Compare methods
+ * @param oInfo The old info
+ * @param nInfo The new info
+ * @return The compare snapshot beans
+ * @exception Exception If an error occurs
+ */
+ private CompareSnapshotBean[] compareMethods(Map<String, List<CombinedFrameInfo>> oInfo,
+ Map<String, List<CombinedFrameInfo>> nInfo) throws Exception {
+
List<CombinedFrameInfo> methods = new ArrayList<CombinedFrameInfo>();
Map<String, CombinedFrameInfo> oMap = new HashMap<String, CombinedFrameInfo>();
Map<String, CombinedFrameInfo> nMap = new HashMap<String, CombinedFrameInfo>();
@@ -220,7 +323,7 @@
CombinedFrameInfo c = new CombinedFrameInfo(cfi.getClassName(), cfi.getPrettyName());
c.increaseTotalTime(-cfi.getTotalTime());
- c.increaseCount(-cfi.getCount());
+ c.increaseCount(-cfi.getCount());
methods.add(c);
}
@@ -228,7 +331,7 @@
Collections.reverse(methods);
DecimalFormat df = new DecimalFormat("#0.00");
- this.compareSnapshotBeans=new CompareSnapshotBean[methods.size()];
+ this.compareSnapshotBeans = new CompareSnapshotBean[methods.size()];
for (int i = 0; i < methods.size(); i++) {
CombinedFrameInfo h = methods.get(i);
CombinedFrameInfo o = oMap.get(h.getPrettyName());
@@ -248,8 +351,13 @@
nCount = n.getCount();
}
- compareSnapshotBeans[i]=new CompareSnapshotBean(df.format(h.getTotalTime()),df.format(oTime),
- df.format(nTime),h.getCount(),oCount,nCount,h.getPrettyName());
+ compareSnapshotBeans[i] = new CompareSnapshotBean(df.format(h.getTotalTime()),
+ df.format(oTime),
+ df.format(nTime),
+ h.getCount(),
+ oCount,
+ nCount,
+ h.getPrettyName());
}
return compareSnapshotBeans;
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/DecorateFrameInfo.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,16 +21,16 @@
*/
package org.jboss.profiler.client.web;
+import org.jboss.profiler.shared.FrameInfo;
+import org.jboss.profiler.shared.Math;
+import org.jboss.profiler.shared.MethodInfo;
+import org.jboss.profiler.shared.MethodRepository;
+
import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
-import org.jboss.profiler.shared.FrameInfo;
-import org.jboss.profiler.shared.Math;
-import org.jboss.profiler.shared.MethodInfo;
-import org.jboss.profiler.shared.MethodRepository;
-
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
@@ -40,13 +40,22 @@
private List<DecorateFrameInfo> children;
private String pbar;
private long alltime = 0;
-
+
+ /**
+ * Constructor
+ * @param frameInfo The frame info
+ * @param methodRepository The method repository
+ */
public DecorateFrameInfo(FrameInfo frameInfo, MethodRepository methodRepository) {
this.frameInfo = frameInfo;
this.methodRepository = methodRepository;
alltime = frameInfo.getTotalTime();
}
+ /**
+ * Get percent bar
+ * @return The image
+ */
public String getPbar() {
if (pbar == null) {
long i = frameInfo.getTotalTime() * 100 / alltime;
@@ -57,34 +66,66 @@
return pbar;
}
+ /**
+ * Set percent bar
+ * @param pbar The image
+ */
+ public void setPbar(String pbar) {
+ this.pbar = pbar;
+ }
+
+ /**
+ * Get all time
+ * @return The value
+ */
public long getAlltime() {
return alltime;
}
+ /**
+ * Set all time
+ * @param alltime The value
+ */
public void setAlltime(long alltime) {
this.alltime = alltime;
}
- public void setPbar(String pbar) {
- this.pbar = pbar;
- }
-
+ /**
+ * Get the method repository
+ * @return The value
+ */
public MethodRepository getMethodRepository() {
return methodRepository;
}
+ /**
+ * Set the method repository
+ * @param methodRepository The value
+ */
public void setMethodRepository(MethodRepository methodRepository) {
this.methodRepository = methodRepository;
}
+ /**
+ * Get the frame info
+ * @return The value
+ */
public FrameInfo getFrameInfo() {
return frameInfo;
}
+ /**
+ * Set the frame info
+ * @param frameInfo The value
+ */
public void setFrameInfo(FrameInfo frameInfo) {
this.frameInfo = frameInfo;
}
+ /**
+ * Get the children
+ * @return The value
+ */
public List<DecorateFrameInfo> getChildren() {
if (children == null) {
List<FrameInfo> frames = frameInfo.getChildren();
@@ -101,10 +142,18 @@
return children;
}
+ /**
+ * Get the method
+ * @return The value
+ */
public String getMethod() {
return methodRepository.getInfo(frameInfo.getMethod()).getMethodName();
}
+ /**
+ * String representation
+ * @return The value
+ */
@Override
public String toString() {
MethodInfo minfo = methodRepository.getInfo(frameInfo.getMethod());
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/LoadSnapshotBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,6 +21,9 @@
*/
package org.jboss.profiler.client.web;
+import org.jboss.profiler.shared.Snapshot;
+import org.jboss.profiler.shared.SnapshotHelper;
+
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
@@ -29,50 +32,75 @@
import javax.faces.model.SelectItem;
-import org.jboss.profiler.shared.Snapshot;
-import org.jboss.profiler.shared.SnapshotHelper;
-
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
public class LoadSnapshotBean implements Serializable {
- private String snapshotToLoad;
+ private String snapshotToLoad;
private static Snapshot snapshot = null;
-
+
private String threshold = "1.0";
private String path = LoadSnapshotBean.class.getResource("/").getFile() + "../../files/";
+ /**
+ * Get the snapshot
+ * @return The value
+ */
public static Snapshot getSnapshot() {
return snapshot;
}
+ /**
+ * Set the snapshot
+ * @param snapshot The value
+ */
public static void setSnapshot(Snapshot snapshot) {
LoadSnapshotBean.snapshot = snapshot;
}
-
+
+ /**
+ * Get the threshold
+ * @return The value
+ */
public String getThreshold() {
return threshold;
}
-
+
+ /**
+ * Set the threshold
+ * @param threshold The value
+ */
public void setThreshold(String threshold) {
this.threshold = threshold;
}
+ /**
+ * Get the threshold to load
+ * @return The value
+ */
public String getSnapshotToLoad() {
return snapshotToLoad;
}
+ /**
+ * Set the threshold to load
+ * @param snapshotToLoad The value
+ */
public void setSnapshotToLoad(String snapshotToLoad) {
this.snapshotToLoad = snapshotToLoad;
}
- public List<SelectItem> getJPSs(){
+ /**
+ * Get the files
+ * @return The value
+ */
+ public List<SelectItem> getJPSs() {
List<SelectItem> allSelectItems = null;
File tempFile = new File(path);
String[] fileStr = tempFile.list();
List<String> jpsFiles = new ArrayList<String>();
allSelectItems = new ArrayList<SelectItem>();
- for (int i = 0; i <fileStr.length; i++) {
+ for (int i = 0; i < fileStr.length; i++) {
if (fileStr[i].endsWith("jps")) {
jpsFiles.add(fileStr[i]);
allSelectItems.add(new SelectItem(fileStr[i]));
@@ -81,8 +109,11 @@
return allSelectItems;
}
+ /**
+ * Analyze action
+ */
public void analyzeAction() {
- File file = new File(path+this.snapshotToLoad);
+ File file = new File(path + this.snapshotToLoad);
Snapshot snapshot;
try {
snapshot = SnapshotHelper.load(file);
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/MethodBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,16 +21,16 @@
*/
package org.jboss.profiler.client.web;
+import org.jboss.profiler.client.CombinedFrameComparator;
+import org.jboss.profiler.client.CombinedFrameInfo;
+import org.jboss.profiler.client.TimedClassInfo;
+import org.jboss.profiler.shared.Math;
+
import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.Collections;
import java.util.List;
-import org.jboss.profiler.client.CombinedFrameComparator;
-import org.jboss.profiler.client.CombinedFrameInfo;
-import org.jboss.profiler.client.TimedClassInfo;
-import org.jboss.profiler.shared.Math;
-
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
@@ -48,9 +48,20 @@
private static List<CombinedFrameInfo> cfs;
private int methodUnderThreshCount;
+ /**
+ * Constructor
+ */
public MethodBean() {
}
+ /**
+ * Constructor
+ * @param count The count
+ * @param totalTime total time
+ * @param cPercent The class percent
+ * @param tPercent The total percent
+ * @param prettyName The pretty name
+ */
public MethodBean(long count, String totalTime, String cPercent,
String tPercent, String prettyName) {
this.count = count;
@@ -60,71 +71,138 @@
this.prettyName = prettyName;
}
+ /**
+ * Get the count
+ * @return The value
+ */
public long getCount() {
return count;
}
+ /**
+ * Set the count
+ * @param count The value
+ */
public void setCount(long count) {
this.count = count;
}
+ /**
+ * Get the methods under treshold count
+ * @return The value
+ */
public int getMethodUnderThreshCount() {
return methodUnderThreshCount;
}
+ /**
+ * Set the methods under treshold count
+ * @param methodUnderThreshCount The value
+ */
public void setMethodUnderThreshCount(int methodUnderThreshCount) {
this.methodUnderThreshCount = methodUnderThreshCount;
}
+ /**
+ * Get the total
+ * @return The value
+ */
public String getTotalTime() {
return totalTime;
}
+ /**
+ * Set the total time
+ * @param totalTime The value
+ */
public void setTotalTime(String totalTime) {
this.totalTime = totalTime;
}
+ /**
+ * Get the class percent
+ * @return The value
+ */
public String getCPercent() {
return cPercent;
}
+ /**
+ * Set the class percent
+ * @param percent The value
+ */
public void setCPercent(String percent) {
cPercent = percent;
}
+ /**
+ * Get the total percent
+ * @return The value
+ */
public String getTPercent() {
return tPercent;
}
+ /**
+ * Set the total percent
+ * @param percent The value
+ */
public void setTPercent(String percent) {
tPercent = percent;
}
+ /**
+ * Get the pretty name
+ * @return The value
+ */
public String getPrettyName() {
return prettyName;
}
+ /**
+ * Set the pretty name
+ * @param prettyName The value
+ */
public void setPrettyName(String prettyName) {
this.prettyName = prettyName;
}
+ /**
+ * Get the timed class info
+ * @return The value
+ */
public static TimedClassInfo getTci() {
return tci;
}
+ /**
+ * Set the timed class info
+ * @param tci The value
+ */
public static void setTci(TimedClassInfo tci) {
MethodBean.tci = tci;
}
+ /**
+ * Get the combined frame info
+ * @return The value
+ */
public static List<CombinedFrameInfo> getCfs() {
return cfs;
}
+ /**
+ * Set the combined frame info
+ * @param cfs The value
+ */
public static void setCfs(List<CombinedFrameInfo> cfs) {
MethodBean.cfs = cfs;
}
- public void setMethods(){
+ /**
+ * Set methods
+ */
+ public void setMethods() {
methodUnderThreshCount = 0;
if (cfs != null) {
DecimalFormat df = new DecimalFormat("#0.00");
@@ -132,11 +210,11 @@
int j = 0;
methods = new MethodBean[cfs.size()];
for (CombinedFrameInfo cfi : cfs) {
- methods[j++]= new MethodBean(cfi.getCount(),
- df.format(cfi.getTotalTime()),
- df.format(Math.toPercent(cfi.getTotalTime(), tci.getTotalTime())),
- df.format(cfi.getPercent()),
- cfi.getPrettyName());
+ methods[j++] = new MethodBean(cfi.getCount(),
+ df.format(cfi.getTotalTime()),
+ df.format(Math.toPercent(cfi.getTotalTime(), tci.getTotalTime())),
+ df.format(cfi.getPercent()),
+ cfi.getPrettyName());
if (cfi.getTotalTime() < BasicOptBean.getDigThreshold()) {
methodUnderThreshCount++;
}
@@ -144,7 +222,11 @@
this.setMethodUnderThreshCount(methodUnderThreshCount);
}
}
-
+
+ /**
+ * Get the methods
+ * @return The value
+ */
public MethodBean[] getMethods() {
this.setMethods();
return this.methods;
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/OverviewBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,14 +21,6 @@
*/
package org.jboss.profiler.client.web;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
import org.jboss.profiler.client.CombinedFrameComparator;
import org.jboss.profiler.client.CombinedFrameInfo;
import org.jboss.profiler.client.SnapshotUtil;
@@ -40,47 +32,88 @@
import org.jboss.profiler.shared.ThreadComparator;
import org.jboss.profiler.shared.ThreadInfo;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
public class OverviewBean implements Serializable {
+ private static final String[] TITLES = {
+ "Threads", "Most Time", "Hotspots", "Allocations", "Classes"
+ };
+
private String title;
private int packageUnderThreshCount;
private int hotspotsUnderThreshCount;
private int mosttimeUnderThreshCount;
private int waittimeUnderThreshCount;
+ /**
+ * Get the title
+ * @return The title
+ */
public String getTitle() {
return title;
}
+ /**
+ * Set the title
+ * @param title The title
+ */
public void setTitle(String title) {
this.title = title;
}
- public String[] getTitles(){
- String[] titles= {
- "Threads","Most Time","Hotspots","Allocations","classes"
- };
- return titles;
+ /**
+ * Get the titles
+ * @return The titles
+ */
+ public String[] getTitles() {
+ return TITLES;
}
+ /**
+ * Get the package under threshold count
+ * @return The number
+ */
public int getPackageUnderThreshCount() {
return packageUnderThreshCount;
}
+ /**
+ * Set the package under threshold count
+ * @param packageUnderThreshCount The number
+ */
public void setPackageUnderThreshCount(int packageUnderThreshCount) {
this.packageUnderThreshCount = packageUnderThreshCount;
}
+ /**
+ * Get the wait time under threshold count
+ * @return The number
+ */
public int getWaittimeUnderThreshCount() {
return waittimeUnderThreshCount;
}
+ /**
+ * Set the wait time under threshold count
+ * @param waittimeUnderThreshCount The number
+ */
public void setWaittimeUnderThreshCount(int waittimeUnderThreshCount) {
this.waittimeUnderThreshCount = waittimeUnderThreshCount;
}
+ /**
+ * Get the allocations
+ * @return The allocations
+ */
public List<AllocationInfo> getAllocations() {
List<AllocationInfo> allocationList = null;
if (LoadSnapshotBean.getSnapshot() != null) {
@@ -90,23 +123,43 @@
return allocationList;
}
+ /**
+ * Get the hotspot under threshold count
+ * @return The number
+ */
public int getHotspotsUnderThreshCount() {
return hotspotsUnderThreshCount;
}
+ /**
+ * Set the hotspot under threshold count
+ * @param hotspotsUnderThreshCount The number
+ */
public void setHotspotsUnderThreshCount(int hotspotsUnderThreshCount) {
this.hotspotsUnderThreshCount = hotspotsUnderThreshCount;
}
+ /**
+ * Get the most time under threshold count
+ * @return The number
+ */
public int getMosttimeUnderThreshCount() {
return mosttimeUnderThreshCount;
}
+ /**
+ * Set the most time under threshold count
+ * @param mosttimeUnderThreshCount The number
+ */
public void setMosttimeUnderThreshCount(int mosttimeUnderThreshCount) {
this.mosttimeUnderThreshCount = mosttimeUnderThreshCount;
}
- public List<CombinedFrameInfo> getHotspots(){
+ /**
+ * Get the hotspots
+ * @return The hotspots
+ */
+ public List<CombinedFrameInfo> getHotspots() {
if (LoadSnapshotBean.getSnapshot() != null) {
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
@@ -116,12 +169,12 @@
List<CombinedFrameInfo> l = (List<CombinedFrameInfo>)it.next();
hotspotsInfo.addAll(l);
}
- Collections.sort(hotspotsInfo,new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME_AVG));
+ Collections.sort(hotspotsInfo, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME_AVG));
//build new array list above threshold
List<CombinedFrameInfo> thresholdHotspots = new ArrayList<CombinedFrameInfo>();
it = hotspotsInfo.iterator();
while (it.hasNext()) {
- CombinedFrameInfo tempCFI=(CombinedFrameInfo) it.next();
+ CombinedFrameInfo tempCFI = (CombinedFrameInfo) it.next();
if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold()) {
thresholdHotspots.add(tempCFI);
}
@@ -137,6 +190,10 @@
return null;
}
+ /**
+ * Get the most time
+ * @return The most time
+ */
public List<CombinedFrameInfo> getMostTime() {
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
if (LoadSnapshotBean.getSnapshot() != null) {
@@ -155,7 +212,7 @@
it = allMethods.iterator();
while (it.hasNext()) {
CombinedFrameInfo tempCFI = (CombinedFrameInfo)it.next();
- if (tempCFI.getTotalTime()>=BasicOptBean.getDigThreshold()) {
+ if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold()) {
thresholdMostTime.add(tempCFI);
}
}
@@ -169,7 +226,11 @@
return null;
}
- public List<ThreadInfo> getThreads(){
+ /**
+ * Get the threads
+ * @return The threads
+ */
+ public List<ThreadInfo> getThreads() {
List<ThreadInfo> threads = null;
if (LoadSnapshotBean.getSnapshot() != null) {
Collections.sort(LoadSnapshotBean.getSnapshot().getThreads(), new ThreadComparator());
@@ -179,7 +240,11 @@
return null;
}
- public List<CombinedFrameInfo> getPackages(){
+ /**
+ * Get the packages
+ * @return The packages
+ */
+ public List<CombinedFrameInfo> getPackages() {
if (LoadSnapshotBean.getSnapshot() != null) {
SnapshotUtil su = new SnapshotUtil(BasicOptBean.getDigThreshold());
Map<String, List<CombinedFrameInfo>> info = su.getInformation(LoadSnapshotBean.getSnapshot());
@@ -214,7 +279,7 @@
it = result.iterator();
while (it.hasNext()) {
CombinedFrameInfo tempCFI = (CombinedFrameInfo) it.next();
- if(tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold()) {
+ if (tempCFI.getTotalTime() >= BasicOptBean.getDigThreshold()) {
thresholdPackages.add(tempCFI);
}
}
@@ -229,6 +294,10 @@
return null;
}
+ /**
+ * Get the classes
+ * @return The classes
+ */
public List<TimedClassInfo> getClasses() {
List<TimedClassInfo> thresholdClasses = new ArrayList<TimedClassInfo>();
if (LoadSnapshotBean.getSnapshot() != null) {
@@ -237,8 +306,6 @@
List<TimedClassInfo> classes = su.getTimedClasses(LoadSnapshotBean.getSnapshot().getClasses(), info);
Collections.sort(classes, new TimedClassComparator(TimedClassComparator.WAIT_TIME));
- //build new array list of wait time above threshold
- thresholdClasses.clear();
Iterator<TimedClassInfo> it = classes.iterator();
while (it.hasNext()) {
TimedClassInfo tempTCI = it.next();
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/ThreadHotspotBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,6 +21,16 @@
*/
package org.jboss.profiler.client.web;
+import org.jboss.profiler.client.CombinedFrameComparator;
+import org.jboss.profiler.client.CombinedFrameInfo;
+import org.jboss.profiler.client.Util;
+import org.jboss.profiler.shared.FrameInfo;
+import org.jboss.profiler.shared.Math;
+import org.jboss.profiler.shared.MethodInfo;
+import org.jboss.profiler.shared.MethodRepository;
+import org.jboss.profiler.shared.ThreadInfo;
+import org.jboss.profiler.shared.ThreadInfoProxy;
+
import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.ArrayList;
@@ -31,84 +41,129 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
+import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
-import org.jboss.profiler.client.CombinedFrameComparator;
-import org.jboss.profiler.client.CombinedFrameInfo;
-import org.jboss.profiler.client.Util;
-import org.jboss.profiler.shared.FrameInfo;
-import org.jboss.profiler.shared.Math;
-import org.jboss.profiler.shared.MethodInfo;
-import org.jboss.profiler.shared.MethodRepository;
-import org.jboss.profiler.shared.ThreadInfo;
-import org.jboss.profiler.shared.ThreadInfoProxy;
-
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
public class ThreadHotspotBean implements Serializable {
private String selectItem = null;
private ThreadInfo selectThreadInfo = null;
- private ArrayList<String> mainKeys;
- private ArrayList<String> subKeys;
- private ArrayList<CombinedFrameInfo> subValues;
- private HashMap<String,CombinedFrameInfo> newMap;
-
+ private List<String> mainKeys;
+ private List<String> subKeys;
+ private List<CombinedFrameInfo> subValues;
+ private Map<String, CombinedFrameInfo> newMap;
+
+ /**
+ * Constructor
+ */
public ThreadHotspotBean() {
}
+ /**
+ * Get the select item
+ * @return The item
+ */
public String getSelectItem() {
return selectItem;
}
+ /**
+ * Set the select item
+ * @param selectItem The item
+ */
public void setSelectItem(String selectItem) {
this.selectItem = selectItem;
}
+ /**
+ * Get the select thread info
+ * @return The info
+ */
public ThreadInfo getSelectThreadInfo() {
return selectThreadInfo;
}
+ /**
+ * Set the select thread info
+ * @param selectThreadInfo The info
+ */
public void setSelectThreadInfo(ThreadInfo selectThreadInfo) {
this.selectThreadInfo = selectThreadInfo;
this.selectItem = selectThreadInfo.getName();
}
- public ArrayList<String> getMainKeys() {
+ /**
+ * Get the main keys
+ * @return The keys
+ */
+ public List<String> getMainKeys() {
return mainKeys;
}
- public void setMainKeys(ArrayList<String> mainKeys) {
+ /**
+ * Set the main keys
+ * @param mainKeys The keys
+ */
+ public void setMainKeys(List<String> mainKeys) {
this.mainKeys = mainKeys;
}
- public ArrayList<String> getSubKeys() {
+ /**
+ * Get the sub keys
+ * @return The keys
+ */
+ public List<String> getSubKeys() {
return subKeys;
}
- public void setSubKeys(ArrayList<String> subKeys) {
+ /**
+ * Set the sub keys
+ * @param subKeys The keys
+ */
+ public void setSubKeys(List<String> subKeys) {
this.subKeys = subKeys;
}
- public ArrayList<CombinedFrameInfo> getSubValues() {
+ /**
+ * Get the sub values
+ * @return The values
+ */
+ public List<CombinedFrameInfo> getSubValues() {
return subValues;
}
- public void setSubValues(ArrayList<CombinedFrameInfo> subValues) {
+ /**
+ * Set the sub values
+ * @param subValues The values
+ */
+ public void setSubValues(List<CombinedFrameInfo> subValues) {
this.subValues = subValues;
}
- public HashMap<String, CombinedFrameInfo> getNewMap() {
+ /**
+ * Get the new map
+ * @return The map
+ */
+ public Map<String, CombinedFrameInfo> getNewMap() {
return newMap;
}
- public void setNewMap(HashMap<String, CombinedFrameInfo> newMap) {
+ /**
+ * Set the new map
+ * @param newMap The map
+ */
+ public void setNewMap(Map<String, CombinedFrameInfo> newMap) {
this.newMap = newMap;
}
- public List<ThreadInfo> getAllThreads(){
+ /**
+ * Get the threads
+ * @return The threads
+ */
+ public List<ThreadInfo> getAllThreads() {
List<ThreadInfo> threadsList = null;
if (LoadSnapshotBean.getSnapshot() != null) {
threadsList = LoadSnapshotBean.getSnapshot().getThreads();
@@ -116,9 +171,13 @@
return threadsList;
}
- public void selectionChanged(javax.faces.event.ValueChangeEvent evt){
+ /**
+ * Selection changed
+ * @param evt The event
+ */
+ public void selectionChanged(ValueChangeEvent evt) {
this.setSelectItem(((String)evt.getNewValue()));
- //get the selected thread
+
List<ThreadInfo> allThreads = this.getAllThreads();
Iterator<ThreadInfo> it = allThreads.iterator();
ThreadInfo tmpThreadInfo = null;
@@ -130,12 +189,15 @@
generateArrayFromMap(tmpThreadInfo);
}
- public List<SelectItem> getAllSelectItems(){
+ /**
+ * Get selected items
+ * @return The items
+ */
+ public List<SelectItem> getAllSelectItems() {
List<SelectItem> allSelectItems = new ArrayList<SelectItem>();
List<ThreadInfo> threadsList = null;
if (LoadSnapshotBean.getSnapshot() != null) {
threadsList = LoadSnapshotBean.getSnapshot().getThreads();
- //allSelectItems=new ArrayList<SelectItem>(threadsList.size());
for (int i = 0; i < threadsList.size(); i++) {
allSelectItems.add(new SelectItem(threadsList.get(i).getName()));
}
@@ -143,9 +205,13 @@
return allSelectItems;
}
+ /**
+ * Show info
+ * @param threadInfo The thread
+ */
public void showMapInfo(ThreadInfo threadInfo) {
Map<String, Map<String, CombinedFrameInfo>> data = new HashMap<String, Map<String, CombinedFrameInfo>>();
- for (FrameInfo fi: threadInfo.getFrames()) {
+ for (FrameInfo fi : threadInfo.getFrames()) {
getCallerInformation(LoadSnapshotBean.getSnapshot().getMethodRepository(), fi, data);
}
@@ -175,32 +241,36 @@
String methodName = (String)mentry.getKey();
List<CombinedFrameInfo> callers = (List<CombinedFrameInfo>)mentry.getValue();
Collections.sort(callers, new CombinedFrameComparator(CombinedFrameComparator.TOTAL_TIME));
- }// show List information.
- }//show map information
+ }
+ }
}
+ /**
+ * Generate array
+ * @param threadInfo The thread
+ */
public void generateArrayFromMap(ThreadInfo threadInfo) {
Map<String, Map<String, CombinedFrameInfo>> map = new HashMap<String, Map<String, CombinedFrameInfo>>();
- for (FrameInfo fi: threadInfo.getFrames()) {
- getCallerInformation(LoadSnapshotBean.getSnapshot().getMethodRepository(),fi, map);
+ for (FrameInfo fi : threadInfo.getFrames()) {
+ getCallerInformation(LoadSnapshotBean.getSnapshot().getMethodRepository(), fi, map);
}
- HashMap<String,CombinedFrameInfo> newMap = new HashMap();
+ Map<String, CombinedFrameInfo> newMap = new HashMap();
Set<String> set = map.keySet();
- ArrayList<String> mainKeys = new ArrayList(set);
+ List<String> mainKeys = new ArrayList(set);
this.mainKeys = mainKeys;
- ArrayList subKeys = new ArrayList();
- ArrayList subValues = new ArrayList();
+ List subKeys = new ArrayList();
+ List subValues = new ArrayList();
Iterator it = map.values().iterator();
- while(it.hasNext()){
- Map<String, CombinedFrameInfo> subMap=(Map<String, CombinedFrameInfo>) it.next();
+ while (it.hasNext()) {
+ Map<String, CombinedFrameInfo> subMap = (Map<String, CombinedFrameInfo>) it.next();
Set entrySet = subMap.entrySet();
Iterator entryIt = entrySet.iterator();
while (entryIt.hasNext()) {
- Map.Entry<String, CombinedFrameInfo> entry = (Entry<String, CombinedFrameInfo>)entryIt.next();
+ Map.Entry<String, CombinedFrameInfo> entry = (Map.Entry<String, CombinedFrameInfo>)entryIt.next();
subKeys.add(entry.getKey());
subValues.add(entry.getValue());
newMap.put(entry.getKey(), entry.getValue());
@@ -213,11 +283,14 @@
/**
* Get caller information
- * @param mr The method repository
- * @param fi The frame
- * @param data The data
- * */
- protected void getCallerInformation(MethodRepository mr, FrameInfo fi, Map<String, Map<String, CombinedFrameInfo>> data) {
+ * @param mr The method repository
+ * @param fi The frame
+ * @param data The data
+ */
+ protected void getCallerInformation(MethodRepository mr,
+ FrameInfo fi,
+ Map<String, Map<String, CombinedFrameInfo>> data) {
+
MethodInfo mi = mr.getInfo(fi.getMethod());
Map<String, CombinedFrameInfo> entry = data.get(mi.getClassName());
if (entry == null) {
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/TreeThreadBean.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -21,13 +21,13 @@
*/
package org.jboss.profiler.client.web;
+import org.jboss.profiler.shared.FrameInfo;
+import org.jboss.profiler.shared.ThreadInfo;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.jboss.profiler.shared.FrameInfo;
-import org.jboss.profiler.shared.ThreadInfo;
-
/**
* @author Huijuan Shao <hjshao at hitachi.cn>
*/
@@ -37,35 +37,66 @@
private volatile LoadSnapshotBean loadSnapshotBean;
private List<FrameInfo> frames;
private FrameInfo frame;
+
+ /**
+ * Constructor
+ */
+ public TreeThreadBean() {
+ }
+ /**
+ * Get the frame
+ * @return The frame
+ */
public FrameInfo getFrame() {
return frame;
}
+ /**
+ * Set the frame
+ * @param frame The frame
+ */
public void setFrame(FrameInfo frame) {
this.frame = frame;
}
+ /**
+ * Get the load snapshot bean
+ * @return The load snapshot bean
+ */
public LoadSnapshotBean getLoadSnapshotBean() {
return loadSnapshotBean;
}
+ /**
+ * Set the load snapshot bean
+ * @param loadSnapshotBean The load snapshot bean
+ */
public void setLoadSnapshotBean(LoadSnapshotBean loadSnapshotBean) {
this.loadSnapshotBean = loadSnapshotBean;
}
- public TreeThreadBean() {
- }
-
+ /**
+ * Get the selected thread
+ * @return The thread
+ */
public long getSelectedThread() {
return selectedThread;
}
+ /**
+ * Set the selected thread
+ * @param selectedThread The thread
+ */
public void setSelectedThread(long selectedThread) {
this.selectedThread = selectedThread;
}
- public List<ThreadInfo> getAllThreads(){
+ /**
+ * Get the threads
+ * @return The threads
+ */
+ public List<ThreadInfo> getAllThreads() {
List<ThreadInfo> threadsList = null;
if (loadSnapshotBean.getSnapshot() != null) {
threadsList = loadSnapshotBean.getSnapshot().getThreads();
@@ -73,10 +104,13 @@
return threadsList;
}
- public void fireSelectedThread(){
+ /**
+ * Fire selected thread
+ */
+ public void fireSelectedThread() {
List<ThreadInfo> allthreads = this.getAllThreads();
ThreadInfo tmpThreadInfo = null;
- for (int i=0; i < allthreads.size(); i++) {
+ for (int i = 0; i < allthreads.size(); i++) {
tmpThreadInfo = allthreads.get(i);
if (tmpThreadInfo.getId() == this.getSelectedThread())
break;
@@ -85,17 +119,25 @@
//TreeFrameBean.setEnterFrames(tmpThreadInfo.getFrames());
}
+ /**
+ * Get the source roots
+ * @return The roots
+ */
public synchronized List<DecorateFrameInfo> getSrcRoots() {
if (frames == null)
return null;
ArrayList<DecorateFrameInfo> ret = new ArrayList<DecorateFrameInfo>();
for (FrameInfo frameInfo : frames)
- ret.add(new DecorateFrameInfo(frameInfo,loadSnapshotBean.getSnapshot().getMethodRepository()));
+ ret.add(new DecorateFrameInfo(frameInfo, loadSnapshotBean.getSnapshot().getMethodRepository()));
return ret;
}
- public String getFrameInfo(){
+ /**
+ * Get the frame info
+ * @return The info
+ */
+ public String getFrameInfo() {
return frame == null ? "" : frame.toString();
}
}
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/PostbackPhaseListener.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -36,21 +36,36 @@
public class PostbackPhaseListener implements PhaseListener, Serializable {
private static final long serialVersionUID = 1L;
+
+ /** The postback attribute name */
public static final String POSTBACK_ATTRIBUTE_NAME = PostbackPhaseListener.class.getName();
-
+
+ /**
+ * @param event The event
+ */
public void afterPhase(PhaseEvent event) {
}
+ /**
+ * @param event The event
+ */
public void beforePhase(PhaseEvent event) {
FacesContext facesContext = event.getFacesContext();
Map requestMap = facesContext.getExternalContext().getRequestMap();
requestMap.put(POSTBACK_ATTRIBUTE_NAME, Boolean.TRUE);
}
+ /**
+ * @return The phase id
+ */
public PhaseId getPhaseId() {
return PhaseId.APPLY_REQUEST_VALUES;
}
+ /**
+ * Is postback
+ * @return Ture if postback; otherwise false
+ */
public static boolean isPostback() {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null) {
Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java 2009-05-01 16:06:38 UTC (rev 527)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/client/web/util/TreeDemoStateAdvisor.java 2009-05-09 15:44:51 UTC (rev 528)
@@ -32,6 +32,11 @@
*/
public class TreeDemoStateAdvisor implements TreeStateAdvisor, Serializable {
+ /**
+ * Node open
+ * @param tree The tree
+ * @return True if root node opens; otherwise false
+ */
public Boolean adviseNodeOpened(UITree tree) {
if (!PostbackPhaseListener.isPostback()) {
Object key = tree.getRowKey();
@@ -43,6 +48,11 @@
return null;
}
+ /**
+ * Node select
+ * @param tree The tree
+ * @return null
+ */
public Boolean adviseNodeSelected(UITree tree) {
return null;
}
More information about the jboss-cvs-commits
mailing list