Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 1d2fab3

Browse files
committed
doc: document the tracing api
1 parent d23ac0e commit 1d2fab3

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

doc/api/_toc.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* [String Decoder](string_decoder.html)
3030
* [Timers](timers.html)
3131
* [TLS/SSL](tls.html)
32+
* [Tracing](tracing.html)
3233
* [TTY](tty.html)
3334
* [UDP/Datagram](dgram.html)
3435
* [URL](url.html)

doc/api/all.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@
3535
@include debugger
3636
@include cluster
3737
@include smalloc
38+
@include tracing

doc/api/tracing.markdown

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Tracing
2+
3+
Stability: 1 - Experimental
4+
5+
The tracing module is designed for instrumenting your Node application. It is
6+
not meant for general purpose use.
7+
8+
***Be very careful with callbacks used in conjunction with this module***
9+
10+
Many of these callbacks interact directly with asynchronous subsystems in a
11+
synchronous fashion. That is to say, you may be in a callback where a call to
12+
`console.log()` could result in an infinite recursive loop. Also of note, many
13+
of these callbacks are in hot execution code paths. That is to say your
14+
callbacks are executed quite often in the normal operation of Node, so be wary
15+
of doing CPU bound or synchronous workloads in these functions. Consider a ring
16+
buffer and a timer to defer processing.
17+
18+
`require('tracing')` to use this module.
19+
20+
## v8
21+
22+
The `v8` property is an [EventEmitter][], it exposes events and interfaces
23+
specific to the version of `v8` built with node. These interfaces are subject
24+
to change by upstream and are therefore not covered under the stability index.
25+
26+
### Event: 'gc'
27+
28+
`function (before, after) { }`
29+
30+
Emitted each time a GC run is completed.
31+
32+
`before` and `after` are objects with the following properties:
33+
34+
```
35+
{
36+
type: 'mark-sweep-compact',
37+
flags: 0,
38+
timestamp: 905535650119053,
39+
total_heap_size: 6295040,
40+
total_heap_size_executable: 4194304,
41+
total_physical_size: 6295040,
42+
used_heap_size: 2855416,
43+
heap_size_limit: 1535115264
44+
}
45+
```
46+
47+
### getHeapStatistics()
48+
49+
Returns an object with the following properties
50+
51+
```
52+
{
53+
total_heap_size: 7326976,
54+
total_heap_size_executable: 4194304,
55+
total_physical_size: 7326976,
56+
used_heap_size: 3476208,
57+
heap_size_limit: 1535115264
58+
}
59+
```
60+
61+
[EventEmitter]: events.html#events_class_events_eventemitter

0 commit comments

Comments
 (0)