The goog.debug.Trace_ Class

The goog.debug.Trace_.EventType Enum

Event type supported by tracer … more

.MAX_TRACE_SIZE {number}

Maximum size of the trace before we discard events

.addComment(comment, opt_type, opt_timeStamp)

Adds a comment to the trace. Makes it possible to see when a specific event happened in relation to the traces.

comment {string}
A comment that is inserted into the trace.
opt_type {?string=}
Type used to identify the tracer. If a comment is given a type and multiple comments are done on that type then a "TOTAL line will be produced showing the total number of comments of that type.
opt_timeStamp {?number=}
The timestamp to insert the comment. If not specified, the current time wil be used.

.clearCurrentTrace()

Clears the current trace

.getFormattedTrace()

Returns a formatted string for the current trace

returns {string}
A formatted string that shows the timings of the current trace.

.getTotalVarAlloc()

Returns the total number of allocations since the GC stats were reset. Only works in IE.

returns {number}
The number of allocaitons or -1 if not supported.

.initCurrentTrace(defaultThreshold)

Initializes and resets the current trace

defaultThreshold {number}
The default threshold below which the tracer output will be supressed. Can be overridden on a per-Tracer basis.

.now()

Returns the current time. Done through a wrapper function so it can be overridden by application code. Gmail has an ActiveX extension that provides higher precision timing info.

returns {number}
The current time in milliseconds.

.reset(defaultThreshold)

Resets the trace.

defaultThreshold {number}
The default threshold below which the tracer output will be supressed. Can be overridden on a per-Tracer basis.

.setGcTracer(gcTracer)

Sets the ActiveX object that can be used to get GC tracing in IE6.

gcTracer {Object}
GCTracer ActiveX object.

.setStartTime(startTime)

Add the ability to explicitly set the start time. This is useful for example for measuring initial load time where you can set a variable as soon as the main page of the app is loaded and then later call this function when the Tracer code has been loaded.

startTime {number}
The start time to set.

.startTracer(comment, opt_type)

Starts a tracer

comment {string}
A comment used to identify the tracer. Does not need to be unique.
opt_type {string=}
Type used to identify the tracer. If a Trace is given a type (the first argument to the constructor) and multiple Traces are done on that type then a "TOTAL line will be produced showing the total number of traces and the sum of the time ("TOTAL Database 2 (37 ms)" in our example). These traces should be mutually exclusive or else the sum won't make sense (the time will be double counted if the second starts before the first ends).
returns {number}
The identifier for the tracer that should be passed to the the stopTracer method.

.stopTracer(id, opt_silenceThreshold)

Stops a tracer

id {number|undefined|null}
The id of the tracer that is ending.
opt_silenceThreshold {number=}
Threshold below which the tracer is silenced.
returns {?number}
The elapsed time for the tracer or null if the tracer identitifer was not recognized.

.toString()

Returns a formatted string that describes the thread trace.

returns {string}
A formatted string.