/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" #include "nsIFile.idl" [scriptable,function, uuid(3d3b9075-5549-4244-9c08-b64fefa1dd60)] interface nsIFetchTelemetryDataCallback : nsISupports { void complete(); }; [scriptable, uuid(273d2dd0-6c63-475a-b864-cb65160a1909)] interface nsITelemetry : nsISupports { /** * 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_CATEGORICAL - For storing enumerated values by label. */ const unsigned long HISTOGRAM_EXPONENTIAL = 0; const unsigned long HISTOGRAM_LINEAR = 1; const unsigned long HISTOGRAM_BOOLEAN = 2; const unsigned long HISTOGRAM_FLAG = 3; const unsigned long HISTOGRAM_COUNT = 4; const unsigned long HISTOGRAM_CATEGORICAL = 5; /** * Scalar types: * SCALAR_COUNT - for storing a numeric value * SCALAR_STRING - for storing a string value * SCALAR_BOOLEAN - for storing a boolean value */ const unsigned long SCALAR_COUNT = 0; const unsigned long SCALAR_STRING = 1; const unsigned long SCALAR_BOOLEAN = 2; /** * Dataset types: * DATASET_RELEASE_CHANNEL_OPTOUT - the basic dataset that is on-by-default on all channels * DATASET_RELEASE_CHANNEL_OPTIN - the extended dataset that is opt-in on release, * opt-out on pre-release channels. */ const unsigned long DATASET_RELEASE_CHANNEL_OPTOUT = 0; const unsigned long DATASET_RELEASE_CHANNEL_OPTIN = 1; /** * An object containing a snapshot from all of the currently registered histograms. * { name1: {data1}, name2:{data2}...} * where data is consists of the following properties: * min - Minimal bucket size * max - Maximum bucket size * histogram_type - HISTOGRAM_EXPONENTIAL, HISTOGRAM_LINEAR, HISTOGRAM_BOOLEAN * or HISTOGRAM_COUNT * counts - array representing contents of the buckets in the histogram * ranges - an array with calculated bucket sizes * sum - sum of the bucket contents */ [implicit_jscontext] readonly attribute jsval histogramSnapshots; /** * Get a snapshot of the internally duplicated subsession histograms. * @param clear Whether to clear out the subsession histograms after snapshotting. * @return An object as histogramSnapshots, except this contains the internally duplicated histograms for subsession telemetry. */ [implicit_jscontext] jsval snapshotSubsessionHistograms([optional] in boolean clear); /** * The amount of time, in milliseconds, that the last session took * to shutdown. Reads as 0 to indicate failure. */ readonly attribute uint32_t lastShutdownDuration; /** * The number of failed profile lock attempts that have occurred prior to * successfully locking the profile */ readonly attribute uint32_t failedProfileLockCount; /* * An object containing information about slow SQL statements. * * { * mainThread: { "sqlString1": [, ], "sqlString2": [...], ... }, * otherThreads: { "sqlString3": [, ], "sqlString4": [...], ... } * } * * where: * mainThread: Slow statements that executed on the main thread * otherThreads: Slow statements that executed on a non-main thread * sqlString - String of the offending statement (see note) * hit count - The number of times this statement required longer than the threshold time to execute * total time - The sum of all execution times above the threshold time for this statement * * Note that dynamic SQL strings and SQL strings executed against addon DBs could contain private information. * This property represents such SQL as aggregate database-level stats and the sqlString contains the database * filename instead. */ [implicit_jscontext] readonly attribute jsval slowSQL; /* * See slowSQL above. * * An object containing full strings of every slow SQL statement if toolkit.telemetry.debugSlowSql = true * The returned SQL strings may contain private information and should not be reported to Telemetry. */ [implicit_jscontext] readonly attribute jsval debugSlowSQL; /* * An object containing information about Webrtc related stats. For now it * only contains local and remote ICE candidates avaiable when a Webrtc * PeerConnection gets terminated. */ [implicit_jscontext] readonly attribute jsval webrtcStats; /** * A number representing the highest number of concurrent threads * reached during this session. */ readonly attribute uint32_t maximalNumberOfConcurrentThreads; /* * An array of chrome hang reports. Each element is a hang report represented * as an object containing the hang duration, call stack PCs and information * about modules in memory. */ [implicit_jscontext] readonly attribute jsval chromeHangs; /* * Record the current thread's call stack on demand. Note that, the stack is * only captured at the first call. All subsequent calls result in incrementing * the capture counter without doing actual stack unwinding. * * @param aKey - A user defined key associated with the captured stack. * * NOTE: Unwinding call stacks is an expensive operation performance-wise. */ void captureStack(in ACString name); /* * Returns a snapshot of captured stacks. The data has the following structure: * * { * "memoryMap": [ * ["wgdi32.pdb", "08A541B5942242BDB4AEABD8C87E4CFF2"], * ["igd10iumd32.pdb", "D36DEBF2E78149B5BE1856B772F1C3991"], * ... other entries in the format ["module name", "breakpad identifier"] ... * ], * "stacks": [ * [ * [ * 0, // the module index or -1 for invalid module indices * 190649 // the offset of this program counter in its module or an absolute pc * ], * [1, 2540075], * ... other frames ... * ], * ... other stacks ... * ], * "captures": [["string-key", stack-index, count], ... ] * } * * @param clear Whether to clear out the subsession histograms after taking a snapshot. * * @return A snapshot of captured stacks. */ [implicit_jscontext] jsval snapshotCapturedStacks([optional] in boolean clear); /* * Asynchronously get an array of the modules loaded in the process. * * The data has the following structure: * * [ * { * "name": , // Name of the module file (e.g. xul.dll) * "version": , // Version of the module * "debugName": , // ID of the debug information file * "debugID": , // Name of the debug information file * }, * ... * ] * * @return A promise that resolves to an array of modules or rejects with NS_ERROR_FAILURE on failure. * @throws NS_ERROR_NOT_IMPLEMENTED if the Gecko profiler is not enabled. */ [implicit_jscontext] nsISupports getLoadedModules(); /* * An array of thread hang stats, * [, , ...] * represents a single thread, * {"name": "", * "activity":