private static final String SWAPOUT = "stats.swapout";
增加构造函数入参、赋值语句
public MonitorStats(int health, int load, int cpuload, int memload, int threadload, int swapin, int swapout, String host, String port,
String protocol, long time) {
this.setHealth(health);
this.setLoad(load);
this.setCpuLoad(cpuload);
this.setMemLoad(memload);
this.setThreadLoad(threadload);
this.setSwapin(swapin);
this.setSwapout(swapout);
this.setHost(host);
this.setPort(port);
this.setProtocol(protocol);
this.setTimeStamp(time);
}
增加相应set、get方法
public void setSwapout(int load) {
this.setProperty(SWAPOUT, String.valueOf(load));
}
public int getSwapout() {
return this.getPropertyAsInt(SWAPOUT);
}
MonitorModel.java
增加私有变量对象current初始化中MonitorStats实例化的入参
private MonitorStats current = new MonitorStats(0, 0, 0, 0, 0, 0, 0, "", "", "", System.currentTimeMillis());
增加clearData方法中MonitorStats实例化的入参
current = new MonitorStats(0, 0, 0, 0, 0, 0, 0, "", "", "", System.currentTimeMillis());
增加相应get方法
public int getSwapout() {
return this.current.getSwapout();
}
增加cloneMonitorStats方法的入参
public MonitorStats cloneMonitorStats() {
return new MonitorStats(current.getHealth(), current.getLoad(), current.getCpuLoad(), current.getMemLoad(),
current.getThreadLoad(), current.getSwapin(), current.getSwapout(), current.getHost(), current.getPort(), current.getProtocol(), current
.getTimeStamp());
}
MemoryBenchmark.java
增加main方法中MonitorStats实例化的入参
MonitorStats mstats = new MonitorStats(Stats.calculateHealth(st), Stats.calculateLoad(st), Stats.calculateCpuLoad(st), Stats
.calculateMemLoad(st), Stats.calculateThreadLoad(st), Stats.calculateSwapin(st), Stats.calculateSwapout(st), "localhost", "8080", "http", System
.currentTimeMillis());
MonitorAccumModel.java
增加addSample方法中MonitorStats实例化的入参
MonitorStats stat = new MonitorStats(Stats.calculateHealth(st), Stats.calculateLoad(st), Stats.calculateCpuLoad(st), Stats
.calculateMemLoad(st), Stats.calculateThreadLoad(st), Stats.calculateSwapin(st), Stats.calculateSwapout(st), surl.getHost(), String.valueOf(surl
.getPort()), surl.getProtocol(), System.currentTimeMillis());
增加createNewMonitorModel方法中MonitorStats实例化的入参
MonitorStats stat = new MonitorStats(Stats.DEAD, 0, 0, 0, 0, 0, 0, url.getHost(), String.valueOf(url.getPort()), url
.getProtocol(), System.currentTimeMillis());
MonitorPerformancePanel.java
增加公共静态变量(显示文案和图例,同时增加资源文件中对应项,及相应图片)
public static final String LEGEND_SWAPOUT = JMeterUtils.getResString("monitor_legend_swapout_per");
public static final ImageIcon LEGEND_SWAPOUT_ICON = JMeterUtils.getImage("monitor-yellow-legend.gif");
资源文件messages.properties:
monitor_legend_swapout_per=Swap Out
图片文件monitor-yellow-legend.gif
增加createLegend方法中的JLabel实例化语句
JLabel jswapout = new JLabel(LEGEND_SWAPOUT); jswapout.setFont(plaintext); jswapout.setPreferredSize(lsize); jswapout.setIcon(LEGEND_SWAPOUT_ICON);
legend.add(jswapout);
MonitorGraph.java
增加私有变量
private boolean SWAPOUT = true;
增加相应set方法
public void setSwapout(boolean swapout) {
this.SWAPOUT = swapout;
}
增加drawSample方法中相应绘图语句
if (SWAPOUT) {
int swoy = (int) (height - (height * (model.getSwapout() / 10000.0)));
int lastswoy = (int) (height - (height * (last.getSwapout() / 10000.0)));