Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
youngwolf
st_asio_wrapper
提交
5e0bf6e1
S
st_asio_wrapper
项目概览
youngwolf
/
st_asio_wrapper
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
st_asio_wrapper
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5e0bf6e1
编写于
8月 08, 2016
作者:
Y
youngwolf
提交者:
youngowlf
4月 27, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sync doc.
上级
cf8f97a3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
8 deletion
+39
-8
compatible_edition/include/st_asio_wrapper_socket.h
compatible_edition/include/st_asio_wrapper_socket.h
+3
-3
doc/st_socket
doc/st_socket
+33
-2
include/st_asio_wrapper_socket.h
include/st_asio_wrapper_socket.h
+3
-3
未找到文件。
compatible_edition/include/st_asio_wrapper_socket.h
浏览文件 @
5e0bf6e1
...
...
@@ -114,9 +114,9 @@ public:
stat_duration
send_time_sum
;
//from asio::async_write to send_handler, this indicate your network's speed or load
//recv corresponding statistic
boost
::
uint_fast64_t
recv_msg_sum
;
//include msgs in receiving buffer
(still not dispatched)
boost
::
uint_fast64_t
recv_byte_sum
;
//include msgs in receiving buffer
(still not dispatched)
stat_duration
dispatch_dealy_sum
;
//from parse_msg(exclude msg unpacking) to on_handle
boost
::
uint_fast64_t
recv_msg_sum
;
//include msgs in receiving buffer
boost
::
uint_fast64_t
recv_byte_sum
;
//include msgs in receiving buffer
stat_duration
dispatch_dealy_sum
;
//from parse_msg(exclude msg unpacking) to on_
msg_
handle
stat_duration
recv_idle_sum
;
//during this duration, st_socket suspended msg reception because of full receiving buffer, posting msgs or invoke on_msg
#ifndef ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER
...
...
doc/st_socket
浏览文件 @
5e0bf6e1
...
...
@@ -10,10 +10,41 @@ template<typename Socket, typename Packer, typename Unpacker, typename InMsgType
class st_socket: public st_timer
{
public:
效率统计,注意这个功能会轻微的影响性能,默认关闭,可以通过ST_ASIO_FULL_STATISTIC宏来开启。在关闭情况下,所有整数项统计(uint_fast64_t)仍然有效,
所有时间统计项将无效(stat_duration)。在打开情况下,时间统计的数据类型其实是boost::posix_time::time_duration。
struct statistic
{
statistic();
void reset();
由于统计涉及多个方面,并且是多线程修改不同的部分,这个函数只是在某些特殊情况下才可以调用,比如在构造函数里面,或者只有一个service线程,
所以这个函数基本上还是用在对象重用时。
statistic& operator +=(const struct statistic& other);
std::string to_string() const;
消息发送相关的统计
uint_fast64_t send_msg_sum; 成功发送到asio的消息条数
uint_fast64_t send_byte_sum; 成功发送到asio的消息总字节数
stat_duration send_delay_sum; 从消息发送(send_(native_)msg, post_(native_)msg,不包括打包时间)到真正发送(asio::async_write)的延迟时间
stat_duration send_time_sum; 从真正的消息发送(asio::async_write)到发送完成(发送到SOCKET缓存),这一项体现了你的网络吞吐率,注意吞吐率低
不代表是你的问题,也有可能是接收方慢了。
消息接收相关统计
uint_fast64_t recv_msg_sum; 收到的消息条数
uint_fast64_t recv_byte_sum; 收到的消息总字节数
stat_duration dispatch_dealy_sum; 从消息解包完成之后,到on_msg_handle的时间延迟,如果这项偏大,可能是因为service线程总不够用
stat_duration recv_idle_sum; 暂停消息接收的总时间,如果接收缓存满,或者在发送缓存满的情况下调用了post_(native_)msg,将会暂停消息接收,
注意,在回调on_msg期间,也算是暂停了消息接收。
#ifndef ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER
stat_duration handle_time_1_sum; 调用on_msg花费的总时间
#endif
stat_duration handle_time_2_sum; 调用on_msg_handle花费的总时间
};
protected:
typedef boost::container::list<InMsgType> in_container_type;
typedef typename Unpacker::container_type out_container_type;
protected:
st_socket(boost::asio::io_service& io_service_);
template<typename Arg>
...
...
@@ -95,7 +126,7 @@ post_msg不受这个属性的影响,所以post_msg一定只能在on_msg和on_m
bool direct_post_msg(const InMsgType& msg, bool can_overflow = false);
bool direct_post_msg(InMsgType&& msg, bool can_overflow = false);
同上,它们之前的区别就是send_msg和post_msg之间的区别。
size_t get_pending_post_msg_num();
size_t get_pending_send_msg_num();
size_t get_pending_recv_msg_num();
...
...
include/st_asio_wrapper_socket.h
浏览文件 @
5e0bf6e1
...
...
@@ -114,9 +114,9 @@ public:
stat_duration
send_time_sum
;
//from asio::async_write to send_handler, this indicate your network's speed or load
//recv corresponding statistic
uint_fast64_t
recv_msg_sum
;
//include msgs in receiving buffer
(still not dispatched)
uint_fast64_t
recv_byte_sum
;
//include msgs in receiving buffer
(still not dispatched)
stat_duration
dispatch_dealy_sum
;
//from parse_msg(exclude msg unpacking) to on_handle
uint_fast64_t
recv_msg_sum
;
//include msgs in receiving buffer
uint_fast64_t
recv_byte_sum
;
//include msgs in receiving buffer
stat_duration
dispatch_dealy_sum
;
//from parse_msg(exclude msg unpacking) to on_
msg_
handle
stat_duration
recv_idle_sum
;
//during this duration, st_socket suspended msg reception because of full receiving buffer, posting msgs or invoke on_msg
#ifndef ST_ASIO_FORCE_TO_USE_MSG_RECV_BUFFER
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录