Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
山不在高_有仙则灵
SkyWalking
提交
3aa2156e
S
SkyWalking
项目概览
山不在高_有仙则灵
/
SkyWalking
与 Fork 源项目一致
Fork自
apache / SkyWalking
通知
12
Star
0
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SkyWalking
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3aa2156e
编写于
1月 28, 2016
作者:
wu-sheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.移除webui/src下的测试用例
上级
221378d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
137 addition
and
124 deletion
+137
-124
skywalking-webui/src/main/java/com/ai/cloud/util/common/SortUtil.java
...ebui/src/main/java/com/ai/cloud/util/common/SortUtil.java
+0
-124
skywalking-webui/src/test/java/com/ai/cloud/util/common/SortTest.java
...ebui/src/test/java/com/ai/cloud/util/common/SortTest.java
+137
-0
未找到文件。
skywalking-webui/src/main/java/com/ai/cloud/util/common/SortUtil.java
浏览文件 @
3aa2156e
...
...
@@ -3,21 +3,11 @@
*/
package
com.ai.cloud.util.common
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.Test
;
import
com.ai.cloud.dao.impl.BuriedPointSDAO
;
import
com.ai.cloud.util.Constants
;
import
com.ai.cloud.vo.mvo.TraceLogEntry
;
...
...
@@ -73,118 +63,4 @@ public class SortUtil {
return
false
;
}
}
/**
* 测试读取hbase 测试自动补充父级节点 测试排序
*
* @throws IOException
* @throws NoSuchMethodException
* @throws InvocationTargetException
* @throws IllegalAccessException
*
*/
@Test
public
void
testSelectByTraceId
()
throws
IOException
,
IllegalAccessException
,
InvocationTargetException
,
NoSuchMethodException
{
BuriedPointSDAO
sdao
=
new
BuriedPointSDAO
();
Map
<
String
,
TraceLogEntry
>
bpe
=
sdao
.
queryLogByTraceId
(
Constants
.
TABLE_NAME_CHAIN
,
"71e28364128847b3a12626966b60fd8f123"
);
List
<
TraceLogEntry
>
keyList
=
new
ArrayList
<
TraceLogEntry
>();
keyList
.
addAll
(
bpe
.
values
());
Collections
.
sort
(
keyList
,
new
Comparator
<
TraceLogEntry
>()
{
@Override
public
int
compare
(
TraceLogEntry
arg0
,
TraceLogEntry
arg1
)
{
return
arg0
.
getColId
().
compareTo
(
arg1
.
getColId
());
}
});
int
m
=
1
;
for
(
TraceLogEntry
tmpEntry
:
keyList
)
{
logger
.
info
(
"sort result level:{} : {}"
,
m
++,
tmpEntry
);
}
}
/***
* 深度补全测试
*
* @throws IOException
*/
@Test
public
void
testGenTreeMapKey
()
throws
IOException
{
StringBuffer
sb
=
new
StringBuffer
(
"0"
);
/***
* 深度测试 level 5 [ 11ms ] level 10[ 11ms ] level 15[ 11ms ] level 20[
* 12ms ] level 50[ 12ms ] level 100[ 12ms ] level 500[ 12ms ] level
* 1000[ 16ms ] level 2000[ 28ms ] level 5000[ 144ms ] level10000[ 445ms
* ]
*/
for
(
int
i
=
1
;
i
<
10000
;
i
++)
{
sb
.
append
(
".0"
);
}
String
colId
=
sb
.
toString
();
TraceLogEntry
tmpEntry
=
null
;
Map
<
String
,
TraceLogEntry
>
reMap
=
new
HashMap
<
String
,
TraceLogEntry
>();
long
startTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"start time : {}"
,
startTime
);
addCurNodeTreeMapKey
(
reMap
,
colId
,
tmpEntry
);
long
endTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"end time : {}"
,
endTime
);
logger
.
info
(
"run time : {} ms"
,
(
endTime
-
startTime
));
// List<String> keyList = new ArrayList<String>();
// keyList.addAll(reMap.keySet());
// Collections.sort(keyList);
// int m = 1;
// for (String str : keyList) {
// logger.info("sort result level:{} : {}", m++, str);
// }
}
/***
* collection sort 性能测试
*
* @param args
*/
@Test
public
void
testSortList
()
{
List
<
String
>
StrList
=
new
ArrayList
<
String
>();
Random
random
=
new
Random
(
System
.
currentTimeMillis
());
StrList
.
add
(
"0"
);
/***
* Collections.sort(StrList)性能 1000条/19 ms 10000条/42 ms 100000条/129 ms
* 1000000条/1070 ms
*/
for
(
int
m
=
0
;
m
<
1000
;
m
++)
{
String
radNum
=
""
+
Math
.
abs
(
random
.
nextLong
());
StringBuffer
tmpBf
=
new
StringBuffer
(
"0"
);
for
(
int
n
=
0
;
n
<
radNum
.
length
();
n
++)
{
tmpBf
.
append
(
"."
).
append
(
radNum
.
charAt
(
n
));
}
StrList
.
add
(
tmpBf
.
toString
());
}
long
startTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"start time : {}"
,
startTime
);
Collections
.
sort
(
StrList
);
long
endTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"end time : {}"
,
endTime
);
logger
.
info
(
"run time : {} ms"
,
(
endTime
-
startTime
));
// int i = 1;
// for (String tmpStr : StrList) {
// logger.info("sort {} : {}", i++, tmpStr);
// }
}
}
skywalking-webui/src/test/java/com/ai/cloud/util/common/SortTest.java
0 → 100644
浏览文件 @
3aa2156e
package
com.ai.cloud.util.common
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.junit.Test
;
import
com.ai.cloud.dao.impl.BuriedPointSDAO
;
import
com.ai.cloud.util.Constants
;
import
com.ai.cloud.vo.mvo.TraceLogEntry
;
public
class
SortTest
{
private
static
Logger
logger
=
LogManager
.
getLogger
(
SortUtil
.
class
);
/**
* 测试读取hbase 测试自动补充父级节点 测试排序
*
* @throws IOException
* @throws NoSuchMethodException
* @throws InvocationTargetException
* @throws IllegalAccessException
*
*/
@Test
public
void
testSelectByTraceId
()
throws
IOException
,
IllegalAccessException
,
InvocationTargetException
,
NoSuchMethodException
{
BuriedPointSDAO
sdao
=
new
BuriedPointSDAO
();
Map
<
String
,
TraceLogEntry
>
bpe
=
sdao
.
queryLogByTraceId
(
Constants
.
TABLE_NAME_CHAIN
,
"71e28364128847b3a12626966b60fd8f123"
);
List
<
TraceLogEntry
>
keyList
=
new
ArrayList
<
TraceLogEntry
>();
keyList
.
addAll
(
bpe
.
values
());
Collections
.
sort
(
keyList
,
new
Comparator
<
TraceLogEntry
>()
{
@Override
public
int
compare
(
TraceLogEntry
arg0
,
TraceLogEntry
arg1
)
{
return
arg0
.
getColId
().
compareTo
(
arg1
.
getColId
());
}
});
int
m
=
1
;
for
(
TraceLogEntry
tmpEntry
:
keyList
)
{
logger
.
info
(
"sort result level:{} : {}"
,
m
++,
tmpEntry
);
}
}
/***
* 深度补全测试
*
* @throws IOException
*/
@Test
public
void
testGenTreeMapKey
()
throws
IOException
{
StringBuffer
sb
=
new
StringBuffer
(
"0"
);
/***
* 深度测试 level 5 [ 11ms ] level 10[ 11ms ] level 15[ 11ms ] level 20[
* 12ms ] level 50[ 12ms ] level 100[ 12ms ] level 500[ 12ms ] level
* 1000[ 16ms ] level 2000[ 28ms ] level 5000[ 144ms ] level10000[ 445ms
* ]
*/
for
(
int
i
=
1
;
i
<
10000
;
i
++)
{
sb
.
append
(
".0"
);
}
String
colId
=
sb
.
toString
();
TraceLogEntry
tmpEntry
=
null
;
Map
<
String
,
TraceLogEntry
>
reMap
=
new
HashMap
<
String
,
TraceLogEntry
>();
long
startTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"start time : {}"
,
startTime
);
SortUtil
.
addCurNodeTreeMapKey
(
reMap
,
colId
,
tmpEntry
);
long
endTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"end time : {}"
,
endTime
);
logger
.
info
(
"run time : {} ms"
,
(
endTime
-
startTime
));
// List<String> keyList = new ArrayList<String>();
// keyList.addAll(reMap.keySet());
// Collections.sort(keyList);
// int m = 1;
// for (String str : keyList) {
// logger.info("sort result level:{} : {}", m++, str);
// }
}
/***
* collection sort 性能测试
*
* @param args
*/
@Test
public
void
testSortList
()
{
List
<
String
>
StrList
=
new
ArrayList
<
String
>();
Random
random
=
new
Random
(
System
.
currentTimeMillis
());
StrList
.
add
(
"0"
);
/***
* Collections.sort(StrList)性能 1000条/19 ms 10000条/42 ms 100000条/129 ms
* 1000000条/1070 ms
*/
for
(
int
m
=
0
;
m
<
1000
;
m
++)
{
String
radNum
=
""
+
Math
.
abs
(
random
.
nextLong
());
StringBuffer
tmpBf
=
new
StringBuffer
(
"0"
);
for
(
int
n
=
0
;
n
<
radNum
.
length
();
n
++)
{
tmpBf
.
append
(
"."
).
append
(
radNum
.
charAt
(
n
));
}
StrList
.
add
(
tmpBf
.
toString
());
}
long
startTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"start time : {}"
,
startTime
);
Collections
.
sort
(
StrList
);
long
endTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"end time : {}"
,
endTime
);
logger
.
info
(
"run time : {} ms"
,
(
endTime
-
startTime
));
// int i = 1;
// for (String tmpStr : StrList) {
// logger.info("sort {} : {}", i++, tmpStr);
// }
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录