You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The collected traces are stored in an ETS table (default name: `trace`).
133
-
They are stored as [`tr`](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:tr/0) records with the following fields:
133
+
They are stored as [`tr`](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:tr/0) records with the following fields:
134
134
135
135
-`index`: trace identifier, auto-incremented for each received trace.
136
136
-`pid`: process identifier associated with the trace.
@@ -186,7 +186,7 @@ Use `tr:select/0` to select all collected traces.
186
186
```
187
187
188
188
The `tr:select/1` function accepts a fun that is passed to `ets:fun2ms/1`.
189
-
This way you can limit the selection to specific items and select only some fields from the [`tr`](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:tr/0) record:
189
+
This way you can limit the selection to specific items and select only some fields from the [`tr`](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:tr/0) record:
@@ -342,15 +342,15 @@ The third possibility is `output => longest` which does the opposite of pruning,
342
342
ts=1705475521743239,info=no_info}]]
343
343
```
344
344
345
-
Possible [options](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:tb_options/0) for `tr:tracebacks/2` include:
345
+
Possible [options](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:tb_options/0) for `tr:tracebacks/2` include:
346
346
347
347
-`tab` is the table or list which is like the second argument of `tr:filter/2`,
348
348
-`output` - `shortest` (default), `all`, `longest` - see above.
349
349
-`format` - `list` (default), `tree` - returns a list of (possibly merged) call trees instead of tracebacks, `root` - returns a list of root calls. Trees and roots don't distinguish between `all` and `longest` output formats. Using `root` is equivalent to using `tree`, and then calling `tr:roots/1` on the results. There is also `tr:root/1` for a single tree.
350
350
-`order` - `top_down` (default), `bottom_up` - call order in each tracaback; only for the `list` format.
351
351
-`limit` - positive integer or `infinity` (default) - limits the number of matched traces. The actual number of tracebacks returned can be smaller unless `output => all`
352
352
353
-
There are also functions `tr:traceback/1` and `tr:traceback/2`. They set `limit` to one and return only one trace if it exists. The options for `tr:traceback/2` are the same as for `tr:traceback/2` except `limit`. Additionally, it is possible to pass a [`tr`](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:tr/0) record (or an index) as the first argument to `tr:traceback/1` or `tr:traceback/2` to obtain the traceback for the provided trace event.
353
+
There are also functions `tr:traceback/1` and `tr:traceback/2`. They set `limit` to one and return only one trace if it exists. The options for `tr:traceback/2` are the same as for `tr:traceback/2` except `limit`. Additionally, it is possible to pass a [`tr`](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:tr/0) record (or an index) as the first argument to `tr:traceback/1` or `tr:traceback/2` to obtain the traceback for the provided trace event.
354
354
355
355
### Trace ranges for filtered traces: `ranges`
356
356
@@ -374,7 +374,7 @@ To get a list of traces between each matching call and the corresponding return,
374
374
data=1,ts=1705475521750453,info=no_info}]]
375
375
```
376
376
377
-
There is also `tr:ranges/2` - it accepts a [map of options](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:range_options/0), including:
377
+
There is also `tr:ranges/2` - it accepts a [map of options](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:range_options/0), including:
378
378
379
379
-`tab` is the table or list which is like the second argument of `tr:filter/2`,
380
380
-`max_depth` is the maximum depth of nested calls. A message event also adds 1 to the depth.
@@ -386,7 +386,7 @@ There is also `tr:ranges/2` - it accepts a [map of options](https://hexdocs.pm/e
386
386
When you combine the options into `#{output => incomplete, max_depth => 1}`,
387
387
you get all the calls which didn't return (they were still executing when tracing was stopped).
388
388
389
-
There are two additional functions: `tr:range/1` and `tr:range/2`, which return only one range if it exists. It is possible to pass a [`tr`](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:tr/0) record or an index as the first argument to `tr:range/1` or `tr:range/2` as well.
389
+
There are two additional functions: `tr:range/1` and `tr:range/2`, which return only one range if it exists. It is possible to pass a [`tr`](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:tr/0) record or an index as the first argument to `tr:range/1` or `tr:range/2` as well.
390
390
391
391
### Calling a function from a trace: `do`
392
392
@@ -433,7 +433,7 @@ When there is no trace to return, `not_found` error is raised:
433
433
```
434
434
435
435
There are also more advanced variants of these functions: `tr:next/2` and `tr:prev/2`.
436
-
As their second argument, they take a [map of options](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:prev_next_options/0), including:
436
+
As their second argument, they take a [map of options](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:prev_next_options/0), including:
437
437
438
438
-`tab` is the table or list (like the second argument of `tr:filter/2`),
439
439
-`pred` is a predicate function that should return `true` for a matching trace record.
@@ -499,14 +499,14 @@ You can sort the call stat by accumulated time (descending) with `tr:sorted_call
499
499
The first element of each tuple is the key, the rest is the same as above.
500
500
501
501
There is `tr:sorted_call_stat/2` as well.
502
-
The second argument of this function is a [map of options](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:sorted_call_stat_options/0), including:
502
+
The second argument of this function is a [map of options](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:sorted_call_stat_options/0), including:
503
503
504
504
-`sort_by` is the field to sort by: `count`, `acc_time` (default) or `own_time`.
505
505
-`order` is `asc` or `desc` (default).
506
506
-`limit` is the maximum number of rows returned: a positive integer or `infinity` (default).
507
507
508
508
To pretty-print the statistics, use `tr:print_sorted_call_stat/1`.
509
-
There is `tr:print_sorted_call_stat/2` as well with the same [map of options](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:sorted_call_stat_options/0) as `tr:sorted_call_stat/2`.
509
+
There is `tr:print_sorted_call_stat/2` as well with the same [map of options](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:sorted_call_stat_options/0) as `tr:sorted_call_stat/2`.
510
510
511
511
For example, we can only print the top 3 items:
512
512
@@ -566,7 +566,7 @@ and `Count` is the number of times the tree repeated. The list is sorted by `Tim
566
566
In the example above `fib(2)` was called twice and `fib(1)` was called 3 times,
567
567
what already shows that the recursive implementation is suboptimal.
568
568
569
-
There is also `tr:top_call_trees/1`, which takes a [map of options](https://hexdocs.pm/erlang_doctor/0.3.1/tr.html#t:top_call_trees_options/0), including:
569
+
There is also `tr:top_call_trees/1`, which takes a [map of options](https://hexdocs.pm/erlang_doctor/0.3.2/tr.html#t:top_call_trees_options/0), including:
570
570
-`output` is `reduced` by default, but it can be set to `complete` where subtrees of already listed trees are also listed.
571
571
-`min_count` is the minimum number of times a tree has to occur to be listed, the default is 2.
572
572
-`min_time` is the minimum accumulated time for a tree, by default there is no minimum.
0 commit comments