问题描述
multitrace是ttb应用带的一个例子,给了个例子让用户来格式化和定制自己的dbg信息。 文档在这里: The module multitrace.erl which can be found in the src directory of the Ob** application implements a small tool with three possible trace settings. The trace messages are written to binary files which can be formatted with the function multitrace:format/1/2.代码太长,我就不贴了,可以点这里查看.我演示下如何使用:$ pwd002 003/home/chuba/otp/lib/ob**/src004 005$ erlc multitrace.erl006 007$ erl008 009Erlang R14B04 (erts-5.8.5) 1 010 011 012 013Eshell V5.8.5 (abort with ^G)014 0151> multitrace:schedule(self()). 016 017ok018 0192> erlang:ports().020 021024 0253> multitrace:stop(). 026 027stopped028 0294> multitrace:format("nonode@nohost-schedule_trace").030 031 032 033Tracing started on node nonode@nohost at 2011-10-27 16:29:40,984702034 035Flags: [{,}]036 037 038 039 040 041in:042 043Process : 044 045Time : 2011-10-27 16:29:40,984453046 047Function : {dbg,req,1}048 049 050 051out:052 053Process : 054 055Time : 2011-10-27 16:29:40,984528056 057Function : {io,wait_io_mon_reply,2}058 059 060 061in:062 063Process : 064 065Time : 2011-10-27 16:29:40,984582066 067Function : {io,wait_io_mon_reply,2}068 069 070 071out:072 073Process : 074 075Time : 2011-10-27 16:29:40,984635076 077Function : {io,wait_io_mon_reply,2}078 079 080 081in:082 083Process : 084 085Time : 2011-10-27 16:29:40,984662086 087Function : {io,wait_io_mon_reply,2}088 089 090 091out:092 093Process : 094 095Time : 2011-10-27 16:29:40,984720096 097Function : {shell,eval_loop,3}098 099 100 101in:102 103Process : 104 105Time : 2011-10-27 16:30:32,215798106 107Function : {shell,eval_loop,3}108 109 110 111out:112 113Process : 114 115Time : 2011-10-27 16:30:32,216096116 117Function : {code_**,call,2}118 119 120 121in:122 123Process : 124 125Time : 2011-10-27 16:30:32,216155126 127Function : {code_**,call,2}128 129 130 131Total time 'in' for process : 484 micro seconds132 133ok134 13513>我们可以在自己的项目里面结合ttb做些调试模块,方便在出现问题的时候定位问题。祝玩得开心!