Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
acb046f7
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
acb046f7
编写于
7月 15, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine cube_cli.cpp
上级
b93572ea
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
14 deletion
+26
-14
core/cube/cube-api/src/cube_cli.cpp
core/cube/cube-api/src/cube_cli.cpp
+26
-14
未找到文件。
core/cube/cube-api/src/cube_cli.cpp
浏览文件 @
acb046f7
...
...
@@ -13,6 +13,7 @@
// limitations under the License.
#include <gflags/gflags.h>
#include <algorithm>
#include <atomic>
#include <fstream>
#include <thread> //NOLINT
...
...
@@ -33,7 +34,7 @@ std::atomic<int> g_concurrency(0);
std
::
vector
<
std
::
vector
<
uint64_t
>>
time_list
;
std
::
vector
<
uint64_t
>
request_list
;
int
turns
=
1000
000
/
FLAGS_batch
;
int
turns
=
1000
;
namespace
{
inline
uint64_t
time_diff
(
const
struct
timeval
&
start_time
,
...
...
@@ -94,14 +95,15 @@ int run(int argc, char** argv, int thread_id) {
uint64_t
file_size
=
key_list
.
size
();
uint64_t
index
=
0
;
uint64_t
request
=
0
;
while
(
g_concurrency
.
load
()
>=
FLAGS_thread_num
)
{
}
g_concurrency
++
;
time_list
[
thread_id
].
resize
(
turns
);
while
(
index
<
file_size
)
{
while
(
request
<
turns
)
{
// uint64_t key = strtoul(buffer, NULL, 10);
if
(
index
>=
file_size
)
{
index
=
0
;
}
keys
.
push_back
(
key_list
[
index
]);
index
+=
1
;
int
ret
=
0
;
...
...
@@ -160,7 +162,8 @@ int run_m(int argc, char** argv) {
uint64_t
sum_time
=
0
;
uint64_t
max_time
=
0
;
uint64_t
min_time
=
1000000
;
uint64_t
request_num
=
0
;
std
::
vector
<
uint64_t
>
all_time_list
;
all_time_list
.
resize
(
turns
*
thread_num
);
for
(
int
i
=
0
;
i
<
thread_num
;
i
++
)
{
for
(
int
j
=
0
;
j
<
request_list
[
i
];
j
++
)
{
sum_time
+=
time_list
[
i
][
j
];
...
...
@@ -170,19 +173,28 @@ int run_m(int argc, char** argv) {
if
(
time_list
[
i
][
j
]
<
min_time
)
{
min_time
=
time_list
[
i
][
j
];
}
all_time_list
.
push_back
(
time_list
[
i
][
j
]);
}
request_num
+=
request_list
[
i
];
}
std
::
sort
(
all_time_list
.
begin
(),
all_time_list
.
end
());
uint64_t
mean_time
=
sum_time
/
(
thread_num
*
turns
);
uint64_t
main_time
=
time_diff
(
main_start
,
main_end
);
LOG
(
INFO
)
<<
"
\n
"
<<
thread_num
<<
" thread seek cost"
<<
"
\n
avg = "
<<
std
::
to_string
(
mean_time
)
<<
"
\n
max = "
<<
std
::
to_string
(
max_time
)
<<
"
\n
min = "
<<
std
::
to_string
(
min_time
);
LOG
(
INFO
)
<<
"
\n
total_request = "
<<
std
::
to_string
(
request_num
)
<<
"
\n
speed = "
<<
std
::
to_string
(
request_num
*
1000000
/
main_time
)
// mean_time us
uint64_t
request_num
=
turns
*
thread_num
;
LOG
(
INFO
)
<<
"
\n
"
<<
thread_num
<<
" thread seek cost"
<<
"
\n
avg: "
<<
std
::
to_string
(
mean_time
)
<<
"
\n
50 percent: "
<<
std
::
to_string
(
all_time_list
[
static_cast
<
int
>
(
0.5
*
request_num
)])
<<
"
\n
80 percent: "
<<
std
::
to_string
(
all_time_list
[
static_cast
<
int
>
(
0.8
*
request_num
)])
<<
"
\n
90 percent: "
<<
std
::
to_string
(
all_time_list
[
static_cast
<
int
>
(
0.9
*
request_num
)])
<<
"
\n
99 percent: "
<<
std
::
to_string
(
all_time_list
[
static_cast
<
int
>
(
0.99
*
request_num
)])
<<
"
\n
999 percent: "
<<
std
::
to_string
(
all_time_list
[
static_cast
<
int
>
(
0.999
*
request_num
)]);
LOG
(
INFO
)
<<
"
\n
total_request: "
<<
std
::
to_string
(
request_num
)
<<
"
\n
speed: "
<<
std
::
to_string
(
turns
*
1000000
/
main_time
)
// mean_time us
<<
" query per second"
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录