码迷,mamicode.com
首页 > 其他好文 > 详细

跟踪asio日志

时间:2018-06-14 18:39:15      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:some   start   esc   cal   his   cas   color   ado   seconds   

跟踪asio日志
#define BOOST_ASIO_ENABLE_HANDLER_TRACKING
#include <boost/asio.hpp>
./a.out 2>out.log
sudo apt-get install graphviz
perl handlerviz.pl < out.log | dot -Tpng > out.png

@asio|1528964168.087468|01|signal_set@0x7ffc87552888.async_wait
@asio|1528964168.087629|0
2|signal_set@0x7ffc87552888.async_waitbr/>@asio|1528964181.199519|>1|ec=system:0,signal_number=10
@asio|1528964181.199596|<1|
br/>@asio|1528964181.199628|>2|ec=system:0,signal_number=10
@asio|1528964181.199671|<2|
@asio|1528964181.199717|0|signal_set@0x7ffc87552888.cancel

技术分享图片

out.log格式解释,请参考 https://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/overview/core/handler_tracking.html

摘抄过来:
Each line is of the form:

<tag>|<timestamp>|<action>|<description>

The <tag> is always @asio, and is used to identify and extract the handler tracking messages from the program output.

The <timestamp> is seconds and microseconds from 1 Jan 1970 UTC.

The <action> takes one of the following forms:

n

The program entered the handler number n. The <description> shows the arguments to the handler. 

<n

The program left handler number n. 

!n

The program left handler number n due to an exception. 

~n

The handler number n was destroyed without having been invoked. This is usually the case for any unfinished asynchronous operations when the io_service is destroyed. 

n*m

The handler number n created a new asynchronous operation with completion handler number m. The <description> shows what asynchronous operation was started. 

n

The handler number n performed some other operation. The <description> shows what function was called. Currently only close() and cancel() operations are logged, as these may affect the state of pending asynchronous operations. 

Where the <description> shows a synchronous or asynchronous operation, the format is <object-type>@<pointer>.<operation>. For handler entry, it shows a comma-separated list of arguments and their values.

As shown above, Each handler is assigned a numeric identifier. Where the handler tracking output shows a handler number of 0, it means that the action was performed outside of any handler.

跟踪asio日志

标签:some   start   esc   cal   his   cas   color   ado   seconds   

原文地址:http://blog.51cto.com/frankniefaquan/2129427

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!