Skip to content

Commit 35d406e

Browse files
authored
Merge pull request #245 from scouter-project/master
Merge for release
2 parents afb55e9 + 153259f commit 35d406e

File tree

11 files changed

+893
-5
lines changed

11 files changed

+893
-5
lines changed

scouter.client/plugin.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,14 @@
576576
name="EQ"
577577
restorable="true">
578578
</view>
579+
<view
580+
allowMultiple="true"
581+
class="scouter.client.views.VerticalEQView"
582+
icon="icons/ymin.png"
583+
id="scouter.client.views.VerticalEQView"
584+
name="Vertical EQ"
585+
restorable="true">
586+
</view>
579587
<view
580588
allowMultiple="true"
581589
class="scouter.client.group.view.EQGroupView"
@@ -584,6 +592,14 @@
584592
name="EQ Group"
585593
restorable="true">
586594
</view>
595+
<view
596+
allowMultiple="true"
597+
class="scouter.client.group.view.VerticalEQGroupView"
598+
icon="icons/ymin.png"
599+
id="scouter.client.group.view.VerticalEQGroupView"
600+
name="Vertical EQ Group"
601+
restorable="true">
602+
</view>
587603
<view
588604
allowMultiple="true"
589605
class="scouter.client.views.LoginUserView"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2015 the original author or authors.
3+
* @https://github.com/scouter-project/scouter
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
package scouter.client.actions;
19+
20+
import org.eclipse.jface.action.Action;
21+
import org.eclipse.ui.IWorkbenchPage;
22+
import org.eclipse.ui.IWorkbenchWindow;
23+
import org.eclipse.ui.PartInitException;
24+
25+
import scouter.client.Images;
26+
import scouter.client.group.view.VerticalEQGroupView;
27+
28+
public class OpenVerticalEQGroupViewAction extends Action {
29+
public final static String ID = OpenVerticalEQGroupViewAction.class.getName();
30+
31+
private final IWorkbenchWindow window;
32+
String grpName;
33+
34+
public OpenVerticalEQGroupViewAction(IWorkbenchWindow window, String grpName) {
35+
this.window = window;
36+
this.grpName = grpName;
37+
setText("Active Service Vertical EQ");
38+
setId(ID);
39+
setImageDescriptor(Images.XY_YMIN);
40+
}
41+
42+
public void run() {
43+
if (window != null) {
44+
try {
45+
window.getActivePage().showView(VerticalEQGroupView.ID, grpName, IWorkbenchPage.VIEW_ACTIVATE);
46+
} catch (PartInitException e) {
47+
e.printStackTrace();
48+
}
49+
}
50+
}
51+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright 2015 the original author or authors.
3+
* @https://github.com/scouter-project/scouter
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
package scouter.client.actions;
19+
20+
import org.eclipse.jface.action.Action;
21+
import org.eclipse.ui.IWorkbenchPage;
22+
import org.eclipse.ui.IWorkbenchWindow;
23+
import org.eclipse.ui.PartInitException;
24+
25+
import scouter.client.Images;
26+
import scouter.client.views.VerticalEQView;
27+
28+
public class OpenVerticalEQViewAction extends Action {
29+
public final static String ID = OpenVerticalEQViewAction.class.getName();
30+
31+
private final IWorkbenchWindow window;
32+
int serverId;
33+
String objType;
34+
35+
public OpenVerticalEQViewAction(IWorkbenchWindow window, int serverId, String objType) {
36+
this.window = window;
37+
this.serverId = serverId;
38+
this.objType = objType;
39+
setText("Active Service Vertical EQ");
40+
setId(ID);
41+
setImageDescriptor(Images.XY_YMIN);
42+
}
43+
44+
public void run() {
45+
if (window != null) {
46+
try {
47+
window.getActivePage().showView(VerticalEQView.ID, serverId + "&" + objType, IWorkbenchPage.VIEW_ACTIVATE);
48+
} catch (PartInitException e) {
49+
e.printStackTrace();
50+
}
51+
}
52+
}
53+
}

scouter.client/src/scouter/client/group/view/GroupNavigationView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import scouter.client.actions.OpenManageGroupAction;
6262
import scouter.client.actions.OpenServiceGroupElapsedGroupAction;
6363
import scouter.client.actions.OpenServiceGroupTPSGroupAction;
64+
import scouter.client.actions.OpenVerticalEQGroupViewAction;
6465
import scouter.client.constants.MenuStr;
6566
import scouter.client.context.actions.OpenCxtmenuAssginGroupAction;
6667
import scouter.client.counter.actions.OpenActiveSpeedGroupViewAction;
@@ -207,6 +208,7 @@ public void menuAboutToShow(IMenuManager manager){
207208
manager.add(new Separator());
208209
if (isChildOf(objType, CounterConstants.FAMILY_JAVAEE)) {
209210
manager.add(new OpenEQGroupViewAction(win, grpObj.getName()));
211+
manager.add(new OpenVerticalEQGroupViewAction(win, grpObj.getName()));
210212
manager.add(new OpenActiveSpeedGroupViewAction(win, MenuStr.ACTIVE_SPEED_REAL, grpObj));
211213
MenuManager xLogMenu = new MenuManager(MenuStr.XLOG, ImageUtil.getImageDescriptor(Images.transrealtime), MenuStr.XLOG_ID);
212214
manager.add(xLogMenu);
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright 2015 the original author or authors.
3+
* @https://github.com/scouter-project/scouter
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*
17+
*/
18+
package scouter.client.group.view;
19+
20+
import java.io.IOException;
21+
import java.util.HashMap;
22+
import java.util.Iterator;
23+
import java.util.Map;
24+
25+
import org.eclipse.swt.widgets.Composite;
26+
import org.eclipse.ui.IViewSite;
27+
import org.eclipse.ui.PartInitException;
28+
29+
import scouter.client.model.AgentModelThread;
30+
import scouter.client.net.INetReader;
31+
import scouter.client.net.TcpProxy;
32+
import scouter.client.util.ConsoleProxy;
33+
import scouter.client.util.ScouterUtil;
34+
import scouter.client.views.EQCommonView;
35+
import scouter.lang.pack.MapPack;
36+
import scouter.lang.value.ListValue;
37+
import scouter.io.DataInputX;
38+
import scouter.net.RequestCmd;
39+
import scouter.util.CastUtil;
40+
41+
public class VerticalEQGroupView extends EQCommonView {
42+
43+
public static final String ID = VerticalEQGroupView.class.getName();
44+
45+
private Map<Integer, ListValue> serverObjMap = new HashMap<Integer, ListValue>();
46+
private String grpName;
47+
48+
public void init(IViewSite site) throws PartInitException {
49+
super.init(site);
50+
String secId = site.getSecondaryId();
51+
grpName = secId;
52+
}
53+
54+
public void createPartControl(Composite parent) {
55+
this.setPartName("Active Service Vertical EQ - " + grpName);
56+
super.createPartControl(parent);
57+
}
58+
59+
public void fetch() {
60+
ScouterUtil.collectGroupObjcts(grpName, serverObjMap);
61+
Iterator<Integer> itr = serverObjMap.keySet().iterator();
62+
while (itr.hasNext()) {
63+
int serverId = itr.next();
64+
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
65+
try {
66+
MapPack param = new MapPack();
67+
param.put("objHash", serverObjMap.get(serverId));
68+
tcp.process(RequestCmd.ACTIVESPEED_GROUP_REAL_TIME, param, new INetReader() {
69+
public void process(DataInputX in) throws IOException {
70+
MapPack m = (MapPack) in.readPack();
71+
ActiveSpeedData asd = new ActiveSpeedData();
72+
asd.act1 = CastUtil.cint(m.get("act1"));
73+
asd.act2 = CastUtil.cint(m.get("act2"));
74+
asd.act3 = CastUtil.cint(m.get("act3"));
75+
int objHash = CastUtil.cint(m.get("objHash"));
76+
EqData data = new EqData();
77+
data.objHash = objHash;
78+
data.asd = asd;
79+
data.displayName = ScouterUtil.getFullObjName(objHash);
80+
data.isAlive = AgentModelThread.getInstance().getAgentObject(objHash).isAlive();
81+
valueSet.add(data);
82+
}
83+
});
84+
} catch (Throwable t) {
85+
ConsoleProxy.errorSafe(t.toString());
86+
} finally {
87+
TcpProxy.putTcpProxy(tcp);
88+
}
89+
}
90+
}
91+
}

scouter.client/src/scouter/client/util/ChartUtil.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,28 @@ public static double getGroupMaxValue(double val) {
102102
}
103103

104104
public static double getEqMaxValue(double val) {
105+
/*
105106
if (val < 10)
106107
return 10;
107108
if (val < 30)
108109
return 30;
109110
if (val < 50)
110111
return 50;
111112
return rounding(val * 100) / 100;
113+
*/
114+
115+
// Add margin(width or height) for detailed active service counts.
116+
if (val < 7)
117+
return 10;
118+
if (val < 20)
119+
return 30;
120+
if (val < 40)
121+
return 60;
122+
if (val < 70)
123+
return 100;
124+
if (val < 300)
125+
return 500;
126+
return rounding(val * 100) / 100;
112127
}
113128

114129
public static double getYaxisUnit(double val, int height) {

scouter.client/src/scouter/client/util/MenuUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import scouter.client.actions.OpenEQViewAction;
4444
import scouter.client.actions.OpenServiceGroupElapsedAction;
4545
import scouter.client.actions.OpenServiceGroupTPSAction;
46+
import scouter.client.actions.OpenVerticalEQViewAction;
4647
import scouter.client.actions.SetColorAction;
4748
import scouter.client.batch.actions.OpenCxtmenuBatchActiveListAction;
4849
import scouter.client.batch.actions.OpenCxtmenuBatchHistoryAction;
@@ -506,6 +507,7 @@ public static void addObjTypeSpecialMenu(IWorkbenchWindow win, IMenuManager mgr,
506507
mgr.add(new Separator());
507508
mgr.add(new OpenRTPairAllAction(win, "Heap Memory", serverId, objType, CounterConstants.JAVA_HEAP_TOT_USAGE));
508509
mgr.add(new OpenEQViewAction(win, serverId, objType));
510+
mgr.add(new OpenVerticalEQViewAction(win, serverId, objType));
509511
mgr.add(new OpenActiveServiceListAction(win, objType, Images.thread, serverId));
510512
mgr.add(new OpenActiveSpeedAction(win,objType, Images.TYPE_ACTSPEED, serverId));
511513
mgr.add(new OpenXLogRealTimeAction(win, MenuStr.XLOG, objType, Images.star, serverId));

scouter.client/src/scouter/client/views/EQCommonView.java

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,16 @@ protected void buildBars() {
249249
int noOfAct2 = (int) (noOfBars * ((double)asd.act2 / total));
250250
int noOfAct3 = (int) (noOfBars * ((double)asd.act3 / total));
251251
int sediments = noOfBars - (noOfAct1 + noOfAct2 + noOfAct3);
252-
while (sediments > 0) {
252+
while (sediments >= 0) {
253253
if (asd.act3 > 0) {
254254
noOfAct3++;
255255
sediments--;
256256
}
257-
if (sediments > 0 && asd.act2 > 0) {
257+
if (sediments >= 0 && asd.act2 > 0) {
258258
noOfAct2++;
259259
sediments--;
260260
}
261-
if (sediments > 0 && asd.act1 > 0) {
261+
if (sediments >= 0 && asd.act1 > 0) {
262262
noOfAct1++;
263263
sediments--;
264264
}
@@ -299,7 +299,56 @@ protected void buildBars() {
299299
gc.setFont(verdana10Bold);
300300
gc.setForeground(black);
301301
String v = Long.toString(total);
302-
gc.drawString(v, barX + (BAR_WIDTH * 2 ), AXIS_PADDING + (unitHeight * i) + ((unitHeight - gc.stringExtent(v).y) / 2) , true);
302+
303+
String all = "(" + Long.toString(asd.act3) + " / " + Long.toString(asd.act2) + " / " + Long.toString(asd.act1) + ")";
304+
305+
int xaxis = barX + (BAR_WIDTH * 2);
306+
int yaxis = AXIS_PADDING + (unitHeight * i) + ((unitHeight - gc.stringExtent(v).y) / 2);
307+
308+
if (total > 0 && unitHeight >= 40) {
309+
xaxis += ((gc.stringExtent(all).x / 2) * 0.7);
310+
yaxis -= (gc.stringExtent(all).y / 2);
311+
}
312+
gc.drawString(v, xaxis, yaxis, true);
313+
314+
if (total > 0 && unitHeight >= 40) {
315+
yaxis += gc.stringExtent(all).y;
316+
317+
gc.setFont(verdana7);
318+
xaxis = barX + (BAR_WIDTH * 2);
319+
v = "(";
320+
gc.drawString(v, xaxis, yaxis, true);
321+
322+
xaxis += gc.stringExtent(v).x + 1;
323+
gc.setForeground(ColorUtil.getInstance().ac3);
324+
v = Long.toString(asd.act3);
325+
gc.drawString(v, xaxis, yaxis, true);
326+
327+
xaxis += gc.stringExtent(v).x + 1;
328+
gc.setForeground(black);
329+
v = " / ";
330+
gc.drawString(v, xaxis, yaxis, true);
331+
332+
xaxis += gc.stringExtent(v).x + 1;
333+
gc.setForeground(ColorUtil.getInstance().ac2);
334+
v = Long.toString(asd.act2);
335+
gc.drawString(v, xaxis, yaxis, true);
336+
337+
xaxis += gc.stringExtent(v).x + 1;
338+
gc.setForeground(black);
339+
v = " / ";
340+
gc.drawString(v, xaxis, yaxis, true);
341+
342+
xaxis += gc.stringExtent(v).x + 1;
343+
gc.setForeground(ColorUtil.getInstance().ac1);
344+
v = Long.toString(asd.act1);
345+
gc.drawString(v, xaxis, yaxis, true);
346+
347+
xaxis += gc.stringExtent(v).x + 1;
348+
gc.setForeground(black);
349+
v = ")";
350+
gc.drawString(v, xaxis, yaxis, true);
351+
}
303352
}
304353
}
305354

0 commit comments

Comments
 (0)