Call new TraceEvents()
to create a new TraceEvents
object to track the PerformanceEntry
objects.
Call traceEvents.destroy()
when there is no more use of the TraceEvents
object.
Call traceEvents.getEvents()
to get the PerformanceEntry objects in the Trace Event Format:
[
{
"name": "B",
"cat": "measure",
"ph": "X",
"pid": 1,
"ts": 34509,
"dur": 1004141,
"args": null
},
{
"name": "A",
"cat": "measure",
"ph": "X",
"pid": 1,
"ts": 33837,
"dur": 2002098,
"args": { "foo": "bar" }
}
]
trackRequires(switch, options)
(only available in CommonJS)
switch
(bool) - CalltrackRequires(true)
to enable trackingrequire()
s and calltrackRequires(false)
to disable trackingrequire()
s.options
(object)trackSource
(bool) - CalltrackRequires(true, { trackSource: true })
to enable trackingrequire()
s and also capture the source locations. This creates a throw-away error object and parses thestack
property, so it introduces an overhead.