nsITelemetry

Methods

registeredHistograms(count, histograms)

Returns an array whose values are the names of histograms defined
in Histograms.json.

newHistogram(name, expiration, min, max, bucket_count, histogram_type)

Create and return a histogram. Parameters:

Parameters

name Unique histogram name
expiration Expiration version
min - Minimal bucket size
max - Maximum bucket size
bucket_count - number of buckets in the histogram.
type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, HISTOGRAM_BOOLEAN or HISTOGRAM_COUNT The returned object has the following functions: add(int) - Adds an int value to the appropriate bucket snapshot() - Returns a snapshot of the histogram with the same data fields as in histogramSnapshots() clear() - Zeros out the histogram's buckets and sum

histogramFrom(name, existing_name)

Create a histogram using the current state of an existing histogram. The
existing histogram must be registered in TelemetryHistograms.h.

Parameters

name Unique histogram name
existing_name Existing histogram name The returned object has the same functions as a histogram returned from newHistogram.

getHistogramById(id)

Same as newHistogram above, but for histograms registered in TelemetryHistograms.h.

Parameters

id - unique identifier from TelemetryHistograms.h

registerAddonHistogram(addon_id, name, min, max, bucket_count, histogram_type)

Addon telemetry hooks */

Register a histogram for an addon. Throws an error if the
histogram name has been registered previously.

Parameters

addon_id - Unique ID of the addon
name - Unique histogram name
min - Minimal bucket size
max - Maximum bucket size
bucket_count - number of buckets in the histogram
histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, HISTOGRAM_BOOLEAN or HISTOGRAM_COUNT

getAddonHistogram(addon_id, name)

Return a histogram previously registered via
registerAddonHistogram. Throws an error if the id/name combo has
not been registered via registerAddonHistogram.

The returned object has the same functions as a histogram returned
from newHistogram.

Parameters

addon_id - Unique ID of the addon
name - Registered histogram name

unregisterAddonHistograms(addon_id)

Delete all histograms associated with the given addon id.

Parameters

addon_id - Unique ID of the addon

asyncFetchTelemetryData(aCallback)

Read data from the previous run. After the callback is called, the last
shutdown time is available in lastShutdownDuration and any late
writes in lateWrites.

msSinceProcessStart()

Return the number of seconds since process start using monotonic
timestamps (unaffected by system clock changes).
@throws NS_ERROR_NOT_AVAILABLE if TimeStamp doesn’t have the data.

Attributes

histogramSnapshots

lastShutdownDuration

The amount of time, in milliseconds, that the last session took
to shutdown. Reads as 0 to indicate failure.

failedProfileLockCount

The number of failed profile lock attempts that have occurred prior to
successfully locking the profile

slowSQL

debugSlowSQL

maximalNumberOfConcurrentThreads

A number representing the highest number of concurrent threads
reached during this session.

chromeHangs

threadHangStats

lateWrites

canRecord

Set this to false to disable gathering of telemetry statistics.

canSend

A flag indicating whether Telemetry can submit official results.

addonHistogramSnapshots

An object containing a snapshot from all of the currently
registered addon histograms.
{ addon-id1 : data1, … }

where data is an object whose properties are the names of the
addon’s histograms and whose corresponding values are as in
histogramSnapshots.

fileIOReports

Get statistics of file IO reports, null, if not recorded.

The statistics are returned as an object whose propoerties are the names
of the files that have been accessed and whose corresponding values are
arrays of size three, representing startup, normal, and shutdown stages.
Each stage’s entry is either null or an array with the layout
[total_time, #creates, #reads, #writes, #fsyncs, #stats]

Constants

HISTOGRAM_EXPONENTIAL

Histogram types:
HISTOGRAM_EXPONENTIAL - buckets increase exponentially
HISTOGRAM_LINEAR - buckets increase linearly
HISTOGRAM_BOOLEAN - For storing 0/1 values
HISTOGRAM_FLAG - For storing a single value; its count is always == 1.
HISTOGRAM_COUNT - For storing counter values without bucketing.

HISTOGRAM_LINEAR

HISTOGRAM_BOOLEAN

HISTOGRAM_FLAG

HISTOGRAM_COUNT