PageRenderTime 55ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/erlang_otp/lib/inviso-0.6/doc/html/inviso.html

https://bitbucket.org/docs/docs.bitbucket.org
HTML | 850 lines | 843 code | 7 blank | 0 comment | 0 complexity | 95f10ef37bb460071121ccc623f9c152 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Lib - Inviso-0.6 - Doc - Html - Inviso &mdash; Erlang/OTP vR13B02 documentation</title>
  7. <link rel="stylesheet" href="../../../../_static/default.css" type="text/css" />
  8. <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../../../../',
  12. VERSION: 'R13B02',
  13. COLLAPSE_MODINDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="../../../../_static/jquery.js"></script>
  19. <script type="text/javascript" src="../../../../_static/doctools.js"></script>
  20. <link rel="top" title="Erlang/OTP vR13B02 documentation" href="../../../../index.html" />
  21. </head>
  22. <body>
  23. <div class="related">
  24. <h3>Navigation</h3>
  25. <ul>
  26. <li class="right" style="margin-right: 10px">
  27. <a href="../../../../genindex.html" title="General Index"
  28. accesskey="I">index</a></li>
  29. <li><a href="../../../../index.html">Erlang/OTP vR13B02 documentation</a> &raquo;</li>
  30. </ul>
  31. </div>
  32. <div class="document">
  33. <div class="documentwrapper">
  34. <div class="bodywrapper">
  35. <div class="body">
  36. <div class="section" id="lib-inviso-0-6-doc-html-inviso">
  37. <h1>Lib - Inviso-0.6 - Doc - Html - Inviso<a class="headerlink" href="#lib-inviso-0-6-doc-html-inviso" title="Permalink to this headline"></a></h1>
  38. <p>` &lt;<a class="reference external" href="http://www.ericsson.com/technology/opensource/erlang">http://www.ericsson.com/technology/opensource/erlang</a>&gt;`__</p>
  39. <div class="section" id="inviso">
  40. <h2>inviso<a class="headerlink" href="#inviso" title="Permalink to this headline"></a></h2>
  41. <div class="section" id="module">
  42. <h3>MODULE<a class="headerlink" href="#module" title="Permalink to this headline"></a></h3>
  43. <p>inviso</p>
  44. </div>
  45. <div class="section" id="module-summary">
  46. <h3>MODULE SUMMARY<a class="headerlink" href="#module-summary" title="Permalink to this headline"></a></h3>
  47. <p>Main API Module to the Inviso Tracer</p>
  48. </div>
  49. <div class="section" id="description">
  50. <h3>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h3>
  51. <p>With the inviso API runtime components can be started and tracing
  52. managed across a network of distributed Erlang nodes, using a control
  53. component also started with inviso API functions.</p>
  54. <p>Inviso can be used both in a distributed environment and in a non-
  55. distributed. API functions not taking a list of nodes as argument
  56. works on all started runtime components. If it is the non-distributed
  57. case, that is the local runtime component. The API functions taking a
  58. list of nodes as argument, or as part of one of the arguments, can not
  59. be used in a non-distributed environment. Return values named
  60. NodeResult refers to return values from a single Erlang node, and will
  61. therefore be the return in the non-distributed environment.</p>
  62. </div>
  63. <div class="section" id="exports">
  64. <h3>EXPORTS<a class="headerlink" href="#exports" title="Permalink to this headline"></a></h3>
  65. <p>start() -&gt; {ok,pid()} | {error,Reason}
  66. start(Options) -&gt; {ok,pid()} | {error,Reason}</p>
  67. <p>Types:</p>
  68. <p>Options = [Option]</p>
  69. <p>Options may contain both options which will be default options to a
  70. runtime component when started, and options to the control component.
  71. See add_nodes/3 for details on runtime component options. The control
  72. component recognizes the following options:</p>
  73. <table class="docutils field-list" frame="void" rules="none">
  74. <col class="field-name" />
  75. <col class="field-body" />
  76. <tbody valign="top">
  77. <tr class="field"><th class="field-name" colspan="2">{subscribe,Pid}:</th></tr>
  78. <tr><td>&nbsp;</td><td class="field-body">Making the process Pid receive Inviso events from
  79. the control component. Starts a control component process on the local
  80. node. A control component must be started before runtime components
  81. can be started manually or otherwise accessed through the inviso API.</td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. <p>stop() -&gt; shutdown</p>
  86. <p>Stops the control component. Runtime components are left as is. They
  87. will behave according to their dependency values.</p>
  88. <p>add_node(RTtag) -&gt; NodeResult | {error,Reason}
  89. add_node(RTtag,Options) -&gt; NodeResult | {error,Reason}</p>
  90. <p>Types:</p>
  91. <p>RTtag = PreviousRTtag = term()
  92. Options = [Option]
  93. ?Option &#8211; see below
  94. ?Option = {dependency,Dep}
  95. ??Dep = int() | infinity</p>
  96. <p>The timeout, in milliseconds, before the runtime component will
  97. terminate if abandoned by this control component. ?Option =
  98. {overload,Overload} | overload
  99. Controls how and how often overload checks shall be performed. Just
  100. overloadspecifies that no loadcheck shall be performed. ??Overload =
  101. Interval | {LoadMF,Interval,InitMFA,RemoveMFA}
  102. ???LoadMF = {Mod,Func} | function()/1
  103. ???Interval = int() | infinity
  104. Interval is the time in milliseconds between overload checks.
  105. ???InitMFA = RemoveMFA = {Mod,Func,ArgList} | void
  106. When starting up the runtime component or when changing options (see
  107. change_options/2) the overload mechanism is initialized with a call to
  108. the InitMFAfunction. It shall return LoadCheckData. Every time a load
  109. check is performed, LoadMFis called with LoadCheckDataas its only
  110. argument. LoadMFshall return okor {suspend,Reason}. When the runtime
  111. component is stopped or made to change options involving changing
  112. overload-check, the RemoveMFAfunction is called. Its return value is
  113. discarded. NodeResult = {ok,NAns} | {error,Reason}
  114. ?NAns = new | {adopted,State,Status,PreviousRTtag} | already_added
  115. ??State = new | tracing | idle
  116. ??Status = running | {suspended,SReason}</p>
  117. <p>Starts or tries to connect to an existing runtime component at the
  118. local node, regardless if the system is distributed or not. Options
  119. will override any default options specified at start-up of the control
  120. component.</p>
  121. <p>The PreviousRTtag can indicate if the incarnation of the runtime
  122. component at the node in question was started by &#8220;us&#8221; and then can be
  123. expected to do tracing according to &#8220;our&#8221; instructions or not.</p>
  124. <p>add_node_if_ref(RTtag) -&gt; NodeResult |
  125. {error,{wrong_reference,OtherTag}} | {error,Reason}
  126. add_node_if_ref(RTtag,Options) -&gt; NodeResult |
  127. {error,{wrong_reference,OtherRef}} | {error,Reason}</p>
  128. <p>Types:</p>
  129. <p>OtherRef = term()</p>
  130. <p>rttag of the running incarnation
  131. As add_node/1,2 but will only adopt the runtime component if its rttag
  132. is RTtag.</p>
  133. <p>add_nodes(Nodes,RTtag) -&gt; {ok,NodeResults} | {error,Reason}
  134. add_nodes(Nodes,RTtag,Options) -&gt; {ok,NodeResults} | {error,Reason}</p>
  135. <p>Types:</p>
  136. <p>Nodes = [Node]
  137. NodeResults = [{Node,NodeResult}]</p>
  138. <p>As add_node/1,2 but for a distributed environment.</p>
  139. <p>add_nodes_if_ref(Nodes,RTtag) -&gt; NodeResult | {error,Reason}
  140. add_nodes_if_ref(Nodes,RTtag,Options) -&gt; NodeResult | {error,Reason}</p>
  141. <p>Types:</p>
  142. <p>Nodes = [Node]
  143. NodeResults = [{Node,NodeResult}]</p>
  144. <p>As add_node_if_ref/1,2 but for a distributed environment.</p>
  145. <p>stop_nodes() -&gt; {ok,NodeResults} | NodeResult
  146. stop_nodes(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  147. <p>Types:</p>
  148. <p>NodeResults = [{Node,NodeResult}]
  149. NodeResult = ok | {error,Reason}</p>
  150. <p>Stops runtime component on Nodes. stop_nodes/0 will if the control
  151. component is running on a distributed node stop all runtime
  152. components. And if running on a non distributed node, stop the local
  153. and only runtime component.</p>
  154. <p>stop_all() = {ok,NodeResults} | NodeResult</p>
  155. <p>Types:</p>
  156. <p>NodeResults = [{Node,NodeResult}]
  157. NodeResult = ok | {error,Reason}</p>
  158. <p>A combination of stop/0 and stop_nodes/0.</p>
  159. <p>change_options(Options) -&gt; NodeResult | {ok,NodeResults} |
  160. {error,Reason}
  161. change_options(Nodes,Options) -&gt; {ok,NodeResults} | {error,Reason}</p>
  162. <p>Types:</p>
  163. <p>Nodes = [Node]
  164. NodeResults = [{Node,NodeResult}]
  165. NodeResult = ok | {error,Reason}</p>
  166. <p>Changes the options for one or several runtime components. If for
  167. instance overload is redefined, the previous overload will be stopped
  168. and the new started. See add_node/1 for details on Options.</p>
  169. <p>init_tracing(TracerData) -&gt; {ok,NodeResults} | NodeResult |
  170. {error,Reason}
  171. init_tracing(TracerList) -&gt; {ok,NodeResults} | {error,Reason}
  172. init_tracing(Nodes,TracerData) -&gt; {ok,NodeResults} | {error,Reason}</p>
  173. <p>Types:</p>
  174. <p>TracerData = [{trace,LogTD} [,{ti,TiTD}] }] | LogTD
  175. LogTD = {HandlerFun,Data1} | collector | {relayer,CollectingNode} |
  176. {ip,IPPortParameters} | {file,FilePortParameters}
  177. TiTD = {file,FileName} | {file,FileName,TiSpec} | {relay,Node}
  178. ?TiSpec = {InitMFA,RemoveMF,CleanMF}
  179. ??InitMFA = {Mi,Fi,Argsi}
  180. ??RemoveMF = {Mr,Fr} | void
  181. ??CleanMF = {Mc,Fc}
  182. ??Mi = Fi = Mr = Fr = Mc = Fd = atom()
  183. ??Argsi = [term()]
  184. TracerList = [{Node,TracerData}]
  185. IPPortParameters = Portno | {Portno,Qsize}
  186. ?Portno = tcp_portno()
  187. ?Qsize = int()
  188. FilePortParameters = {Filename,wrap,Tail,{time,WrapTime},WrapCnt} |
  189. {FileName,wrap,Tail,WrapSize,WrapCnt} | {FileName,wrap,Tail,WrapSize}
  190. | {FileName,wrap,Tail} | FileName
  191. ?FileName = string()
  192. ?Tail = string() =/= &#8220;&#8221;
  193. ?WrapTime = WrapCnt = WrapSize = int() &gt;0
  194. TracerList = [{Node,TracerData}]
  195. Nodes = [Node]
  196. HandlerFun = function()/2;
  197. ?HandlerFun(TraceMsg,Data1) -&gt; NewData
  198. CollectingNode = pid() | node()
  199. NodeResults = [{Node,NodeResult}]
  200. NodeResult = {ok,LogResults} | {error,NReason}
  201. ?LogResults = [LogResult]
  202. ??LogResult = {trace_log,LogRes} | {ti_log,LogRes}
  203. ???LogRes = ok | {error,Reason}</p>
  204. <p>Starts the tracing at the specified nodes, meaning that the runtime
  205. components transits from the state new or idle to tracing. For trace
  206. messages to be generated, there must of course also be trace pattern
  207. and/or trace flags set. Such can not be set before tracing has been
  208. initiated with init_tracing/1,2.</p>
  209. <p>TracerData controls how the runtime component will handle generated
  210. trace messages. The trace tag controls how regular trace messages are
  211. handled. The ti tag controls if and how trace information will be
  212. stored and the meta tracer will be activated. That is if ti is
  213. omitted, no meta tracer will be started as part of the runtime
  214. component. It is possible to have ti without trace, but most likely
  215. not useful.</p>
  216. <p>The ip and file trace tracerdata instructions results in using the
  217. built in trace ip-port and file-port respectively. relayer will result
  218. in that all regular trace messages are forwarded to a runtime
  219. component at the specified node. Using a HandlerFun will result in
  220. that every incoming regular trace message is applied to the
  221. HandlerFun. collector can be used to use this runtime component to
  222. receive relayed trace messages and print them to the shell.</p>
  223. <p>The trace information can be configured to either write trace
  224. information to a plain trace information file or to relay it to
  225. another inviso meta tracer on another node. The inviso meta tracer is
  226. capable of matching function calls with their function returns (only
  227. if return_trace is activated in the meta trace match specification for
  228. the function in question). This is necessary since it may not be
  229. possible to decide what to do, if anything shall be done at all, until
  230. the return value of the function call is examined.</p>
  231. <p>To be able to match calls with returns a state can be saved when
  232. detecting a function call in a public loop data structure kept by the
  233. inviso meta tracer. The public loop data structure is given as
  234. argument to a handler-function called whenever a meta trace message
  235. arrives to the inviso meta tracer (both function calls and function
  236. returns). The public loop data structure is first initiated by the
  237. Mi:Fi function which takes the items in Argsi as arguments. Fi shall
  238. return the initial public loop data structure. When meta tracing is
  239. stopped, either because tracing is stopped or because tracing is
  240. suspended, the Mr:Fr(PublicLoopData) is called to offer a possibility
  241. to clean-up. Note that for every function meta-tracing is activated, a
  242. public loop data modification function can be speficied. That function
  243. will prepare the current loop data structure for this particular
  244. function.</p>
  245. <p>Further there is a risk that function call states becomes abandoned
  246. inside the public loop data structure. This will happen if a function
  247. call is entered into the public loop data structure, but no function
  248. return occurs. To prevent the public loop data structure from growing
  249. infinitely the clean function Fc will periodically be called with the
  250. public loop data structure as argument. Elements entered into the
  251. public loop data structure as a result of a function call must contain
  252. a timestamp for the Fc to be able to conclude if it is abandoned or
  253. not. Fc shall return a new public loop data structure.</p>
  254. <p>When initiating tracing involving trace information without a TiSpec,
  255. a default public loop data structure will be initiated to handle
  256. locally registered process aliases. The default public loop data
  257. structure is a two-tuple where the first element is used by the meta
  258. tracing on the BIF register/2. The second element is left for user
  259. usage.</p>
  260. <p>The default public loop data structure may be extended with more
  261. element positions. The first position must be left to the
  262. implementation of registered-name translations. If the public loop
  263. data structure is changed no longer meeting this requirement, the
  264. tpm_localnames/0,1 and tpm_globalnames/0,1 can no longer be used.</p>
  265. <p>A wrap files specification is used to limit the disk space consumed by
  266. the trace. The trace is written to a limited number of files each with
  267. a limited size. The actual filenames are Filename ++ SeqCnt ++ Tail,
  268. where SeqCnt counts as a decimal string from 0 to WrapCnt and then
  269. around again from 0. When a trace message written to the current file
  270. makes it longer than WrapSize, that file is closed, if the number of
  271. files in this wrap trace is as many as WrapCnt the oldest file is
  272. deleted then a new file is opened to become the current. Thus, when a
  273. wrap trace has been stopped, there are at most WrapCnt trace files
  274. saved with a size of at least WrapSize (but not much bigger), except
  275. for the last file that might even be empty. The default values are
  276. WrapSize == 128*1024 and WrapCnt == 8.</p>
  277. <p>The SeqCnt values in the filenames are all in the range 0 through
  278. WrapCnt with a gap in the circular sequence. The gap is needed to find
  279. the end of the trace.</p>
  280. <p>If the WrapSize is specified as {time,WrapTime}, the current file is
  281. closed when it has been open more than WrapTime milliseconds,
  282. regardless of it being empty or not.</p>
  283. <p>The ip trace driver has a queue of QSize messages waiting to be
  284. delivered. If the driver cannot deliver messages as fast as they are
  285. produced by the runtime system, they are dropped. The number of
  286. dropped messages are indicated in the trace log as separate trace
  287. message.</p>
  288. <p>stop_tracing(Nodes) -&gt; {ok,NodeResults} | {error,Reason}
  289. stop_tracing() -&gt; {ok,NodeResults} | NodeResult</p>
  290. <p>Types:</p>
  291. <p>Nodes = [Node]
  292. NodeResults = [{Node,NodeResult}]
  293. NodeResult = {ok,State} | {error,Reason}
  294. ?State = new | idle</p>
  295. <p>Stops tracing on all or specified Nodes. Flushes the trace buffer if a
  296. trace-port is used, closes the trace-port and removes all trace flags
  297. and meta-patterns. The nodes are called in parallel.</p>
  298. <p>Stopping tracing means going to state idle&lt;c&gt;. If the runtime
  299. component was already in state &lt;c&gt;new, it will of course remain in
  300. state new (then there was no tracing to stop).</p>
  301. <p>clear() -&gt; {ok,NodeResults} | NodeResult
  302. clear(Nodes,Options) -&gt; {ok,NodeResults} | {error,Reason}
  303. clear(Options) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  304. <p>Types:</p>
  305. <p>Nodes = [Node]
  306. Options = [Option]
  307. ?Option = keep_trace_patterns | keep_log_files
  308. NodeResults = [{Node,NodeResult}]
  309. ?NodeResult = {ok,{new,Status}} | {error,Reason}
  310. ??Status = running | {suspended,SReason}</p>
  311. <p>Stops all tracing including removing meta-trace patterns. Removes all
  312. trace patterns. If the node is tracing or idle, trace-logs belonging
  313. to the current tracerdata are removed. Hence the node is returned to
  314. state new. Note that the node can still be suspended.</p>
  315. <p>Various options can make the node keep set trace patterns and log-
  316. files. The node still enters the new state.</p>
  317. <p>tp(Nodes,Mod,Func,Arity,MatchSpec,Opts) -&gt;
  318. tp(Nodes,Mod,Func,Arity,MatchSpec) -&gt; {ok,NodeResults} |
  319. {error,Reason}
  320. tp(Mod,Func,Arity,MatchSpec,Opts) -&gt;
  321. tp(Mod,Func,Arity,MatchSpec) -&gt; {ok,NodeResults} | NodeResult |
  322. {error,Reason}
  323. tp(Nodes,PatternList) -&gt; {ok,NodeResults} | {error,Reason}
  324. tp(PatternList) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  325. <p>Types:</p>
  326. <p>Nodes = [Node]
  327. Mod = Func = atom() | &#8216;_&#8217;
  328. Arity = int() | &#8216;_&#8217;
  329. MatchSpec = true | false | [] | matchspec()
  330. PatternList = [Pattern],
  331. ?Pattern = {Mod,Func,Arity,MatchSpec,Opts}
  332. Opts = [Opt]
  333. ?Opt = only_loaded
  334. NodeResults = [NodeResult]
  335. ?NodeResult = {ok,[Ans]} | {error,Reason}
  336. ??Ans = int() | {error,Reason}</p>
  337. <p>Set trace pattern (global) on specified or all nodes. The integer
  338. replied if the call was successfully describes the number of matched
  339. functions. The functions without a Nodes argument means all nodes, in
  340. a non-distributed environment it means the local node. Using wildcards
  341. follows the rules for wildcards of erlang:trace_pattern/3. It is for
  342. instance illegal to specify M == &#8216;_&#8217; while F is not &#8216;_&#8217;.</p>
  343. <p>When calling several nodes, the nodes are called in parallel.</p>
  344. <p>The option only_loaded will prevent modules not loaded (yet) into the
  345. runtime system to become loaded just as a result of that a trace
  346. pattern is requested to be set on it. Otherwise modules are
  347. automatically loaded if not already loaded (since the module must be
  348. present for a trace pattern to be set on it). The latter does not
  349. apply if the wildcard &#8216;_&#8217; is used as module specification.</p>
  350. <p>tpl(Nodes,Mod,Func,Arity,MatchSpec) -&gt;
  351. tpl(Nodes,Mod,Func,Arity,MatchSpec,Opts) -&gt; {ok,NodeResults} |
  352. {error,Reason}
  353. tpl(Mod,Func,Arity,MatchSpec) -&gt;
  354. tpl(Mod,Func,Arity,MatchSpec,Opts) -&gt; {ok,NodeResults} | NodeResult|
  355. {error,Reason}
  356. tpl(Nodes,PatternList) -&gt; {ok,NodeResults} | {error,Reason}
  357. tpl(PatternList) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  358. <p>See tp/N function above for details on arguments and return values.</p>
  359. <p>Set local trace pattern on specified functions. When calling several
  360. nodes, the nodes are called in parallel.</p>
  361. <p>ctp(Nodes,Mod,Func,Arity) -&gt; {ok,NodeResults} | {error,Reason}
  362. ctp(Mod,Func,Arity) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  363. <p>See tp/N for argument descriptions.</p>
  364. <p>Clear global trace patterns. When calling several nodes, the nodes are
  365. called in parallel.</p>
  366. <p>ctpl(Nodes,Mod,Func,Arity) -&gt; {ok,NodeResults} | {error,Reason}
  367. ctpl(Mod,Funct,Arity) -&gt; {ok,NodeResults} | NodeResult |
  368. {error,Reason}</p>
  369. <p>See tp/N for argument description.</p>
  370. <p>Clear local trace patterns. When calling several nodes, the nodes are
  371. called in parallel.</p>
  372. <p>tf(Nodes,PidSpec,FlagList) -&gt; {ok,NodeResults} | {error,Reason}
  373. tf(PidSpec,FlagList) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  374. tf(Nodes,TraceConfList) -&gt; {ok,NodeResults} | {error,Reason}
  375. tf(NodeTraceConfList) -&gt; {ok,NodeResults} | {error,Reason}
  376. tf(TraceConfList) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  377. <p>Types:</p>
  378. <p>Nodes = [Node]
  379. NodeTraceConfList = [{Node,TraceConfList}]
  380. TraceConfList = [{PidSpec,FlagList}]
  381. FlagList = [Flag]
  382. PidSpec = all | new| existing | pid() | locally_registered_name()
  383. Flag &#8211; see erlang:trace/3
  384. NodeResult = {ok,[Ans]} | {error,Reason}
  385. Ans = int() | {error,Reason}</p>
  386. <p>Set process trace flags on processes on all or specified nodes. The
  387. integer returned if the call was successful describes the matched
  388. number of processes. The functions without a Nodes argument means all
  389. nodes, in a non-distributed environment it means the local node.</p>
  390. <p>There are many combinations which does not make much sense. For
  391. instance specifying a certain process identifier at all nodes. Or an
  392. empty TraceConfList for all nodes.</p>
  393. <p>When calling several nodes, the nodes are called in parallel.</p>
  394. <p>ctf(Nodes,PidSpec,FlagList) -&gt; {ok,NodeResults} | {error,Reason}
  395. ctf(PidSpec,FlagList) -&gt; {ok,NodeResults} | NodeResult |
  396. {error,Reason}
  397. ctf(Nodes,TraceConfList) -&gt; {ok,NodeResults} | {error,Reason}
  398. ctf(TraceConfList) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  399. <p>See tf/N for arguments and return value description.</p>
  400. <p>Clear process trace flags on all or specified nodes. When calling
  401. several nodes, the nodes are called in parallel.</p>
  402. <p>ctf_all(Nodes) -&gt; {ok,NodeResults} | {error,Reason}
  403. ctf_all() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  404. <p>Types:</p>
  405. <p>Nodes = [Node]
  406. NodeResults = [{Node,NodeResult}]
  407. NodeResult = ok | {error,Reason}</p>
  408. <p>Clears all trace flags on all or specified nodes. Just for
  409. convenience.</p>
  410. <p>init_tpm(Mod,Func,Arity,CallFunc) -&gt; {ok,NodeResults} | NodeResult |
  411. {error,Reason}
  412. init_tpm(Nodes,Mod,Func,Arity,CallFunc) -&gt; {ok,NodeResults} |
  413. {error,Reason}
  414. init_tpm(Mod,Func,Arity,InitFunc,CallFunc,ReturnFunc,RemoveFunc) -&gt;
  415. {ok,NodeResults} | NodeResult | {error,Reason}
  416. init_tpm(Nodes,Mod,Func,Arity,
  417. InitFunc,CallFunc,ReturnFunc,RemoveFunc) -&gt; {ok,NodeResults} |
  418. {error,Reason}</p>
  419. <p>Types:</p>
  420. <p>Mod = Func = atom()
  421. Arity = int()
  422. NodeResults = [{Node,NodeResult}]
  423. NodeResult = ok | {error,Reason}
  424. InitFunc,RemoveFunc = {Module,Function} | function()/4 | void
  425. CallFunc = ReturnFunc = {Module,Function} | function()/3 | void</p>
  426. <p>Initializes Mod:Func/Arity for meta tracing without setting any meta
  427. trace patterns. This is necessary if the named match specs will be
  428. used (see tpm_ms/5,6). Otherwise initialization of public loop data
  429. can be done at the same time as setting meta trace patterns using
  430. tpm/8,9.</p>
  431. <p>Note that we can not use wildcards here (even if it is perfectly legal
  432. in Erlang). It also sets the CallFunc and ReturnFunc for the meta
  433. traced function. That is the functions which will be called when a
  434. function call and a return_trace meta trace message respectively
  435. arrives to the inviso meta tracer for Mod:Func/Arity.</p>
  436. <p>This function is also available without InitFunc and RemoveFunc. That
  437. means that no initialization of the public loop data structure will be
  438. done and that CallFunc and ReturnFunc must either use already existing
  439. parts of public loop data structure or not use it at all.</p>
  440. <p>The InitFunc initializes the already existing public loop data
  441. structure for use with Mod:Func/Arity. InitFunc(Mod,Func,Arity,PublLD)
  442. -&gt; {ok,NewPublLD,Output} where OutPut can be a binary which will then
  443. be written to the trace information file. If it is not a binary, no
  444. output will be done. RemoveFunc will be called when the meta tracing
  445. is cleared with ctpm/3,4. RemoveFunc(Mod,Func,Arity,PublLD) -&gt;
  446. {ok,NewPublLD}.</p>
  447. <p>See tpm/N for details on CallFunc and ReturnFunc.</p>
  448. <p>tpm(Mod,Func,Arity,MS) -&gt; {ok,NodeResults} | NodeResult |
  449. {error,Reason}
  450. tpm(Nodes,Mod,Func,Arity,MS) -&gt; {ok,NodeResults} | {error,Reason}
  451. tpm(Mod,Func,Arity,MS,CallFunc) -&gt; {ok,NodeResults} | NodeResults |
  452. {error,Reason}
  453. tpm(Nodes,Mod,Func,Arity,MS,CallFunc) -&gt; {ok,NodeResults} |
  454. {error,Reason}
  455. tpm(Mod,Func,Arity,MS,InitFunc,CallFunc,ReturnFunc,RemoveFunc) -&gt;
  456. {ok,NodeResults} | NodeResults | {error,Reason}
  457. tpm(Nodes,Mod,Func,Arity,MS, InitFunc,CallFunc,ReturnFunc,RemoveFunc)
  458. -&gt; {ok,NodeResults} | {error,Reason}</p>
  459. <p>Types:</p>
  460. <p>Mod = Func = atom()
  461. Arity = int()
  462. MS = [match_spec()]
  463. Nodes = [Node]
  464. InitFunc = RemoveFunc = {Module,Function} | function()/4 | void
  465. CallFunc = ReturnFunc = {Module,Function} | function()/3 | void
  466. NodeResults = [{Node,NodeResult}]
  467. NodeResult = {ok,1} | {ok,0} | {error,Reason}1</p>
  468. <p>Activates meta-tracing in the inviso_rt_meta tracer. Except when using
  469. tpm/6, tpm/8 and tpm/9 the Mod:Func/Arity must first have been
  470. initiated using init_tpm/N. When calling several nodes, the nodes are
  471. called in parallel.</p>
  472. <p>CallFunc will be called every time a meta trace message arrives to the
  473. inviso meta tracer because of a call to Func.
  474. CallFunc(CallingPid,ActualArgList,PublLD) -&gt; {ok,NewPrivLD,Output}
  475. where Output can be a binary or void. If it is a binary it will be
  476. written to the trace information file.</p>
  477. <p>ReturnFunc will be called every time a meta return_trace message
  478. arrives to the inviso meta tracer because of a return_trace of a call
  479. to Func. ReturnFunc(CallingPid,ReturnValue,PublLD) -&gt;
  480. {ok,NewPrivLD,Output}. Further the ReturnFunc must handle the fact
  481. that a return_trace message arrives for a call which was never
  482. noticed. This because the message queue of the meta tracer may have
  483. been emptied.</p>
  484. <p>tpm_tracer(Mod,Func,Arity,MS) -&gt; {ok,NodeResults} | NodeResult |
  485. {error,Reason}
  486. tpm_tracer(Nodes,Mod,Func,Arity,MS) -&gt; {ok,NodeResults} |
  487. {error,Reason}
  488. tpm_tracer(Mod,Func,Arity,MS,CallFunc) -&gt; {ok,NodeResults} |
  489. NodeResults | {error,Reason}
  490. tpm_tracer(Nodes,Mod,Func,Arity,MS,CallFunc) -&gt; {ok,NodeResults} |
  491. {error,Reason}
  492. tpm_tracer(Mod,Func,Arity,MS,InitFunc,CallFunc,ReturnFunc,RemoveFunc)
  493. -&gt; {ok,NodeResults} | NodeResults | {error,Reason}
  494. tpm_tracer(Nodes,Mod,Func,Arity,MS,
  495. InitFunc,CallFunc,ReturnFunc,RemoveFunc) -&gt; {ok,NodeResults} |
  496. {error,Reason}</p>
  497. <p>See tpm/X for details on arguments and return values.</p>
  498. <p>Same as tpm/X but all match specs in MS containing a trace action term
  499. will have a {tracer,Tracer} appended to its enable-list. Tracer will
  500. be the current output for regular trace messages as specified when
  501. tracing was initiated. This function is useful when setting a meta
  502. trace pattern on a function with the intent that its execution shall
  503. turn tracing on for the process executing the match-spec in the meta
  504. trace pattern. The reason the tracer process trace flag can not be
  505. explicitly written in the action term by the user is that it may be
  506. difficult to learn its exact value for a remote node. Further more
  507. inviso functions are made to work on several nodes at the same time,
  508. requiering different match specs to be set for different nodes.</p>
  509. <p>Simple example: We want any process executing the function
  510. mymod:init(1234) (with the argument, exactly the integer 1234) to
  511. begin function-call tracing. In the example, if the process is found
  512. to be one that shall start call tracing, we also first disable all
  513. process trace flags to ensure that we have full control over what the
  514. process traces. void in the example specifies that the meta-tracer
  515. (inviso_rt_meta) will not call any function when meta trace messages
  516. for mymod:init/1 arrives. There is no need for a CallFunc since the
  517. side-effect (start call-tracing) is achieved immediately with the
  518. match-spec.</p>
  519. <div class="highlight-erlang"><div class="highlight"><pre><span class="nn">inviso</span><span class="p">:</span><span class="n">tpm_tracer</span><span class="p">(</span><span class="n">mymod</span><span class="p">,</span><span class="n">init</span><span class="p">,</span><span class="mi">1</span><span class="p">,[{[</span><span class="mi">1234</span><span class="p">],[],[{</span><span class="nb">trace</span><span class="p">,[</span><span class="n">all</span><span class="p">],[</span><span class="n">call</span><span class="p">]}]}],</span><span class="n">void</span><span class="p">).</span>
  520. </pre></div>
  521. </div>
  522. <p>This will internally, by the meta tracer on each Erlang node, be
  523. translated to:</p>
  524. <div class="highlight-erlang"><div class="highlight"><pre><span class="nn">erlang</span><span class="p">:</span><span class="nb">trace_pattern</span><span class="p">({</span><span class="n">mymod</span><span class="p">,</span><span class="n">init</span><span class="p">,</span><span class="mi">1</span><span class="p">},[{[</span><span class="mi">1234</span><span class="p">],[],[{</span><span class="nb">trace</span><span class="p">,[</span><span class="n">all</span><span class="p">],[</span><span class="n">call</span><span class="p">,{{</span><span class="n">tracer</span><span class="p">,</span><span class="nv">T</span><span class="p">}}]}]}],[{</span><span class="n">meta</span><span class="p">,</span><span class="nv">P</span><span class="p">}]).</span>
  525. </pre></div>
  526. </div>
  527. <p>Where T is the tracer for regular trace messages (most often a trace-
  528. port, but can be the runtime component inviso_rt process), and P is
  529. the meta tracer (the inviso_rt_meta process).</p>
  530. <p>tpm_ms(Mod,Func,Arity,MSname,MS) -&gt; {ok,NodeResults} | NodeResult |
  531. {error,Reason}
  532. tpm_ms(Nodes,Mod,Func,Arity,MSname,MS) -&gt; {ok,NodeResults} |
  533. {error,Reason}</p>
  534. <p>Types:</p>
  535. <p>Nodes = [Node]&lt;v&gt; &lt;v&gt;Mod = Func = atom()&lt;v&gt; &lt;v&gt;Arity = int()&lt;v&gt;
  536. &lt;v&gt;MSname = term()&lt;v&gt; &lt;v&gt;MS = [match_spec()]&lt;v&gt; &lt;v&gt;NodeResults =
  537. [{Node,NodeResult}]&lt;v&gt; &lt;v&gt;NodeResult = {ok,1} | {ok,0} |
  538. {error,Reason}&lt;v&gt;</p>
  539. <p>This function adds a list of match-specs to the already existing ones.
  540. It uses an internal database to keep track of existing match-specs.
  541. This set of match specs can hereafter be referred to with the name
  542. MSname. If the match-spec does not result in any meta traced functions
  543. (for whatever reason), the MS is not saved in the database. The
  544. previously known match-specs are not removed. If MSname is already in
  545. use as a name refering to a set of match-specs for this particular
  546. meta-traced function, the previous set of match-specs are replaced
  547. with MS.</p>
  548. <p>Mod:Func/Arity must previously have been initiated in order for this
  549. function to add a match-spec.</p>
  550. <p>When calling several nodes, the nodes are called in parallel. {ok,1}
  551. indicates success.</p>
  552. <p>tpm_ms_tracer(Mod,Func,Arity,MSname,MS) -&gt; {ok,NodeResults} |
  553. NodeResult | {error,Reason}
  554. tpm_ms_tracer(Nodes,Mod,Func,Arity,MSname,MS) -&gt; {ok,NodeResults} |
  555. {error,Reason}</p>
  556. <p>See tpm_ms/X for details on arguments and return values, and
  557. tpm_tracer/X for explanations about the appending of {tracer,Tracer}
  558. process trace flag.</p>
  559. <p>ctpm_ms(Mod,Func,Arity,MSname) -&gt; {ok,NodeResults} | NodeResult |
  560. {error,Reason}
  561. ctpm_ms(Nodes,Mod,Func,Arity,MSname) -&gt; {ok,NodeResults} |
  562. {error,Reason}</p>
  563. <p>Types:</p>
  564. <p>NodeResults = [{Node,NodeResult}]
  565. NodeResult = ok | {error,Reason}</p>
  566. <p>Removes a named match-spec from the meta traced function. Note that it
  567. never is a fault to remove a match spec. Not even from a function
  568. which is non existent.</p>
  569. <p>When calling several nodes, the nodes are called in parallel.</p>
  570. <p>ctpm(Mod,Func,Arity) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  571. ctpm(Nodes,Mod,Func,Arity) -&gt; {ok,NodeResults} | {error,Reason}</p>
  572. <p>Types:</p>
  573. <p>NodeResults = [{Node,NodeResult}]
  574. NodeResult = ok | {error,Reason}</p>
  575. <p>Removes the meta trace pattern for the function, means stops
  576. generating output for this function. The public loop data structure
  577. may be cleared by the previously entered RemoveFunc.</p>
  578. <p>When calling several nodes, the nodes are called in parallel.</p>
  579. <p>tpm_localnames() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  580. tpm_localnames(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  581. <p>Types:</p>
  582. <p>NodeResults = [{Node,NodeResult}]
  583. NodeResult = {R1,R2}
  584. R1 = R2 = {ok,0} | {ok,1} | {error,Reason}</p>
  585. <p>Quick version for setting meta-trace patterns on erlang:register/2. It
  586. uses a default CallFunc and ReturnFunc in the meta-tracer server. The
  587. main purpose of this function is to create ti-log entries for
  588. associations between pids and registered name aliases. The
  589. implementation uses return_trace to see if the registration was
  590. successful or not, before actually making the ti-log alias entry.
  591. Further the implementation also meta traces the BIF unregister/1.</p>
  592. <p>If both N1 and N2 is 1, function call was successful. N1 and N2
  593. represent setting meta trace pattern on register/2 and unregister/1.</p>
  594. <p>ctpm_localnames() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  595. ctpm_localnames(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  596. <p>Types:</p>
  597. <p>NodeResults = [{Node,NodeResult}]
  598. NodeResult = {R1,R2}
  599. R1 = R2 = ok | {error,Reason}</p>
  600. <p>Function for removing previously set patters by tpm_localnames/0. The
  601. two results R1 and R2 represents that meta pattern is removed from
  602. both register/2 and unregister/1.</p>
  603. <p>tpm_globalnames() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  604. tpm_globalnames(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  605. <p>Types:</p>
  606. <p>NodeResults = [{Node,NodeResult}]
  607. NodeResult = {R1,R2}
  608. R1 = R2 = {ok,0} | {ok,1} | {error,Reason}</p>
  609. <p>Quick version for setting meta-trace patterns capable of learning the
  610. association of a pid with a globally registered name (registered using
  611. global:register_name). The implementation meta-traces on
  612. global:handle_call({register,&#8217;_&#8217;,&#8217;_&#8217;,&#8217;_&#8217;},&#8217;_&#8217;,&#8217;_&#8217;) and
  613. global:delete_global_name/2. The N1 and N2 represents the success of
  614. the two sub-tmp calls.</p>
  615. <p>ctpm_globalnames() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  616. ctpm_globalnames(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  617. <p>Types:</p>
  618. <p>NodeResults = [{Node,NodeResult}]
  619. NodeResult = {R1,R2} | {error,Reason}
  620. R1 = R2 = ok | {error,Reason}</p>
  621. <p>Function for removing previously set meta patters by
  622. tpm_globalnames/0,1. The two results R1 and R2 represents that meta
  623. pattern are removed from both global:handle_call/3 and
  624. global:delete_global_name/1.</p>
  625. <p>ctp_all() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  626. ctp_all(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  627. <p>Types:</p>
  628. <p>NodeResults = [{Node,NodeResult}]
  629. NodeResult = ok | {error,Reason}</p>
  630. <p>Clears all, both global and local trace patterns. Does not clear meta
  631. trace patterns. Equivalent to a call to ctp/3,4 and to ctpl/3,4 with
  632. wildcards &#8216;_&#8217; for all modules, functions and arities.</p>
  633. <p>suspend(SReason) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  634. suspend(Nodes,SReason) -&gt; {ok,NodeResults} | {error,Reason}</p>
  635. <p>Types:</p>
  636. <p>SReason = term()
  637. NodeResults = [{Node,NodeResult}]
  638. NodeResult = ok | {error,Reason}</p>
  639. <p>Suspends the runtime components. SReason will become the suspend-
  640. reason replied in for instance a get_status/0,1 call. A runtime
  641. component that becomes suspended removes all trace flags and all meta
  642. trace patterns. In that way trace output is no longer generated. The
  643. task of reactivating a suspended runtime component is outside the
  644. scoop of inviso. It can for instance be implemented by a higher layer
  645. trace-tool &#8220;remembering&#8221; all trace flags and meta patterns set.</p>
  646. <p>cancel_suspension() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  647. cancel_suspend(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  648. <p>Types:</p>
  649. <p>NodeResults = [{Node,NodeResult}]
  650. NodeResult = ok | {error,Reason}</p>
  651. <p>Makes the runtime components running again (as opposite to suspended).
  652. Since reactivating previous trace flags and meta trace patterns is
  653. outside the scoop of inviso, cancelling suspension is simply making it
  654. possible to set trace flags and meta trace patterns again.</p>
  655. <p>get_status() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  656. get_status(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  657. <p>Types:</p>
  658. <p>NodeResults = [{Node,NodeResult}]
  659. NodeResult = {ok,{State,Status}} | {error,Reason}
  660. State = new | idle | tracing
  661. Status = running | {suspended,SReason}
  662. SReason = term()</p>
  663. <p>Finds out the state and status of a runtime component. A runtime
  664. component is in state new before it has been initiated to do any
  665. tracing the first time. There are clear-functions which can make a
  666. runtime component become new again without having to restart. A
  667. runtime component becomes idle after tracing is stopped.</p>
  668. <p>get_tracerdata() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  669. get_tracerdata(Nodes) -&gt; {ok,NodeResults} | {error,Reason}</p>
  670. <p>Types:</p>
  671. <p>NodeResults = [{Node,NodeResult}]
  672. NodeResult = {ok,NResult} | {error,Reason}
  673. NResult = TracerData | no_tracerdata</p>
  674. <p>Returns the current tracerdata of a runtime component. A runtime
  675. component in state new can not have tracerdata. An idle runtime
  676. component does have tracerdata, the last active tracerdata. TracerData
  677. will be a term as specified to init_tracing when tracing was initiated
  678. for the runtime component.</p>
  679. <p>list_logs() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  680. list_logs(Nodes) -&gt; {ok,NodeResults} | {error,Reason}
  681. list_logs(NodeTracerData) -&gt; {ok,NodeResults} | {error,Reason}
  682. list_logs(TracerData) -&gt; {ok,NodeResults} | NodeResult |
  683. {error,Reason}</p>
  684. <p>Types:</p>
  685. <p>TracerData &#8211; see init_tracing/1,2
  686. NodeResults = [{Node,NodeResult}]
  687. NodeResult = {ok,FileList} | {ok,no_log} | {error,Reason}
  688. ?FileList = [FileType]
  689. ??FileType = {trace_log,Dir,Files} | {ti_log,Dir,Files}
  690. ??Files = [FileNameWithOutPath]</p>
  691. <p>Returns the actually existing log files associated with TracerData. If
  692. a tracerdata is not specified, current tracerdata is used for that
  693. particular runtime component. Files will be a list of one or more
  694. files should it be a wrap-set. Otherwise the it is a list of only one
  695. filename.</p>
  696. <p>This function is useful to learn the name and path of all files
  697. belonging to a trace. This information can later be used to move those
  698. files for merging. Note that since it is possible to ask on other
  699. tracerdata than the current, it is possible to learn filenames of
  700. previously done traces, under the circumstances that they have not
  701. been removed.</p>
  702. <p>fetch_log(LogSpecList,DestDir,Prefix) -&gt; {ok,NodeResults} |
  703. {error,not_distributed} | {error,Reason}
  704. fetch_log(DestDir,Prefix) -&gt; {ok,NodeResults} |
  705. {error,not_distributed} | {error,Reason}</p>
  706. <p>Types:</p>
  707. <p>DestDir = string()
  708. Prefix = string()
  709. LogSpecList = [LogSpec]
  710. ?LogSpec = {Node,FileSpecList} | Node | {Node,TracerData}
  711. TracerData = see init_tracing/1,/2
  712. FileSpecList = [{trace_log,Dir,FileList},{ti_log,Dir,FileList}] |
  713. [{trace_log,Dir,FileList}]
  714. ?FileList = [RemoteFileName]
  715. NodeResult = {Conclusion,ResultFileSpec} | no_log | {error,NReason}
  716. ?NReason = own_node | Reason
  717. ?Conclusion = complete | incomplete
  718. ?ResultFileSpec = [{trace_log,FileResults},{ti_log,FileResults}]
  719. ??FileResults = [FileResult]
  720. ??? FileResult = {ok,FileName} | {error,FReason}
  721. ????FReason = {file_open,{posix(),FileName}} |
  722. {file_open,{posix(),RemoteFileName}} |
  723. {file_open,{posix(),[DestDir,Prefix,RemoteFileName]}} |
  724. {file_write,{posix(),FileName}} | {truncated,FileName} |
  725. {truncated,{Reason,FileName}}
  726. ?????posix() = atom()</p>
  727. <p>Copies log files over distributed erlang to the control component
  728. node. This function can only be used in a distributed system.</p>
  729. <p>The resulting transferred files will have the prefix Prefix and will
  730. be located in DestDir. The source files can either be pointed out
  731. using a FileListSpec or tracerdata. If no files are explicitly
  732. specified, current tracerdata for that node will be used. Note that if
  733. source files have the same name (on several nodes) they will overwrite
  734. each other at DestDir.</p>
  735. <p>delete_log(Nodes,TracerData) -&gt; {ok,NodeResults} | {error,Reason}
  736. delete_log(NodeSpecList) -&gt; {ok,NodeResults} | {error,Reason}
  737. delete_log(Spec) -&gt; {ok,NodeResults} | NodeResult | {error,Reason}
  738. delete_log(TracerData) -&gt; {ok,NodeResults} | NodeResult |
  739. {error,Reason}
  740. delete_log() -&gt; {ok,NodeResults} | NodeResult | {error,Reason}</p>
  741. <p>Types:</p>
  742. <p>Nodes = [Node]
  743. NodeSpecList = [{Node,Spec}]
  744. ?Spec = [AbsPathFileName] | LogSpecs
  745. ??LogSpecs = [LogSpec]
  746. ???LogSpec = {trace_log,Dir,[FileNameWithoutPath]} |
  747. {ti_log,Dir,[FileNameWithoutPath]}
  748. TracerData &#8211; see init_tracing/1,/2
  749. NodeResults = [{Node,NodeResult}]
  750. NodeResult = {ok,no_log} | {ok,LogInfos} | {ok,FileInfos}
  751. ?LogInfos = [LogInfo]
  752. ??LogInfo = {trace_log,FileInfos} | {ti_log,FileInfos}
  753. ?FileInfos = [FileInfo]
  754. ??FileInfo = {ok,FileName} | {error,Reason}</p>
  755. <p>Deletes listed files or files corresponding to tracerdata. If no
  756. tracerdata or list of files are specified in the call, current
  757. tracerdata at the runtime components will be used to identify files to
  758. delete. All filenames shall be strings.</p>
  759. <p>FileName can either be an absolute path or just a filename depending
  760. on if AbsPathFileName or a LogSpec was used to identify the file.</p>
  761. <p>subscribe() -&gt; ok | {error,Reason}
  762. subscribe(Pid) -&gt; ok | {error,Reason}</p>
  763. <p>Types:</p>
  764. <p>Pid = pid()</p>
  765. <p>Adds Pid or self() if using subscribe/0 to the inviso-event sending
  766. list. Note that it is possible to add a pid several times and that the
  767. Pid then will receive multiple copies of inviso-event messages.</p>
  768. <p>All events will be sent to all subscribers in the event sending list.</p>
  769. <div class="highlight-erlang"><div class="highlight"><pre><span class="nv">Event</span> <span class="o">=</span> <span class="p">{</span><span class="n">inviso_event</span><span class="p">,</span><span class="nv">ControllerPid</span><span class="p">,</span><span class="nn">erlang</span><span class="p">:</span><span class="n">localtime</span><span class="p">(),</span><span class="nv">Msg</span><span class="p">}</span>
  770. <span class="nv">Msg</span> <span class="o">=</span> <span class="p">{</span><span class="n">connected</span><span class="p">,</span> <span class="nv">Node</span><span class="p">,</span> <span class="p">{</span><span class="nv">RTtag</span><span class="p">,</span> <span class="p">{</span><span class="nv">State</span><span class="p">,</span><span class="nv">Status</span><span class="p">}}}</span>
  771. <span class="p">|</span> <span class="p">{</span><span class="n">disconnected</span><span class="p">,</span> <span class="nv">Node</span><span class="p">,</span> <span class="nv">NA</span><span class="p">}</span>
  772. <span class="p">|</span> <span class="p">{</span><span class="n">state_change</span><span class="p">,</span><span class="nv">Node</span><span class="p">,{</span><span class="nv">State</span><span class="p">,</span><span class="nv">Status</span><span class="p">}}</span>
  773. <span class="p">|</span> <span class="p">{</span><span class="n">port_down</span><span class="p">,</span><span class="nv">Node</span><span class="p">,</span><span class="nv">Reason</span><span class="p">}</span>
  774. <span class="nv">Node</span> <span class="o">=</span> <span class="nb">node</span><span class="p">()</span> <span class="p">|</span> <span class="n">local_runtime</span>
  775. </pre></div>
  776. </div>
  777. <p>Subscribing to inviso-event may be necessary for a higher layer trace-
  778. tool using inviso to follow the runtime components. local_runtime will
  779. be used for a runtime component running in a non-distributed
  780. environment.</p>
  781. <p>unsubscribe() -&gt; ok
  782. unsubscribe(Pid) -&gt; ok</p>
  783. <p>Removes Pid (once) from the subscription list.</p>
  784. <p>inviso 0.6
  785. Copyright ? 1991-2009 <a class="reference external" href="http://www.ericsson.com/technology/opensource/erlang">Ericsson AB</a></p>
  786. </div>
  787. </div>
  788. </div>
  789. </div>
  790. </div>
  791. </div>
  792. <div class="sphinxsidebar">
  793. <div class="sphinxsidebarwrapper">
  794. <h3><a href="../../../../index.html">Table Of Contents</a></h3>
  795. <ul>
  796. <li><a class="reference external" href="">Lib - Inviso-0.6 - Doc - Html - Inviso</a><ul>
  797. <li><a class="reference external" href="#inviso">inviso</a><ul>
  798. <li><a class="reference external" href="#module">MODULE</a></li>
  799. <li><a class="reference external" href="#module-summary">MODULE SUMMARY</a></li>
  800. <li><a class="reference external" href="#description">DESCRIPTION</a></li>
  801. <li><a class="reference external" href="#exports">EXPORTS</a></li>
  802. </ul>
  803. </li>
  804. </ul>
  805. </li>
  806. </ul>
  807. <h3>This Page</h3>
  808. <ul class="this-page-menu">
  809. <li><a href="../../../../_sources/lib/inviso-0.6/doc/html/inviso.txt"
  810. rel="nofollow">Show Source</a></li>
  811. </ul>
  812. <div id="searchbox" style="display: none">
  813. <h3>Quick search</h3>
  814. <form class="search" action="../../../../search.html" method="get">
  815. <input type="text" name="q" size="18" />
  816. <input type="submit" value="Go" />
  817. <input type="hidden" name="check_keywords" value="yes" />
  818. <input type="hidden" name="area" value="default" />
  819. </form>
  820. <p class="searchtip" style="font-size: 90%">
  821. Enter search terms or a module, class or function name.
  822. </p>
  823. </div>
  824. <script type="text/javascript">$('#searchbox').show(0);</script>
  825. </div>
  826. </div>
  827. <div class="clearer"></div>
  828. </div>
  829. <div class="related">
  830. <h3>Navigation</h3>
  831. <ul>
  832. <li class="right" style="margin-right: 10px">
  833. <a href="../../../../genindex.html" title="General Index"
  834. >index</a></li>
  835. <li><a href="../../../../index.html">Erlang/OTP vR13B02 documentation</a> &raquo;</li>
  836. </ul>
  837. </div>
  838. <div class="footer">
  839. &copy; Copyright 1999-2009 Ericsson AB.
  840. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.
  841. </div>
  842. </body>
  843. </html>