[Erlang31]Erlang trace总结
.特定进程集内的函数调用输入输出,收发消息------trace 指定Processes{module,function,arity};
.特定端口集的输入输出,收发消息---------------trace 指定ports。
• sys comes standard with OTP and allows to set custom tracing functions, log all kinds of events, and so on. It’s generally complete and fine to use for development. It suffers a bit in production because it doesn’t redirect IO to remote shells, and doesn’t have rate-limiting capabilities for trace messages. It is still recommended to read the documentationfor the module.• dbg also comes standard with Erlang/OTP. Its interface is a bit clunky in terms of usability, but it’s entirely good enough to do what you need. The problem with it is that you have to know what you’re doing, because dbg can log absolutely everything on the node and kill one in under two seconds.• tracing BIFs are available as part of the erlang module. They’re mostly the raw blocks used by all the applications mentioned in this list, but their lower level of abstraction makes them rather difficult to use.• redbug is a production-safe tracing library, part of the eper 5 suite. It has an internal rate-limiter, and a nice usable interface. To use it, you must however be willing to add in all of eper’s dependencies. The toolkit is fairly comprehensive and can be a very interesting install.• recon_trace is recon’s take on tracing. The objective was to allow the same levels of safety as with redbug, but without the dependencies. The interface is different, and the rate-limiting options aren’t entirely identical. It can also only trace function calls, and not messages.
. 指定trace的进程集;
. 指定模块中指定的函数的指定入参。
%%% _,--------,_ _,--------,_
%%% ,-' `-,,-' `-,
%%% ,-' ,-' '-, `-,
%%% | Matching -' '- Matching |
%%% | Pids | Getting | Trace |
%%% | | Traced | Patterns |
%%% | -, ,- |
%%% '-, '-, ,-' ,-'
%%% '-,_ _,-''-,_ _,-'
%%% '--------' '--------'
%%%
1.先从指定模块,函数,和参数开始:
> dbg:start(). % start dbg
> dbg:tracer(). % start a simple tracer process
> dbg:tp(Module, Function, Arity, []). % specify MFA you are interested in
> dbg:p(all, c). % trace calls (c) of that MFA for all processes. ... trace here > dbg:stop_clear(). % stop tracer and clear effect of tp and p calls.
> dbg:tpl(Module, '_', []). % all calls in Module
> dbg:tpl(Module, Function, '_', []). % all calls to Module:Function with any arity.
> dbg:tpl(Module, Function, Arity, []). % all calls to Module:Function/Arity.
> dbg:tpl(M, F, A, [{'_', [], [{return_trace}]}]). % same as before, but also show return value.
1> dbg:fun2ms(fun([M,N]) when N > 3 -> return_trace() end).
[{['$1','$2'],[{'>','$2',3}],[{return_trace}]}]
> dbg:p(all, c). % trace calls to selected functions by all functions
> dbg:p(new, c). % trace calls by processes spawned from now on
> dbg:p(Pid, c). % trace calls by given process
> dbg:p(Pid, [c, m]). % trace calls and messages of a given process
>dbg:tracer(port,dbg:trace_port(file,{"/log/trace",wrap,atom_to_list(node())})).
1.接口太过复杂,使用步骤复杂:start----》自定义的trace-----》stop;
2.没有输出日志次数控制,在生产环境中使用不当时会导致异常:不安全!
1.接口使用简单,他只需要调用一个函数calls/2 calls/3就可以trace;
2. 有次数限制和速度限制;
3.输出的trace比的默认的trace易读性强。
参考资料
[Erlang31]Erlang trace总结的更多相关文章
- Erlang Trace机制
从FTP模块学习先进的诊断技术(Erlang Trace机制) http://blog.yufeng.info/archives/466
- erlang调试技术之etop
etop是erlang进程信息查看工具,类似于UNIX的top. 一.配置参数 node The measured node. Value: atom() Mandatory setcookie Co ...
- Erlang 不同版本内容
OTP 22.0 Erlang/OTP 22是一个新的主要版本,具有新的特性和改进,同时也具有不兼容性. 要更深入地了解OTP 22发行版的亮点,您可以阅读我们的博客: http://blog.erl ...
- [Erlang 0119] Erlang OTP 源码阅读指引
上周Erlang讨论群里面提到lists的++实现,争论大多基于猜测,其实打开代码看一下就都明了.贴出代码截图后有同学问这代码是哪里找的? "代码去哪里找?",关于Erla ...
- erlang 故障排查工具
系统级别perf top, dstat -tam, vtune 都能很好分析beam 瓶颈,本文主要erlang 级别排查: 1. 反编译 确认线上运行代码是否正确,reltools没掌握好,升级偶尔 ...
- erlang note
没有关于erlang interface ,继续寻找吧... --------------------------------------------------------------- erl - ...
- 为什么Erlang比C慢那么多倍?
Erlang 一直以慢“著称”,本文就来看看 Erlang 慢在什么地方,为什么比实现同样功能的 C 语言程序慢那么多倍.Erlang 作为一种虚拟机解释的语言,慢是当然的.不过本文从细节上分析为什么 ...
- Erlang generic standard behaviours -- gen_server module
在分析完gen module (http://www.cnblogs.com/--00/p/4271386.html)之后,就可以开始进入gen_server 的主体module 了.gen_serv ...
- Erlang generic standard behaviours -- gen
在分析 gen_server (或者是gen_fsm )之前,首先应该弄明白,gen 这个module . -module(gen). -compile({inline,[get_node/1]}). ...
随机推荐
- umount时目标忙解决办法
标签(空格分隔): ceph ceph运维 osd 在删除osd后umount时,始终无法umonut,可以通过fuser查看设备被哪个进程占用,之后杀死进程,就可以顺利umount了. [root@ ...
- MU-MIMO学习
设备的认证查询 https://www.wi-fi.org/product-finder 1. MU-MIMO不会增大无线的最大速度 2. MU-MIMO需要路由器和客户端同时支持 3. 当你没有或者 ...
- 利用PHP实现页面跳转同时POST传参,CURL不行
function payto(){ echo "<form style='display:none;' id='form1' name='form1' method='post' ac ...
- Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 是由 ...
- Selenium Webdriver——处理Table
html table是由 table 元素以及一个或多个 tr.th 或 td 元素组成.如下: HTML源码如下: <html> <head> <meta http-e ...
- IntelliJ Idea 常用快捷键列表 (需整理下) https://blog.csdn.net/dc_726/article/details/42784275
[常规] https://blog.csdn.net/dc_726/article/details/42784275https://jingyan.baidu.com/article/59a015e3 ...
- 28.OGNL与ValueStack(VS)-总结$ # %的区别
转自:https://wenku.baidu.com/view/84fa86ae360cba1aa911da02.html $用于i18n和struts配置文件 #取得ActionContext的值 ...
- spring mvc 映射器和适配器
映射器和适配器 1.非注解的映射器和适配器 a. 入门程序中的单个映射 BeanNameUrlHandlerMapping SimpleControllerHandlerAdapter b.另一种ma ...
- 7.25 10figting!
TEXT 88 European utilities欧洲公用事业 Power struggles 能源之争(陈继龙编译) Nov 30th 2006 From The Economist print ...
- 快速变幻AABB的顶点
[快速变幻AABB的顶点] 当要变幻一个AABB时,可以快速计算变幻后顶点的AABB.当有旋转时,根据8个顶点变幻后的AABB可能会更大. AABB的八个顶点需分别作如下变幻: 注意到为了使 x' 最 ...